DeepSeek Chat Completion
deepseek_chatChat with DeepSeek AI for general conversations. Supports multi-turn sessions, function calling, and multimodal input for flexible interaction.
Instructions
Chat with DeepSeek AI models. Supports deepseek-chat for general conversations and deepseek-reasoner for complex reasoning tasks with chain-of-thought explanations. Features: multi-turn sessions (session_id), function calling (tools parameter), thinking mode, JSON output mode, multimodal input (when enabled), automatic cost tracking, and model fallback with circuit breaker resilience.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| messages | Yes | Array of conversation messages. Each message has role (system/user/assistant/tool) and content (string or array of content parts for multimodal). Tool messages require tool_call_id. | |
| model | No | Model to use. Both run DeepSeek V3.2 (128K context). deepseek-chat: non-thinking mode (max 8K output), deepseek-reasoner: thinking mode (max 64K output) | deepseek-chat |
| temperature | No | Sampling temperature (0-2). Higher = more random. Default: 1.0. Ignored when thinking mode is enabled. | |
| max_tokens | No | Maximum tokens to generate. deepseek-chat: max 8192, deepseek-reasoner: max 65536 | |
| stream | No | Enable streaming mode. Returns full response after streaming completes. | |
| tools | No | Array of tool definitions for function calling. Each tool has type "function" and a function object with name, description, and parameters (JSON Schema). | |
| tool_choice | No | Controls which tool the model calls. "auto" (default), "none", "required", or {type:"function",function:{name:"..."}} | |
| thinking | No | Enable thinking mode. When enabled, temperature/top_p/frequency_penalty/presence_penalty are automatically ignored. Use {type: "enabled"} to activate. | |
| json_mode | No | Enable JSON output mode. The model will output valid JSON. Include the word "json" in your prompt for best results. Supported by both models. | |
| session_id | No | Session ID for multi-turn conversations. When provided, previous messages from this session are prepended to the current messages. If the session does not exist, it is created automatically. Omit for stateless single-turn requests. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| content | Yes | ||
| reasoning_content | No | ||
| model | Yes | ||
| usage | Yes | ||
| finish_reason | Yes | ||
| tool_calls | No | ||
| session_id | No |