Loading template…

Point Codex CLI at a third-party API

In the user-level ~/.codex/config.toml, set base_url to https://modelfold.ai/openai/v1, env_key to MODELFOLD_API_KEY, and model to a slug from GET /openai/v1/models; Codex appends /responses itself.

Codex ignores model_provider in a project-level config file. The reserved provider ids openai, ollama and lmstudio cannot be overridden. The table shows ModelFold public prices for the linked catalog pages; a grouped page is one catalog row, so confirm the exact slug on the model list before a long task.

Official sources checked:

Price snapshot updated:

Related guides

Current public prices

Pay as you go with prepaid credits. 200 credits = US$1. Credit charges round up to two decimal places; this is not USD rounding. Failed generations are not charged; a temporary hold may be released after failure. Review the final quote before submitting. Token rates are per one million tokens, input / output; video prices are starting prices for the listed configuration.

ModelModelFold USDOfficial USDUnit / configuration
GPT-6 Astra3.36 in / 16.80 out$10 / $50per 1M tokens
GPT 6.1 Sol0.72 in / 3.60 out$2 / $10per 1M tokens
GPT-6 Luna0.036 in / 0.18 out$0.1 / $0.5per 1M tokens
GPT-6 Sol0.72 in / 3.60 outNot independently verifiedper 1M tokens

API examples

curl https://modelfold.ai/v1/models -H "Authorization: Bearer $MODELFOLD_API_KEY"
model = "gpt-6-astra"
model_provider = "ModelFold"
[model_providers.ModelFold]
name = "ModelFold"
base_url = "https://modelfold.ai/openai/v1"
env_key = "MODELFOLD_API_KEY"
wire_api = "responses"
curl https://modelfold.ai/openai/v1/models \
  -H "Authorization: Bearer $MODELFOLD_API_KEY"

Examples are illustrative and were not sent to a paid model. Install the OpenAI Python SDK separately. Video and image requests follow each model page for required parameters; video jobs are asynchronous.

/ai-agent/codex-cli

Frequently asked questions

Direct answer

In the user-level ~/.codex/config.toml, set base_url to https://modelfold.ai/openai/v1, env_key to MODELFOLD_API_KEY, and model to a slug from GET /openai/v1/models; Codex appends /responses itself.

Should base_url end in /responses?

No. Codex appends /responses. Use https://modelfold.ai/openai/v1, or the request path becomes /responses/responses.

Can the provider live in the project .codex folder?

No. Put model_provider in the user-level file. On macOS and Linux that is ~/.codex/config.toml. A project file is skipped.

Can I keep Codex’s built-in model name?

No. model must be a slug from GET /openai/v1/models. Testing recorded that gpt-5.6-luna replied with text and did not call Codex tools; do not use it as a coding model.

Is ModelFold always the cheapest?

No. Compare the same model, context, cache mode and input/output mix. Final quotes and actual usage determine the charge.

Are failed generations charged?

Failed generations are not charged. A temporary reservation is not a final charge; check account logs for settlement.

Where do I find the correct model ID?

Use GET /v1/models and the linked model documentation. A website page slug is not always the API model ID.

Comparison sources