DeepSeek
DeepSeek API key
One key calls DeepSeek — and every other model on the gateway. It is a bearer token: create it once, keep it server-side, and put it in an Authorization header.
Create it
- Register at todapi.work/register.
- Open the console → API keys → Create key.
- Copy the value immediately — it is shown once.
- Store it as an environment variable, never in a repository.
export TODAPI_KEY="sk-..."
Use it
curl https://todapi.work/v1/chat/completions \
-H "Authorization: Bearer $TODAPI_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "deepseek-v4.1-flash", "messages": [{"role": "user", "content": "ping"}]}'
The same key works with any OpenAI SDK — set base_url to https://todapi.work/v1. See the model page for Python and Node samples.
The three 401s people actually hit
| Cause | Fix |
|---|---|
| Trailing newline copied with the key | echo -n "$TODAPI_KEY" | wc -c and compare with the key length |
| Missing or lowercase scheme | Authorization: Bearer … — capital B, one space |
| Key revoked or rotated | Create a new key; old ones stop working immediately |
Full error reference: 429, 402, and the table in the model pages.
How keys relate to balance
Keys are per account, balance is shared. Two keys on one account spend from the same prepaid USD pool, which is convenient for splitting staging and production — and dangerous if one of them runs a batch job overnight. Watch GET /v1/usage per key.
Is there a free DeepSeek key?
DeepSeek has run promotional free tiers; this gateway does not. What you get instead is the rate: $0.0252 / 1M input and $0.1008 / 1M output, which is 83% below DeepSeek's own list price. A few dollars of balance lasts a long time — see the pricing breakdown.
Rotating a key safely
- Create the new key first; keep both valid for a short overlap.
- Deploy the new value to your secret store.
- Confirm traffic succeeds on the new key.
- Revoke the old one. If it leaked, revoke first and accept the brief outage.
FAQ
How do I get a key?
Register, then create one in the console. No approval step, no sales call.
Why does my key work in curl but not in my app?
Usually the environment variable includes quotes or a newline. Print its length, not its value.
Can I restrict a key to one model?
Model access follows the key's group. List what it can reach with GET /v1/models.