DeepSeek setup
Create a DeepSeek key to use DeepSeek V4.1 Flash: 1M context, thinking mode, tool calling and image input. Both OpenAI Chat Completions and Codex Responses are supported.
The model id in requests must be exactly deepseek-v4.1-flash; any other id returns a 400.
Weekdays 09:00–12:00 and 14:00–18:00 (Taipei time) are busy hours and deduct twice the off-peak credits; all other hours and weekends are off-peak. A request that starts or ends inside busy hours counts as busy. See the pricing page for the actual rates.
Copy these model IDs into config files, API request bodies, or any OpenAI-compatible client that asks for a model name. Each group needs the matching key type.
Prepare your API key
After signing in, open the API key page to create or copy a key. It looks like sk-or-v1-xxxxxxxxxxxx. Treat it like a password.
Create API keyUse https://api.bruceai.net/v1; /v1/models, /v1/chat/completions and /v1/responses are supported.
Click Create API key, give it a name you will recognize, then pick the key type by the models you plan to call:
- OpenAI key
- Serves gpt-6-astra, gpt-5.6-sol, gpt-5.6-terra, gpt-5.6-luna and gpt-5.5. Works with Codex, GitHub Copilot and any OpenAI-compatible client.
- Grok key
- Serves grok-4.6 and grok-4.5. Works with Grok Build, Codex and any OpenAI-compatible client.
- DeepSeek key
- Serves deepseek-v4.1-flash: 1M context, thinking mode, tool calling and image input. Works with Codex and any OpenAI-compatible client.
A key only serves its own provider's models. Sending a GPT model id with a Grok key, or a Grok id with an OpenAI key, is refused with a 400. Create one key per provider if you use several.
Do not share your API key with anyone, and do not commit it to GitHub, GitLab, or any public repository.
The commands below switch to the system you choose.
Create a DeepSeek key
Sign in to BRUCEAI, open API keys, click Create API key and choose the DeepSeek type.
This key serves deepseek-v4.1-flash only; it cannot call GPT or Grok models. Create separate keys for other providers.
Check the model list
curl https://api.bruceai.net/v1/models \
-H "Authorization: Bearer sk-or-v1-your-key"The returned model id should be deepseek-v4.1-flash.
Send a Chat Completions request
curl -N https://api.bruceai.net/v1/chat/completions \
-H "Authorization: Bearer sk-or-v1-your-key" \
-H "Content-Type: application/json" \
-d '{"model":"deepseek-v4.1-flash","messages":[{"role":"user","content":"hi"}],"stream":true}'OpenAI SDK examples
from openai import OpenAI
client = OpenAI(
api_key="sk-or-v1-your-key",
base_url="https://api.bruceai.net/v1",
)
response = client.chat.completions.create(
model="deepseek-v4.1-flash",
messages=[{"role": "user", "content": "hi"}],
)
print(response.choices[0].message.content)import OpenAI from "openai";
const client = new OpenAI({
apiKey: "sk-or-v1-your-key",
baseURL: "https://api.bruceai.net/v1",
});
const response = await client.chat.completions.create({
model: "deepseek-v4.1-flash",
messages: [{ role: "user", content: "hi" }],
});
console.log(response.choices[0].message.content);Use it in Codex
Keep the DeepSeek config in its own CODEX_HOME so it neither touches your ~/.codex nor mixes with your OpenAI key setup. Create the folder and config.toml first:
If you would rather not edit files by hand, use the one-click import on the CC Switch page in the sidebar to add the DeepSeek key to CC Switch and switch there.
mkdir -p ~/.codex-bruceai-deepseek
nano ~/.codex-bruceai-deepseek/config.tomlmodel_provider = "DeepSeek"
model = "deepseek-v4.1-flash"
disable_response_storage = true
[model_providers.DeepSeek]
name = "DeepSeek"
base_url = "https://api.bruceai.net/v1"
wire_api = "responses"
requires_openai_auth = trueWrite auth.json and start
Create ~/.codex-bruceai-deepseek/auth.json, paste your DeepSeek key, then start Codex.
nano ~/.codex-bruceai-deepseek/auth.json
# paste: { "OPENAI_API_KEY": "sk-or-v1-your-key" }
CODEX_HOME="$HOME/.codex-bruceai-deepseek" codex --model deepseek-v4.1-flashStandard Responses requests are supported. If Codex's remote compaction fails with a 502, start a new conversation or disable remote_compaction_v2 and restart.
Troubleshooting
400 / unsupported_model: the model id must be deepseek-v4.1-flash, not DeepSeek-V4.1-Flash, deepseek-chat or another name.
401 / invalid token: make sure the key is complete, has no extra spaces, starts with sk-or-v1- and is a DeepSeek key.
404: make sure the Base URL includes /v1 and call /chat/completions, /responses or /models.