### Run Reasonix Code Source: https://api-docs.deepseek.com/quick_start/agent_integrations/reasonix Navigate to your project directory and execute this command to start Reasonix. No global installation is required. ```bash cd /path/to/my-project npx reasonix code ``` -------------------------------- ### Initialize and Run AstrBot Source: https://api-docs.deepseek.com/quick_start/agent_integrations/astrbot Run these commands after installing AstrBot to initialize the environment and start the application. ```bash astrbot init # Run this only once to initialize the environment. This command installs AstrBot into the current terminal directory. ``` ```bash astrbot run # Start AstrBot. This command checks whether AstrBot is installed in the current directory; if not, it prompts you to initialize it with `astrbot init`. ``` -------------------------------- ### Start Nanobot Agent Source: https://api-docs.deepseek.com/quick_start/agent_integrations/nanobot Launch the Nanobot agent from your terminal after completing the installation and configuration steps. ```bash nanobot agent ``` -------------------------------- ### Python Chat Completions Example Source: https://api-docs.deepseek.com/api_samples/chat_python Demonstrates how to use the OpenAI SDK with Deepseek API for chat completions. Ensure the 'openai' SDK is installed and the DEEPSEEK_API_KEY environment variable is set. ```python # Please install OpenAI SDK first: `pip3 install openai` import os from openai import OpenAI client = OpenAI( api_key=os.environ.get('DEEPSEEK_API_KEY'), base_url="https://api.deepseek.com") response = client.chat.completions.create( model="deepseek-v4-pro", messages=[ {"role": "system", "content": "You are a helpful assistant"}, {"role": "user", "content": "Hello"}, ], stream=False, reasoning_effort="high", extra_body={"thinking": {"type": "enabled"}} ) print(response.choices[0].message.content) ``` -------------------------------- ### Install OpenClaw (Windows) Source: https://api-docs.deepseek.com/guides/coding_agents Install OpenClaw on Windows by running the provided installation script via PowerShell. ```powershell iwr -useb https://openclaw.ai/install.ps1 | iex ``` -------------------------------- ### Install OpenClaw (Linux/Mac) Source: https://api-docs.deepseek.com/guides/coding_agents Install OpenClaw on Linux or Mac by running the provided installation script via curl. ```bash curl -fsSL https://openclaw.ai/install.sh | bash ``` -------------------------------- ### Python Tool Call Example (Non-thinking Mode) Source: https://api-docs.deepseek.com/guides/tool_calls Demonstrates how to use Tool Calls in Python to get weather information. The model suggests a tool call, and the user provides the result. Ensure you implement the actual tool function separately. ```python from openai import OpenAI def send_messages(messages): response = client.chat.completions.create( model="deepseek-v4-pro", messages=messages, tools=tools ) return response.choices[0].message client = OpenAI( api_key="", base_url="https://api.deepseek.com", ) tools = [ { "type": "function", "function": { "name": "get_weather", "description": "Get weather of a location, the user should supply a location first.", "parameters": { "type": "object", "properties": { "location": { "type": "string", "description": "The city and state, e.g. San Francisco, CA", } }, "required": ["location"] }, } }, ] messages = [{"role": "user", "content": "How's the weather in Hangzhou, Zhejiang?"}] message = send_messages(messages) print(f"User>\t {messages[0]['content']}") tool = message.tool_calls[0] messages.append(message) messages.append({"role": "tool", "tool_call_id": tool.id, "content": "24℃"}) message = send_messages(messages) print(f"Model>\t {message.content}") ``` -------------------------------- ### Install Pi via Official Script (Linux/macOS) Source: https://api-docs.deepseek.com/quick_start/agent_integrations/pi_mono Alternative installation method for Linux and macOS users using a curl script. This script automates the installation process. ```bash curl -fsSL https://pi.dev/install.sh | sh ``` -------------------------------- ### Install Crush CLI Source: https://api-docs.deepseek.com/quick_start/agent_integrations/crush Install the Crush command-line interface globally using npm. Verify the installation by checking the version. ```bash npm install -g @charmland/crush ``` ```bash crush --version ``` -------------------------------- ### Install Nanobot Source: https://api-docs.deepseek.com/quick_start/agent_integrations/nanobot Use uv to install the nanobot package. On Windows, ensure the .local/bin directory is in your PATH. Update the shell environment if necessary. ```bash uv tool install nanobot-ai ``` ```powershell $env:PATH = "$env:USERPROFILE\.local\bin;$env:PATH" ``` ```bash uv tool update-shell ``` ```bash nanobot --version ``` -------------------------------- ### Install Anthropic SDK Source: https://api-docs.deepseek.com/guides/anthropic_api Install the official Anthropic SDK using pip. This is the first step to interact with the Anthropic API. ```bash pip install anthropic ``` -------------------------------- ### Install Pi CLI Source: https://api-docs.deepseek.com/quick_start/agent_integrations/pi_mono Install the Pi command-line interface globally using npm. This command is used for installing the Pi agent. ```bash npm install -g @mariozechner/pi-coding-agent ``` -------------------------------- ### Python FIM Completion Example Source: https://api-docs.deepseek.com/guides/fim_completion Use this Python code to perform FIM completion. Ensure you have the `openai` library installed and set the correct API key and base URL for the beta feature. ```python from openai import OpenAI client = OpenAI( api_key="", base_url="https://api.deepseek.com/beta", ) response = client.completions.create( model="deepseek-v4-pro", prompt="def fib(a):", suffix=" return fib(a-1) + fib(a-2)", max_tokens=128 ) print(response.choices[0].text) ``` -------------------------------- ### Turn 1.1: Get Date Tool Call Source: https://api-docs.deepseek.com/guides/thinking_mode Example of a tool call to get the current date, used as a precursor to determining tomorrow's date for weather forecasts. The reasoning content explains the model's thought process. ```python reasoning_content="The user is asking about the weather in Hangzhou tomorrow. I need to get tomorrow's date first, then call the weather function." content="Let me check tomorrow's weather in Hangzhou for you. First, let me get tomorrow's date." tool_calls=[ChatCompletionMessageFunctionToolCall(id='call_00_kw66qNnNto11bSfJVIdlV5Oo', function=Function(arguments='{}', name='get_date'), type='function', index=0)] tool result for get_date: 2026-04-19 ``` -------------------------------- ### Start Copilot CLI Source: https://api-docs.deepseek.com/quick_start/agent_integrations/copilot_cli Launch the GitHub Copilot CLI. This command starts the CLI in full agent mode, enabling features like tool calling and MCP powered by DeepSeek. ```bash copilot ``` -------------------------------- ### Install OpenClaw (Linux/Mac) Source: https://api-docs.deepseek.com/quick_start/agent_integrations/openclaw Use this command to install OpenClaw from the official install script on Linux or Mac systems. ```bash curl -fsSL https://openclaw.ai/install.sh | bash ``` -------------------------------- ### Install Kilo Code CLI Source: https://api-docs.deepseek.com/quick_start/agent_integrations/kilo_code Run this command in your terminal to install the Kilo Code CLI globally. Ensure Node.js is installed first. ```bash npm install -g @kilocode/cli ``` -------------------------------- ### Verify Pi Installation Source: https://api-docs.deepseek.com/quick_start/agent_integrations/pi_mono Verify the Pi installation by checking its version in the terminal. This confirms that Pi has been installed correctly. ```bash pi --version ``` -------------------------------- ### Start AstrBot with Docker Source: https://api-docs.deepseek.com/quick_start/agent_integrations/astrbot Start the AstrBot service using Docker Compose after cloning the repository. ```bash sudo docker compose up -d ``` -------------------------------- ### Launch OpenClaw Web UI Source: https://api-docs.deepseek.com/quick_start/agent_integrations/openclaw Start the OpenClaw Web UI to interact with the assistant through a graphical interface. ```bash openclaw dashboard ``` -------------------------------- ### Install AstrBot via uv (Windows) Source: https://api-docs.deepseek.com/quick_start/agent_integrations/astrbot Use this command to install AstrBot on Windows systems. ```powershell iwr -useb https://docs.astrbot.app/install.ps1 | iex ``` -------------------------------- ### Install GitHub Copilot CLI Source: https://api-docs.deepseek.com/quick_start/agent_integrations/copilot_cli Install the GitHub Copilot CLI globally using npm. Requires Node.js 22 or later. ```bash npm install -g @github/copilot ``` -------------------------------- ### Verify Kilo Code CLI Installation Source: https://api-docs.deepseek.com/quick_start/agent_integrations/kilo_code After installation, execute this command to verify that the Kilo Code CLI has been installed successfully. A version number indicates success. ```bash kilo --version ``` -------------------------------- ### User Balance Response Example Source: https://api-docs.deepseek.com/api/get-user-balance Example of a successful response (200 OK) for the user balance request. It shows the availability status and detailed balance information per currency. ```json { "is_available": true, "balance_infos": [ { "currency": "CNY", "total_balance": "110.00", "granted_balance": "10.00", "topped_up_balance": "100.00" } ] } ``` -------------------------------- ### Install OpenClaw (Windows) Source: https://api-docs.deepseek.com/quick_start/agent_integrations/openclaw Use this command to install OpenClaw from the official install script on Windows systems using PowerShell. ```powershell iwr -useb https://openclaw.ai/install.ps1 | iex ``` -------------------------------- ### Install Hermes Agent (Linux/macOS/WSL2) Source: https://api-docs.deepseek.com/quick_start/agent_integrations/hermes Use this command to quickly install the Hermes Agent on Linux, macOS, or WSL2. Ensure Git is installed as it's the only prerequisite. The script handles all other dependencies. ```bash curl -fsSL https://raw.githubusercontent.com/NousResearch/hermes-agent/main/scripts/install.sh | bash ``` -------------------------------- ### Manual Langcli Installation Source: https://api-docs.deepseek.com/quick_start/agent_integrations/langcli Install Langcli globally using npm. Ensure you have Node.js version 20 or later installed before running this command. ```bash npm i -g langcli-com ``` -------------------------------- ### Install Langcli (macOS/Linux/WSL) Source: https://api-docs.deepseek.com/quick_start/agent_integrations/langcli Use this command for a quick installation of Langcli on macOS, Linux, and WSL environments. Restart your terminal after installation for environment variables to take effect. ```bash bash -c "$(curl -fsSL https://assets.langcli.com/installation/install-langcli.sh)" ``` -------------------------------- ### Install Langcli (Windows) Source: https://api-docs.deepseek.com/quick_start/agent_integrations/langcli For Windows users, run this command in an Administrator CMD to download and execute the Langcli installation batch file. Restart your terminal after installation for environment variables to take effect. ```cmd cmd /c "curl -fsSL -o %TEMP%\install-langcli.bat https://assets.langcli.com/installation/install-langcli.bat && %TEMP%\install-langcli.bat" ``` -------------------------------- ### Install AstrBot via uv (macOS/Linux) Source: https://api-docs.deepseek.com/quick_start/agent_integrations/astrbot Use this command to install AstrBot on macOS and Linux systems. ```bash curl -LsSf https://docs.astrbot.app/install.sh | bash ``` -------------------------------- ### Install Claude Code Source: https://api-docs.deepseek.com/quick_start/agent_integrations/claude_code Install Claude Code globally using npm. Ensure you have Node.js 18+ installed. Windows users also need Git for Windows. ```bash npm install -g @anthropic-ai/claude-code ``` -------------------------------- ### Python Sample Output Source: https://api-docs.deepseek.com/guides/comparison_testing Expected output when running the Python V3.1-Terminus example. ```text Model is: deepseek-v3.1-terminus Output is: Hello! How can I help you today? ``` -------------------------------- ### Start Claude Code Session Source: https://api-docs.deepseek.com/guides/coding_agents Navigate to your project directory and initiate a Claude Code session. This command starts the AI assistant within your terminal. ```bash cd /path/to/my-project claude ``` -------------------------------- ### Completion API Response Example Source: https://api-docs.deepseek.com/api/create-completion This is an example of a successful JSON response from the completion API. It includes details about the completion, model, and usage. ```json { "id": "string", "choices": [ { "finish_reason": "stop", "index": 0, "logprobs": { "text_offset": [ 0 ], "token_logprobs": [ 0 ], "tokens": [ "string" ], "top_logprobs": [ {} ] }, "text": "string" } ], "created": 0, "model": "string", "system_fingerprint": "string", "object": "text_completion", "usage": { "completion_tokens": 0, "prompt_tokens": 0, "prompt_cache_hit_tokens": 0, "prompt_cache_miss_tokens": 0, "total_tokens": 0, "completion_tokens_details": { "reasoning_tokens": 0 } } } ``` -------------------------------- ### Example JSON Response for Models Source: https://api-docs.deepseek.com/api/list-models An example of the JSON response returned by the /models endpoint, showing a list of available models with their IDs, object types, and ownership. ```json { "object": "list", "data": [ { "id": "deepseek-v4-flash", "object": "model", "owned_by": "deepseek" }, { "id": "deepseek-v4-pro", "object": "model", "owned_by": "deepseek" } ] } ``` -------------------------------- ### Run Claude Code Source: https://api-docs.deepseek.com/quick_start/agent_integrations/claude_code Navigate to your project directory and run the 'claude' command to start the AI coding assistant. ```bash cd /path/to/my-project claude ``` -------------------------------- ### GET /models Source: https://api-docs.deepseek.com/api/list-models Lists the currently available models and provides basic information about each one, such as the owner and availability. ```APIDOC ## GET /models ### Description Lists the currently available models and provides basic information about each one, such as the owner and availability. ### Method GET ### Endpoint /models ### Responses #### Success Response (200) - **object** (string) - Required. Possible values: [`list`] - **data** (array) - Required. An array of model objects. - **id** (string) - Required. The model identifier. - **object** (string) - Required. The object type, always "model". - **owned_by** (string) - Required. The organization that owns the model. #### Response Example ```json { "object": "list", "data": [ { "id": "deepseek-v4-flash", "object": "model", "owned_by": "deepseek" }, { "id": "deepseek-v4-pro", "object": "model", "owned_by": "deepseek" } ] } ``` ``` -------------------------------- ### Initialize Nanobot Configuration Source: https://api-docs.deepseek.com/quick_start/agent_integrations/nanobot Run this command to create the nanobot configuration file. The file path depends on your operating system. ```bash nanobot onboard ``` -------------------------------- ### Run Pi and Select Model Source: https://api-docs.deepseek.com/quick_start/agent_integrations/pi_mono Navigate to your project directory and run the Pi command. Use the `/model` command within Pi to switch to the DeepSeek provider and select a model. ```bash cd /path/to/my-project pi ``` -------------------------------- ### Invoke Chat API with Node.js (OpenAI SDK) Source: https://api-docs.deepseek.com This Node.js script utilizes the OpenAI SDK for DeepSeek API integration. Install the SDK with 'npm install openai'. Configure the baseURL and apiKey using environment variables. The example demonstrates a non-stream chat completion request with reasoning features enabled. ```javascript // Please install OpenAI SDK first: `npm install openai` import OpenAI from "openai"; const openai = new OpenAI({ baseURL: 'https://api.deepseek.com', apiKey: process.env.DEEPSEEK_API_KEY, }); async function main() { const completion = await openai.chat.completions.create({ messages: [{ role: "system", content: "You are a helpful assistant." }], model: "deepseek-v4-pro", thinking: {"type": "enabled"}, reasoning_effort: "high", stream: false, }); console.log(completion.choices[0].message.content); } main(); ``` -------------------------------- ### Chat Completion with Node.js Source: https://api-docs.deepseek.com/api_samples/chat_nodejs Use this snippet to send a system message and get a chat completion from the DeepSeek API. Ensure you have installed the OpenAI SDK and set your DEEPSEEK_API_KEY environment variable. ```javascript // Please install OpenAI SDK first: `npm install openai` import OpenAI from "openai"; const openai = new OpenAI({ baseURL: 'https://api.deepseek.com', apiKey: process.env.DEEPSEEK_API_KEY, }); async function main() { const completion = await openai.chat.completions.create({ messages: [{ role: "system", content: "You are a helpful assistant." }], model: "deepseek-v4-pro", thinking: {"type": "enabled"}, reasoning_effort: "high", stream: false, }); console.log(completion.choices[0].message.content); } main(); ``` -------------------------------- ### Invoke Chat API with Python (OpenAI SDK) Source: https://api-docs.deepseek.com This Python script uses the OpenAI SDK to interact with the DeepSeek API. Install the SDK using 'pip3 install openai'. Set your API key via the DEEPSEEK_API_KEY environment variable and configure the base URL. This example sends a non-stream request with advanced reasoning enabled. ```python # Please install OpenAI SDK first: `pip3 install openai` import os from openai import OpenAI client = OpenAI( api_key=os.environ.get('DEEPSEEK_API_KEY'), base_url="https://api.deepseek.com") response = client.chat.completions.create( model="deepseek-v4-pro", messages=[ {"role": "system", "content": "You are a helpful assistant"}, {"role": "user", "content": "Hello"}, ], stream=False, reasoning_effort="high", extra_body={"thinking": {"type": "enabled"}} ) print(response.choices[0].message.content) ``` -------------------------------- ### Run Kilo Code in Project Source: https://api-docs.deepseek.com/quick_start/agent_integrations/kilo_code Navigate to your project directory and run the `kilo` command to start the AI coding assistant within your project context. ```bash cd /path/to/my-project kilo ``` -------------------------------- ### Verify Claude Code Installation Source: https://api-docs.deepseek.com/quick_start/agent_integrations/claude_code Run this command after installation to check if Claude Code is installed successfully. A version number indicates a successful installation. ```bash claude --version ``` -------------------------------- ### Run Crush in Project Directory Source: https://api-docs.deepseek.com/quick_start/agent_integrations/crush Navigate to your project directory and run the Crush command to start the AI coding agent. Use Ctrl+L or /model to switch models. ```bash cd /path/to/my-project crush ``` -------------------------------- ### Install Claude Code Source: https://api-docs.deepseek.com/guides/coding_agents Install the Claude Code package globally using npm. Ensure Node.js 18+ is installed. ```bash npm install -g @anthropic-ai/claude-code ``` -------------------------------- ### Python Example for LangChain with DeepSeek API Source: https://api-docs.deepseek.com/faq Demonstrates how to integrate DeepSeek API with the LangChain framework. Ensure you replace the placeholder API key with your actual key. ```python from langchain_community.chat_models.deepseek import ChatDeepSeek llm = ChatDeepSeek( model="deepseek-chat", deepseek_api_key="YOUR_API_KEY", ) response = llm.invoke("Hello, world!") print(response.content) ``` -------------------------------- ### Install Deep Code CLI Source: https://api-docs.deepseek.com/quick_start/agent_integrations/deepcode Install the Deep Code command-line interface globally using npm. Ensure Node.js 18+ is installed. ```bash npm install -g @vegamo/deepcode-cli ``` -------------------------------- ### Verify Claude Code Installation Source: https://api-docs.deepseek.com/guides/coding_agents Verify the successful installation of Claude Code by checking its version. This command should display the installed version number. ```bash claude --version ``` -------------------------------- ### Launch Deep Code in a Project Source: https://api-docs.deepseek.com/quick_start/agent_integrations/deepcode Navigate to your project directory and launch the Deep Code CLI to start an AI coding session. ```bash cd /path/to/my-project deepcode ``` -------------------------------- ### Chat Completion Example Source: https://api-docs.deepseek.com/api/create-chat-completion An example of a successful response from the Chat Completion API. ```APIDOC ## Chat Completion Example ### Response Example ```json { "id": "930c60df-bf64-41c9-a88e-3ec75f81e00e", "choices": [ { "finish_reason": "stop", "index": 0, "message": { "content": "Hello! How can I help you today?", "role": "assistant" } } ], "created": 1705651092, "model": "deepseek-v4-pro", "object": "chat.completion", "usage": { "completion_tokens": 10, "prompt_tokens": 16, "total_tokens": 26 } } ``` ``` -------------------------------- ### Start OpenClaw Dashboard Source: https://api-docs.deepseek.com/guides/coding_agents Launch the OpenClaw Web UI to interact with the AI assistant through its dashboard. This command opens the interface in your web browser. ```bash openclaw dashboard ``` -------------------------------- ### Python Example for DeepSeek Tool Calls Source: https://api-docs.deepseek.com/guides/thinking_mode This Python script demonstrates how to use tool calls with the DeepSeek model in thinking mode. It includes tool definitions, mock functions for tools, and a loop to handle multi-turn reasoning and tool execution. Ensure `reasoning_content` is passed back correctly in subsequent requests. ```python import os import json from openai import OpenAI from datetime import datetime # The definition of the tools tools = [ { "type": "function", "function": { "name": "get_date", "description": "Get the current date", "parameters": { "type": "object", "properties": {} }, } }, { "type": "function", "function": { "name": "get_weather", "description": "Get weather of a location, the user should supply the location and date.", "parameters": { "type": "object", "properties": { "location": { "type": "string", "description": "The city name" }, "date": { "type": "string", "description": "The date in format YYYY-mm-dd" }, }, "required": ["location", "date"] }, } }, ] # The mocked version of the tool calls def get_date_mock(): return datetime.now().strftime("%Y-%m-%d") def get_weather_mock(location, date): return "Cloudy 7~13°C" TOOL_CALL_MAP = { "get_date": get_date_mock, "get_weather": get_weather_mock } def run_turn(turn, messages): sub_turn = 1 while True: response = client.chat.completions.create( model='deepseek-v4-pro', messages=messages, tools=tools, reasoning_effort="high", extra_body={ "thinking": { "type": "enabled" } }, ) messages.append(response.choices[0].message) reasoning_content = response.choices[0].message.reasoning_content content = response.choices[0].message.content tool_calls = response.choices[0].message.tool_calls print(f"Turn {turn}.{sub_turn}\n{reasoning_content=}\n{content=}\n{tool_calls=}") # If there is no tool calls, then the model should get a final answer and we need to stop the loop if tool_calls is None: break for tool in tool_calls: tool_function = TOOL_CALL_MAP[tool.function.name] tool_result = tool_function(**json.loads(tool.function.arguments)) print(f"tool result for {tool.function.name}: {tool_result}\n") messages.append({ "role": "tool", "tool_call_id": tool.id, "content": tool_result, }) sub_turn += 1 print() client = OpenAI( api_key=os.environ.get('DEEPSEEK_API_KEY'), base_url=os.environ.get('DEEPSEEK_BASE_URL'), ) # The user starts a question turn = 1 messages = [{ "role": "user", "content": "How's the weather in Hangzhou Tomorrow" }] run_turn(turn, messages) ``` -------------------------------- ### Verify Deep Code Installation Source: https://api-docs.deepseek.com/quick_start/agent_integrations/deepcode Check if the Deep Code CLI was installed successfully by running the version command. ```bash deepcode --version ``` -------------------------------- ### Python Example for Deepseek Thinking Mode Tool Calls Source: https://api-docs.deepseek.com/api_samples/thinking_mode_api_example_tool_call This script defines tools, mocks their implementations, and uses the Deepseek API to process user queries by calling these tools. It's useful for building conversational agents that can access external information. ```python import os import json from openai import OpenAI from datetime import datetime # The definition of the tools tools = [ { "type": "function", "function": { "name": "get_date", "description": "Get the current date", "parameters": { "type": "object", "properties": {} }, } }, { "type": "function", "function": { "name": "get_weather", "description": "Get weather of a location, the user should supply the location and date.", "parameters": { "type": "object", "properties": { "location": { "type": "string", "description": "The city name" }, "date": { "type": "string", "description": "The date in format YYYY-mm-dd" }, }, "required": ["location", "date"] }, } }, ] # The mocked version of the tool calls def get_date_mock(): return datetime.now().strftime("%Y-%m-%d") def get_weather_mock(location, date): return "Cloudy 7~13°C" TOOL_CALL_MAP = { "get_date": get_date_mock, "get_weather": get_weather_mock } def run_turn(turn, messages): sub_turn = 1 while True: response = client.chat.completions.create( model='deepseek-v4-pro', messages=messages, tools=tools, reasoning_effort="high", extra_body={ "thinking": { "type": "enabled" } }, ) messages.append(response.choices[0].message) reasoning_content = response.choices[0].message.reasoning_content content = response.choices[0].message.content tool_calls = response.choices[0].message.tool_calls print(f"Turn {turn}.{sub_turn}\n{reasoning_content=}\n{content=}\n{tool_calls=}") # If there is no tool calls, then the model should get a final answer and we need to stop the loop if tool_calls is None: break for tool in tool_calls: tool_function = TOOL_CALL_MAP[tool.function.name] tool_result = tool_function(**json.loads(tool.function.arguments)) print(f"tool result for {tool.function.name}: {tool_result}\n") messages.append({ "role": "tool", "tool_call_id": tool.id, "content": tool_result, }) sub_turn += 1 print() client = OpenAI( api_key=os.environ.get('DEEPSEEK_API_KEY'), base_url=os.environ.get('DEEPSEEK_BASE_URL'), ) # The user starts a question turn = 1 messages = [{ "role": "user", "content": "How's the weather in Hangzhou Tomorrow" }] run_turn(turn, messages) # The user starts a new question turn = 2 messages.append({ "role": "user", "content": "How's the weather in Guangzhou Tomorrow" }) run_turn(turn, messages) ``` -------------------------------- ### Example JSON Output from DeepSeek Model Source: https://api-docs.deepseek.com/guides/json_mode This is an example of the structured JSON output generated by the DeepSeek model when the JSON Output feature is enabled. ```json { "question": "Which is the longest river in the world?", "answer": "The Nile River" } ```