{"slug": "deepseek-as-the-default-model-on-chatgpt-codex", "title": "DeepSeek as the default model on ChatGPT Codex", "summary": "A developer outlined a method for configuring DeepSeek as the default model in OpenAI's Codex coding agent by editing the local config.toml and models.json files and setting a DEEPSEEK_API_KEY environment variable. The setup points Codex at DeepSeek's API endpoint, enabling usage-based billing instead of a flat monthly subscription. The author frames the switch as a cost-control measure, since pay-per-token billing charges only for what is used.", "body_md": "In this article, I will explain how you can set DeepSeek as the default model for your Codex coding agent. By doing this, you no longer need to pay a flat monthly subscription. You only need to top up your DeepSeek API balance and pay for exactly what you use.\n\nBefore editing any files, you need access to the [DeepSeek API](https://platform.deepseek.com). Generate an API key from your DeepSeek developer dashboard. Once you have it, set it as an environment variable named `DEEPSEEK_API_KEY` on your machine. This ensures Codex can authenticate without hardcoding your credentials into the configuration file.\n\n```\n# ~/.zshrc or ~/.bashrc\nexport DEEPSEEK_API_KEY=your-deepseek-api-key\n```\n\nCodex reads its settings from a local configuration file. Open `~/.codex/config.toml` in your preferred editor. You need to point the model catalog to a custom JSON file and define the DeepSeek provider settings.\n\nUpdate your `config.toml` to include these lines:\n\n```\n# ~/.codex/config.toml\n\nmodel = \"deepseek-flash\"\nmodel_provider = \"deepseek\"\nmodel_catalog_json = \"~/.codex/models.json\"\n\n[model_providers.deepseek]\nname = \"DeepSeek\"\nbase_url = \"https://api.deepseek.com\"\nenv_key = \"DEEPSEEK_API_KEY\"\nwire_api = \"responses\"\n```\n\nThis configuration tells Codex to use the DeepSeek API endpoint and look for the `DEEPSEEK_API_KEY` environment variable.\n\nNext, create or edit the `~/.codex/models.json` file. This file tells Codex how to interact with the specific model you selected, including its context window and supported tool settings.\n\nAdd the following JSON structure:\n\n```\n{\n  \"models\": [\n    {\n      \"slug\": \"deepseek-flash\",\n      \"display_name\": \"DeepSeek-Flash\",\n      \"description\": \"Latest frontier agentic coding model with image input.\",\n      \"input_modalities\": [\"text\", \"image\"],\n      \"context_window\": 1048576,\n      \"max_context_window\": 1048576,\n      \"default_reasoning_level\": \"high\",\n      \"supported_reasoning_levels\": [\n        {\n          \"effort\": \"low\",\n          \"description\": \"Fast responses with lighter reasoning\"\n        },\n        {\n          \"effort\": \"high\",\n          \"description\": \"Extra high reasoning depth for complex problems\"\n        },\n        {\n          \"effort\": \"max\",\n          \"description\": \"Maximum reasoning depth for the hardest problems\"\n        }\n      ],\n      \"truncation_policy\": {\n        \"mode\": \"tokens\",\n        \"limit\": 10000\n      },\n      \"supports_parallel_tool_calls\": true,\n      \"supports_search_tool\": true,\n      \"supported_in_api\": true,\n      \"support_verbosity\": true,\n      \"experimental_supported_tools\": [],\n      \"priority\": 1,\n      \"visibility\": \"list\",\n      \"shell_type\": \"shell_command\",\n      \"model_messages\": {\n        \"instructions_template\": \"You are Codex, an agent based on DeepSeek-Flash. You are a coding agent working with the user in their workspace. Inspect the repository before editing files, use available tools carefully, make minimal changes, run relevant tests, and clearly report what changed.\"\n      },\n      \"base_instructions\": \"You are Codex, an agent based on DeepSeek-Flash. You are a coding agent working with the user in their workspace. Inspect the repository before editing files, use available tools carefully, make minimal changes, run relevant tests, and clearly report what changed.\"\n    }\n  ]\n}\n```\n\nThis setup fully maps the model, so Codex knows it supports parallel tool calls, large context windows, and specific reasoning levels.\n\nAfter saving both files, close and restart your Codex application. Look at the bottom right corner of the interface. You should now see DeepSeek-Flash listed as the active default model.\n\nYou are now ready to generate code and manage your workspace using DeepSeek, relying entirely on usage-based API billing.\n\nDon't forget to `source ~/.zshrc` to load up your API Key into the shell environment.\n\nThe main reason to switch from a monthly subscription to an API key is cost control. When you pay per token, you only pay for what you use. DeepSeek models are significantly cheaper than OpenAI equivalents.\n\nHere is the current pricing for OpenAI models per one million tokens.\n\n| Model | Input Cost (per 1M) | Output Cost (per 1M) | \n|---|---|---|\n| GPT-6 Astra | $10.00 | $50.00 | \n| GPT-5 | $1.25 | $10.00 | \n| GPT-4o | $5.00 | $15.00 | \n\nHere is the off-peak pricing for DeepSeek V4 models per one million tokens.\n\n| Model | Input Cost (per 1M) | Output Cost (per 1M) | \n|---|---|---|\n| DeepSeek-V4-Flash | $0.22 | $0.66 | \n| DeepSeek-V4-Pro | $0.66 | $1.98 | \n\nTo understand what this means in practice, consider a standard week of coding. A moderate user might consume 500,000 input tokens from codebase context and generate 100,000 output tokens.\n\nIf you use GPT-5, the input costs $0.63, and the output costs $1.00. Your total for the week is $1.63.\n\nIf you use DeepSeek-V4-Flash (off-peak), the input costs $0.11, and the output costs $0.07. Your total for the week is $0.18.\n\nBy switching, your operating cost drops to a fraction of the price without losing coding capability. You can run large refactoring tasks without worrying about subscription limits or high API bills.", "url": "https://wpnews.pro/news/deepseek-as-the-default-model-on-chatgpt-codex", "canonical_source": "https://dev.to/ekkyarmandi/deepseek-as-default-model-on-chatgpt-codex-3cj3", "published_at": "2026-09-12 06:14:47+00:00", "updated_at": "2026-09-12 06:26:22.733574+00:00", "lang": "en", "topics": ["ai-tools", "ai-agents", "developer-tools", "large-language-models", "ai-products"], "entities": ["DeepSeek", "OpenAI", "Codex", "DeepSeek-Flash"], "alternates": {"html": "https://wpnews.pro/news/deepseek-as-the-default-model-on-chatgpt-codex", "markdown": "https://wpnews.pro/news/deepseek-as-the-default-model-on-chatgpt-codex.md", "text": "https://wpnews.pro/news/deepseek-as-the-default-model-on-chatgpt-codex.txt", "jsonld": "https://wpnews.pro/news/deepseek-as-the-default-model-on-chatgpt-codex.jsonld"}}