Guide
DeepSeek API Key: Setup and Model IDs in 2026
Getting a DeepSeek API key takes a couple of minutes. The part that trips people up is which model IDs the direct API still accepts — DeepSeek retired the old names in 2026, so a large share of tutorials and code samples online now produce an HTTP 400. This guide covers both.
How to Get a DeepSeek API Key
- Go to the DeepSeek open platform at platform.deepseek.com and sign in or create an account.
- Open the API keys section of the dashboard.
- Create a new key and copy it immediately — like most providers, DeepSeek shows the full value once.
- Add credit to the account. A key with no balance authenticates but fails on the first real completion, which is a confusing way to start debugging.
The Model IDs Changed — This Is the Common Failure
DeepSeek's direct API used to serve deepseek-chat and deepseek-reasoner. Those names were retired during the V4 migration and stopped working entirely after 24 July 2026. The direct API now serves two IDs:
deepseek-v4-flash— the fast, cheap tier with a 1M-token context window. The olddeepseek-chatmaps here as the non-thinking mode.deepseek-v4-pro— the stronger reasoning tier. The olddeepseek-reasonermaps here.
If you send a retired name you get a 400 back from DeepSeek itself, with a message naming the two supported IDs. That error comes from DeepSeek, not from whatever library sits in front of it, which is worth knowing before you go hunting through your own code.
The Other Common 400: A Prefixed Model Name
OpenRouter-style identifiers look like deepseek/deepseek-v4-pro. DeepSeek's own API wants the bare ID, deepseek-v4-pro, with no vendor prefix. Sending the prefixed form to api.deepseek.com fails with the same 400. This bites people who switch from routing through an aggregator to calling DeepSeek directly and carry the old model string across.
The rule is simple: aggregator endpoints want vendor/model, the direct API wants model.
Calling the API Directly
DeepSeek exposes an OpenAI-compatible endpoint, so any OpenAI SDK works once you change the base URL:
curl https://api.deepseek.com/v1/chat/completions \
-H "Authorization: Bearer $DEEPSEEK_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "deepseek-v4-flash",
"messages": [{"role": "user", "content": "Hello"}]
}'Base URL: https://api.deepseek.com. Auth: a bearer token. If that call returns a completion, your key is good and the problem in any larger setup is configuration rather than credentials.
Using Your DeepSeek Key With an AI Assistant
If you want a DeepSeek-powered assistant running in your chat apps rather than writing the client yourself, you can add the key to an OpenClaw Launch instance and skip the integration work entirely.
- Deploy an instance from the homepage — it takes about 30 seconds.
- Open the API keys page and save your DeepSeek key. It is encrypted at rest and validated against DeepSeek when you save it, so a bad key is rejected immediately rather than failing later in a conversation.
- Pick a DeepSeek model on your dashboard. Calls then route through your own DeepSeek account instead of consuming bundled AI credits.
This works for both OpenClaw and Hermes Agent instances. Legacy model IDs left over from older configurations are normalised to the current V4 names automatically, so an instance configured before the migration keeps working.
Why Use DeepSeek at All?
- Cost — DeepSeek is priced well below frontier Western models, which matters for an assistant that runs all day.
- Context — the V4 line offers a 1M-token window, useful for long documents and long-running agent sessions.
- Two tiers, one key — flash for routine turns, pro when the task needs deeper reasoning.
- OpenAI-compatible — most existing code works with a base URL change.
Troubleshooting
400: “The supported API model names are deepseek-v4-pro or deepseek-v4-flash”
You sent a retired ID or a prefixed one. Use the bare deepseek-v4-flash or deepseek-v4-pro. This message comes from DeepSeek's API directly.
401 Unauthorized
The key is wrong, revoked, or was pasted with whitespace. Regenerate it and check for a trailing newline, which is easy to introduce when copying into an environment file.
Insufficient balance
The key is valid but the account has no credit. Top up on the DeepSeek platform. A zero-balance key authenticates fine, which is why this often looks like a code problem at first.
It works with one provider but not another
Check which endpoint you are hitting. A model string that works against an aggregator will not work against api.deepseek.com if it carries a vendor prefix, and the reverse is also true.