DeepSeek API model DeepSeek V4 Pro through the provider-managed global endpoint.
Provider: All DeepSeek models | DeepSeek API
https://api.deepseek.com/chat/completionsInstall: pip install openai
from openai import OpenAI
client = OpenAI(
api_key="your-deepseek-api-key",
base_url="https://api.deepseek.com",
)
response = client.chat.completions.create(
model="deepseek-v4-pro",
messages=[
{"role": "user", "content": "Hello, how are you?"},
],
max_tokens=1024,
reasoning_effort="high",
extra_body={"thinking": {"type": "enabled"}},
)
print(response.choices[0].message.content)Additional examples: Basic invoke, Streaming
| Parameter | Type | Description |
|---|---|---|
| max_tokens | integer | Maximum tokens to generate. (1–384000) |
| stream | boolean | Stream response chunks as they are generated. Default: false. |
| thinking.type | enum | Enable or disable thinking mode. Default: enabled. |
| reasoning_effort | enum | Thinking effort when thinking mode is enabled. Default: high. |
DeepSeek models support provider-managed thinking mode with high and max effort controls.
Use OpenAI-compatible client libraries by changing the API base URL.