Use DeepSeek in Codex

Prices and modelsEndpoint verified 2026-11-09

Generate a Codex config from the Responses-compatible endpoint in DeepSeek's docs. The API key in the config is a placeholder; replace it with a key you create at DeepSeek.

Endpoints

  • Pay as you gohttps://api.deepseek.comDocs · verified 2026-11-09

Generate the config

Pick from the 4 models this provider sells, or type another model name.

Save to ~/.codex/config.toml; merge it in if the file already exists
model = "deepseek-flash"
model_provider = "deepseek"

[model_providers.deepseek]
name = "DeepSeek"
base_url = "https://api.deepseek.com"
env_key = "DEEPSEEK_API_KEY"
wire_api = "responses"

Models and prices

ModelInputOutputRatio
DeepSeek V4.1 Flashdeepseek-flash$0.15$0.601.00×
DeepSeek V4.1 Flashdeepseek-v4-flash$0.15$0.601.00×
DeepSeek V4.1 Flashdeepseek-v4-flash-vision-exp$0.15$0.601.00×
DeepSeek V4 Prodeepseek-v4-pro$0.66$1.981.00×
$ per 1M tokens. Each model uses the provider's cheapest group; the ratio uses the output price

How to check it works

Restart Codex and send a message. If it replies and the request shows up in DeepSeek's console, it is using this endpoint.

FAQ

Why is the key in an environment variable?

config.toml only holds the variable's name, so the key never goes into the config file and does not leak when you share or sync it. To keep it, add the export line to ~/.zshrc or ~/.bashrc.

How do I switch back to OpenAI?

Remove the model_provider line from config.toml, then restart Codex.

Does my key pass through this site?

No. The page only generates config text and never asks for your key; the key only goes into the terminal or environment variables on your own machine.

Codex configs for other providers