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
- Cheapest Claude API? Compare actual token prices
- Cheapest GPT API? GPT token pricing compared
- Calling GPT-6.1, Claude and Gemini APIs from mainland China
- Video generation APIs compared: Kling, Seedance and Veo
- Use Claude Code with a mainland-reachable API base URL
- Point Codex CLI at a third-party API
- Cheaper Cursor setup with your own API key
- Kling, Veo and Seedance API prices on ModelFold
- Nano Banana and GPT Image API prices
- Call the Gemini API from mainland China
- DeepSeek vs Claude: coding API price on ModelFold
- AI API pay as you go versus a subscription
- Call every listed model with one API key
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.
| Model | ModelFold USD | Official USD | Unit / configuration |
|---|---|---|---|
| GPT-6 Astra | 3.36 in / 16.80 out | $10 / $50 | per 1M tokens |
| GPT 6.1 Sol | 0.72 in / 3.60 out | $2 / $10 | per 1M tokens |
| GPT-6 Luna | 0.036 in / 0.18 out | $0.1 / $0.5 | per 1M tokens |
| GPT-6 Sol | 0.72 in / 3.60 out | Not independently verified | per 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.
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.
