Guide · Codex
Use ScaledThought with Codex
Codex can use ScaledThought's open-weight models as its own model provider: add a scaledthought provider with wire_api = "responses" to ~/.codex/config.toml, load ST_API_KEY into the shell and start codex.
Deep links into apps you have installed. Claude and Claude Code are trademarks of Anthropic; Codex is a trademark of OpenAI. ScaledThought is not affiliated with or endorsed by either.
Or run it yourself:
Before you start
POST $ST_BASE_URL/responses speaks the OpenAI Responses API, so clients that use only that protocol, such as Codex, can use ScaledThought as their model provider. It takes input (a string, or messages, function_call and function_call_output items), instructions, function and custom (freeform) tools, tool_choice, max_output_tokens, text.format for JSON output and stream: true (Responses events, ending with response.completed or response.incomplete with its usage, or response.failed with an error).
It is stateless. We store no responses, so send the whole conversation in input every turn (Codex does) and leave out previous_response_id, which returns 400 invalid_request; store is always false. Hosted tools such as file search return 400; a web search tool is ignored. Requests without max_output_tokens get a cap of what the model's context leaves after your prompt, at most 32,768 tokens.
01
Create the account
Paste the prompt above into your coding agent, or run the command yourself in your project's directory. It creates the account, writes ST_API_KEY and ST_BASE_URL to ./.env (mode 0600) and adds .env to .gitignore. Only the US region is open; Canada is coming soon.
npx -y scaledthought@0.3 init --region us --source org-codex02
Buy credits
Usage is prepaid, so a new account answers 402 insufficient_credits until its first top-up. This prints a payment link and opens it in your browser; nothing is charged until you pay on it. How prepaid credits work
npx -y scaledthought@0.3 billing topup --amount-usd 20
npx -y scaledthought@0.3 billing wait03
Add the provider
Add this to ~/.codex/config.toml. npx -y scaledthought@0.3 models --live lists every model live in your region; the examples use deepseek-v4-1-flash.
# ~/.codex/config.toml
model = "deepseek-v4-1-flash" # or a model id from `npx -y scaledthought@0.3 models --live`
model_provider = "scaledthought"
[model_providers.scaledthought]
name = "ScaledThought"
base_url = "https://api.us.scaledthought.com/v1" # your ST_BASE_URL
env_key = "ST_API_KEY"
wire_api = "responses"
model_catalog_url = "https://api.us.scaledthought.com/v1/codex/models" # same host (and region) as base_url04
Start Codex with the key
Codex reads the key from the environment, not from .env, so load it first.
set -a; . ./.env; set +a # puts ST_API_KEY in the environment
codexNotes
- Codex reads
ST_API_KEYfrom the environment, so load./.envinto the shell first.wire_api = "responses"is required: ScaledThought serves Codex over the Responses API. model_catalog_urltells Codex the context windows of the models live in your region, so it compacts long sessions in time, and gives it itsapply_patchediting tool. It is built from the live models on every request; Codex sends your key with it, so keep it on the same host asbase_url(your region's).
Sources
- Codex configuration docs, read 2026-10-12.
- ScaledThought: /llms.txt (the setup protocol) and the docs.
Questions
- Why does Codex need wire_api = "responses"?
- Codex speaks the OpenAI Responses API, and ScaledThought serves it at
POST /v1/responses. It is stateless: Codex sends the whole conversation every turn, andprevious_response_idreturns400.
Read next