DeepSeek family
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
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 .
deepseek/deepseek-v4.1-flashSupports image inputdeepseek/deepseek-v4-pro-0813deepseek/deepseek-v4-flash-0731Aliases and versions
- Use aliases without the
deepseek/prefix, e.g."model": "deepseek-v4-pro";deepseek/deepseek-v4-proreturns 404. deepseek-chatanddeepseek-reasonerfrom 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-0423anddeepseek/deepseek-v4-flash-0423can still be called, but enable thinking differently from the newer versions — see Thinking mode.
Examples
Python
import os
from openai import OpenAI
client = OpenAI(base_url="https://api.ofox.ai/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)Thinking mode
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
import os
from openai import OpenAI
client = OpenAI(base_url="https://api.ofox.ai/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)- In non-streaming responses, thinking content is in
message.reasoning_details; concatenate thetextof 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.ai/anthropic, so it works in Claude Code and other tools built on the Anthropic protocol:
https://api.ofox.ai/anthropicdeepseek/deepseek-v4-pro-0813curl https://api.ofox.ai/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
thinkingblocks, and"thinking": {"type": "disabled"}also turns thinking off. - Set a large enough
max_tokenswhen thinking is on. If the budget runs out, the response may contain only athinkingblock and no answer.
For full Claude Code setup steps, see Claude Code setup.
JSON output and tool calling
response_format supports {"type": "json_object"} and {"type": "json_schema", ...}; tool calling uses the standard tools parameter:
import json
import os
from openai import OpenAI
client = OpenAI(base_url="https://api.ofox.ai/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
For how to select a provider, see Provider routing.
Common errors
For other general errors, see Error Handling.
Official docs
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.ai/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.