Updated September 10, 2026: DeepSeek V4.1 Flash is released. Use
deepseek-flash. The old Flash aliases now route to this version;deepseek-v4-prois scheduled to switch on September 14 at 04:00 UTC. Direct DeepSeek API usage has separate billing.
Prepare an isolated Python environment
Create a virtual environment with python3 -m venv .venv, activate it, then install the openai package. Record python -m pip show openai in your trial notes. Set DEEPSEEK_API_KEY in your environment without adding it to code or Git. The account must have access to the selected model; this is not the free, keyless exercise linked below.
Send one text request
Save this as deepseek_smoke.py and run python deepseek_smoke.py:
import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ["DEEPSEEK_API_KEY"],
base_url="https://api.deepseek.com",
timeout=30.0,
max_retries=0,
)
result = client.chat.completions.create(
model="deepseek-flash",
messages=[{"role": "user", "content": "Reply with one sentence about unit tests."}],
stream=False,
)
print(result.choices[0].message.content)
print(result.usage)
A successful run should print a reply and usage metadata. Treat the content as variable; check that both are present before testing a larger workflow. The code has a 30-second timeout and no automatic retries so the first failure is visible. The exact SDK version and live response belong in your own result record.
Responses compatibility is selective
The official guide supports Responses but lists file_search among ignored tools. previous_response_id and background are unsupported. A previous version of this page used a built-in file-search example and implied a complete drop-in migration; that example has been removed. For a repository search workflow, supply your own tested function tool and execute it in your chosen runtime.
When the request fails
- Missing environment key: set it in the current shell; do not paste it into the script.
- Authentication or access rejection: inspect the account and selected model in the provider console.
- Rate or quota rejection: retain the failure, inspect limits and retry only with an explicit budget.
- Timeout or transport error: check the endpoint and network before changing the prompt.
- Unsupported feature silently ignored: test the expected side effect, not just the HTTP success code.
Continue with the current model status or a keyless local exercise.