# DeepSeek family API: model IDs, thinking mode, the Anthropic API and errors Source: https://ofox.io/docs/develop/models/deepseek DeepSeek's V4 series models, including V4.1 Flash, V4 Pro and V4 Flash. They are called through the OpenAI-compatible API and also support the Anthropic-native API, so they work directly in tools such as Claude Code. ## Common tasks - [Turn thinking off or on](#thinking) — Thinking is on by default; how to turn it off when responses are slow. - [Use in Claude Code](#anthropic) — Call DeepSeek through the Anthropic API. - [JSON output & tool calling](#json) — response_format and tools. - [Troubleshooting errors](#errors) — Empty answers, request timeouts, model not found. ## Models The V4 series has a 1M-token context and a maximum output of 384K tokens. V4.1 Flash accepts image input; the other models are text-only. For the full model list and live prices, see the [model page](https://ofox.io/models?provider=deepseek). **Common model IDs (copy them exactly)** - DeepSeek V4.1 Flash: `deepseek/deepseek-v4.1-flash` — Supports image input - DeepSeek V4 Pro: `deepseek/deepseek-v4-pro-0813` - DeepSeek V4 Flash: `deepseek/deepseek-v4-flash-0731` ### Aliases and versions | Alias | Points to | Notes | |---|---|---| | `deepseek-v4-pro` | `deepseek/deepseek-v4-pro-0813` | Always points to the latest V4 Pro version | | `deepseek-v4-flash` | `deepseek/deepseek-v4-flash-0731` | Always points to the latest V4 Flash version | | `deepseek-flash` | `deepseek/deepseek-v4.1-flash` | — | - Use aliases **without** the `deepseek/` prefix, e.g. `"model": "deepseek-v4-pro"`; `deepseek/deepseek-v4-pro` returns 404. - `deepseek-chat` and `deepseek-reasoner` from DeepSeek's official API are not available on OfoxAI; use the model IDs in the table above instead. - The earlier versions `deepseek/deepseek-v4-pro-0423` and `deepseek/deepseek-v4-flash-0423` can still be called, but enable thinking differently from the newer versions — see [Thinking mode](#thinking). ## Examples **Python** ```python filename="deepseek_basic.py" import os from openai import OpenAI client = OpenAI(base_url="https://api.ofox.io/v1", api_key=os.environ["OFOX_API_KEY"]) resp = client.chat.completions.create( model="deepseek/deepseek-v4-flash-0731", messages=[{"role": "user", "content": "Explain idempotency in one sentence."}], extra_body={"thinking": {"type": "disabled"}}, ) print(resp.choices[0].message.content) ``` **cURL** ```bash filename="Terminal" curl https://api.ofox.io/v1/chat/completions \ -H "Authorization: Bearer $OFOX_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "deepseek/deepseek-v4-flash-0731", "messages": [{"role": "user", "content": "Explain idempotency in one sentence."}], "thinking": {"type": "disabled"} }' ``` ## Thinking mode **Key point**:V4.1 Flash, V4 Pro and V4 Flash think by default, and complex questions can take more than 2 minutes. If you don't need thinking, set the thinking type to disabled. | Model | Default | Turn thinking off | Turn thinking on | |---|---|---|---| | V4.1 Flash, V4 Pro (0813), V4 Flash (0731) | On | `"thinking": {"type": "disabled"}` | On by default | | V4 Pro (0423), V4 Flash (0423) | Off | Off by default | `"reasoning_effort": "high"` | In our tests on the same math problem, V4 Pro thought for about 12,000 tokens by default and took about 2 minutes; with thinking off it took about 20 seconds. Thinking tokens are billed at the output rate; the count is in `usage.completion_tokens_details.reasoning_tokens`. ### Reading the thinking content **Non-streaming** ```python filename="deepseek_reasoning.py" import os from openai import OpenAI client = OpenAI(base_url="https://api.ofox.io/v1", api_key=os.environ["OFOX_API_KEY"]) resp = client.chat.completions.create( model="deepseek/deepseek-v4-flash-0731", messages=[{"role": "user", "content": "What is 17 × 23?"}], ) msg = resp.choices[0].message details = getattr(msg, "reasoning_details", None) or [] print("[Thinking]", "".join(d.get("text", "") for d in details)) print("[Answer]", msg.content) ``` **Streaming** ```python filename="deepseek_reasoning_stream.py" import os from openai import OpenAI client = OpenAI(base_url="https://api.ofox.io/v1", api_key=os.environ["OFOX_API_KEY"]) stream = client.chat.completions.create( model="deepseek/deepseek-v4-flash-0731", messages=[{"role": "user", "content": "What is 17 × 23?"}], stream=True, ) for chunk in stream: if not chunk.choices: continue delta = chunk.choices[0].delta thinking = getattr(delta, "reasoning_content", None) if thinking: print(thinking, end="", flush=True) if delta.content: print(delta.content, end="", flush=True) ``` - In non-streaming responses, thinking content is in `message.reasoning_details`; concatenate the `text` of each item in order. - In streaming responses, thinking content is in `delta.reasoning_content`, the same as DeepSeek's official API. - In multi-turn conversations, you don't need to send thinking content back in the message history. ## Use in Claude Code The DeepSeek V4 series supports the Anthropic-native API at `https://api.ofox.io/anthropic`, so it works in Claude Code and other tools built on the Anthropic protocol: **Claude Code settings** - ANTHROPIC_BASE_URL: `https://api.ofox.io/anthropic` - ANTHROPIC_AUTH_TOKEN: Paste your OfoxAI API key - ANTHROPIC_MODEL: `deepseek/deepseek-v4-pro-0813` ```bash filename="Terminal" curl https://api.ofox.io/anthropic/v1/messages \ -H "x-api-key: $OFOX_API_KEY" \ -H "anthropic-version: 2023-06-01" \ -H "Content-Type: application/json" \ -d '{ "model": "deepseek/deepseek-v4-flash-0731", "max_tokens": 4000, "thinking": {"type": "disabled"}, "messages": [{"role": "user", "content": "Explain idempotency in one sentence."}] }' ``` - On the Anthropic API, thinking content is returned as `thinking` blocks, and `"thinking": {"type": "disabled"}` also turns thinking off. - Set a large enough `max_tokens` when thinking is on. If the budget runs out, the response may contain only a `thinking` block and no answer. For full Claude Code setup steps, see [Claude Code setup](https://ofox.io/docs/integrations/claude-code). ## JSON output and tool calling `response_format` supports `{"type": "json_object"}` and `{"type": "json_schema", ...}`; tool calling uses the standard `tools` parameter: ```python filename="deepseek_json.py" import json import os from openai import OpenAI client = OpenAI(base_url="https://api.ofox.io/v1", api_key=os.environ["OFOX_API_KEY"]) resp = client.chat.completions.create( model="deepseek/deepseek-v4-pro-0813", response_format={"type": "json_object"}, messages=[{"role": "user", "content": "Return price and currency as JSON: A bat and a ball cost $1.10 in total. The bat costs $1 more than the ball. How much does the ball cost?"}], extra_body={"thinking": {"type": "disabled"}}, ) print(json.loads(resp.choices[0].message.content)) ``` When using `json_object`, state "return JSON" and the required fields in the prompt. ## Prompt caching DeepSeek automatically caches repeated request prefixes, with no changes to your request. The cached amount is in `usage.prompt_tokens_details.cached_tokens`, and the cached portion is billed at the cache read rate. Caching is best-effort; requests with the same prefix may still miss. ## Providers | Model | Providers | |---|---| | V4.1 Flash | DeepSeek official (`deepseek`), Volcano Engine (`volcengine`) | | V4 Pro (0813), V4 Flash (0731) | Volcano Engine (`volcengine`) | | V4 Pro (0423), V4 Flash (0423) | Azure AI Foundry (`azure_foundry`) | For how to select a provider, see [Provider routing](https://ofox.io/docs/develop/advanced/provider-routing). ## Common errors **Key point**:Slow requests or empty answers are usually caused by thinking, which is on by default. Turn it off if you don't need it. | HTTP · type | Error message | Cause | Fix | |---|---|---|---| | 404 `model_not_found` | `Model 'deepseek/deepseek-v4-pro' not found` | An alias was used with the `deepseek/` prefix, or the model ID is misspelled | Use aliases without the prefix, or use the full model ID | | 404 `model_not_found` | `Model 'deepseek-chat' not found` | A model name from DeepSeek's official API was used | Use `deepseek-v4-flash` or similar instead | | 200, empty answer or thinking content only | — | Thinking used up the output budget | Increase `max_tokens`, or turn thinking off | | Request timeout | — | Thinking is on by default, and complex questions take longer | Turn thinking off, use streaming, or set the client timeout to 300 seconds or more | For other general errors, see [Error Handling](https://ofox.io/docs/develop/guides/error-handling). ## Official docs - [DeepSeek API docs](https://api-docs.deepseek.com/zh-cn/) - [DeepSeek · Thinking mode](https://api-docs.deepseek.com/zh-cn/guides/reasoning_model) - [DeepSeek · Anthropic API compatibility](https://api-docs.deepseek.com/zh-cn/guides/anthropic_api) The official docs describe behavior when calling DeepSeek directly. When calling through OfoxAI, model IDs and endpoints on this page take precedence. ## FAQ **How do I write a DeepSeek model ID?** The full format is like deepseek/deepseek-v4-pro-0813. You can also use the aliases deepseek-v4-pro and deepseek-v4-flash (which always point to the latest version); aliases take no deepseek/ prefix. **Can I still use deepseek-chat and deepseek-reasoner?** They are not available on OfoxAI and return 404. Use deepseek-v4-flash or deepseek-v4-pro instead, and control thinking with the thinking parameter. **How do I turn off DeepSeek thinking?** Pass "thinking": {"type": "disabled"}; with the OpenAI SDK, put it in extra_body. V4.1 Flash, V4 Pro (0813) and V4 Flash (0731) think by default. **Why is DeepSeek V4 Pro so slow?** V4 Pro thinks by default, and on complex questions it may think for over 10,000 tokens and take more than 2 minutes. Turn thinking off when you do not need deep reasoning, or switch to V4 Flash. **Where is DeepSeek reasoning_content?** In streaming responses it is in delta.reasoning_content; in non-streaming responses it is in message.reasoning_details, where you concatenate the text of each item. **Can I use DeepSeek in Claude Code?** Yes. Set ANTHROPIC_BASE_URL to https://api.ofox.io/anthropic and use a V4 series model ID such as deepseek/deepseek-v4-pro-0813. **Does DeepSeek support image input?** V4.1 Flash supports image input; the other DeepSeek models are text-only.