Guides14 min readPublished 2026-07-26

Can OpenAI Codex CLI Use LumeAPI as a Custom Model Provider?

Configure a candidate LumeAPI provider in Codex CLI, understand Chat Completions deprecation, and calculate coding-task API cost.

By LumeAPI Engineering Team

Cheap LLM API hub → Compare GPT API Costs →

Short path: Cheap LLM API · Cheap OpenAI API · GPT API · Models · AI API pricing · Models

Last verified: July 26, 2026

Codex CLI can point at custom model providers through config.toml, and OpenAI currently says Codex can use providers supporting Chat Completions or Responses. However, OpenAI also marks Chat Completions support in Codex as deprecated and scheduled for removal. LumeAPI’s catalog currently identifies its GPT routes as chat/completions. Therefore a LumeAPI custom provider is a version-sensitive candidate integration, not a future-proof setup, until a billable Codex smoke test verifies the exact wire API and LumeAPI documents durable Responses compatibility.

LumeAPI is an independent third-party gateway and is not OpenAI. Codex behavior must be verified against the installed Codex version.

Quick answer

QuestionAnswer
Can Codex define a custom base URL?Yes, through model_providers in config.toml
Which LumeAPI routes fit coding work?gpt-5.6-terra, gpt-5.6-sol, and gpt-5.4-mini are current candidates
Is Chat Completions safe long term in Codex?No; OpenAI documents it as deprecated
Should wire_api = "responses" be added automatically?Only after the LumeAPI Responses contract is verified with a real key
Was the configuration below run end to end?No; it is an auditable staging candidate

In short

version-sensitive candidate integration Treat published catalog rates as a planning input and confirm them on /ai-api-pricing before changing production traffic.

Codex CLI, the app, and cloud are different surfaces

Codex CLI runs locally in a terminal and shares config.toml with the Codex desktop app and IDE extension. Codex cloud has different managed execution and model-selection behavior. This article covers the local CLI custom-provider path, not ChatGPT subscription routing or cloud tasks.

OpenAI’s current manual says a custom provider defines base URL, wire API, and authentication. It also states that custom providers can target Chat Completions or Responses, while warning that Chat Completions support will be removed in a future Codex release.

Candidate LumeAPI provider configuration

Store the key in an environment variable and use a non-reserved provider id:

toml
# ~/.codex/config.toml
model = "gpt-5.6-terra"
model_provider = "lumeapi"

[model_providers.lumeapi]
name = "LumeAPI"
base_url = "https://api.lumeapi.site/v1"
env_key = "LUMEAPI_API_KEY"
bash
export LUMEAPI_API_KEY=sk-your-lumeapi-key
codex --model gpt-5.6-terra

Do not add wire_api = "responses" merely because Codex prefers Responses. First verify that the LumeAPI route accepts the Responses request shape required by your installed Codex build. Conversely, relying on the legacy Chat Completions path creates a known upgrade risk.

Which model should a Codex task use?

TaskCandidate routeLumeAPI rateRouting rule
Mechanical edits and simple testsgpt-5.4-mini$0.225 / $1.35Start cheap and cap turns
Routine feature workgpt-5.6-terra$0.75 / $4.50Default candidate
Difficult debugging or multi-file agent workgpt-5.6-sol$1.50 / $9.00Escalate when failure/rework cost is higher

Rates are per 1M input/output tokens and were checked July 26, 2026.

Cost per standardized coding task

To make this series comparable, use the same 20k-input/4k-output token unit as the Aider article:

ModelOne unitFive unitsTen units
GPT-5.4 mini$0.0099$0.0495$0.0990
GPT-5.6 Terra$0.0330$0.1650$0.3300
GPT-5.6 Sol$0.0660$0.3300$0.6600

A “unit” is arithmetic, not a Codex turn. Actual Codex usage depends on repository reads, tool results, compaction, retries, test output, and the model provider’s supported wire features.

The staging test that decides whether to publish this setup

  1. Record codex --version.
  2. Start with a tiny repository and a task that changes one file and runs one test.
  3. Confirm authentication uses LUMEAPI_API_KEY, not cached ChatGPT credentials.
  4. Capture whether Codex chooses Chat Completions or Responses.
  5. Confirm tool calls and streaming complete without schema conversion errors.
  6. Inspect the LumeAPI usage record and calculate the actual task cost.
  7. Upgrade Codex once in a disposable environment and repeat, because the legacy transport is deprecated.

What most guides get wrong

A base URL alone does not establish compatibility. Codex is an agent harness, so a provider must preserve tool schemas, streaming, reasoning fields, errors, and usage. A simple 401 response proves authentication exists; it does not prove the endpoint supports Codex’s full request shape.

Another common error is confusing ChatGPT sign-in with API-key billing. For a custom provider, use the environment key configured for that provider and verify which credential actually served the run.

Production scenario

A CI job can run non-interactive Codex only after the provider passes the staging test and secret handling is reviewed. Limit turns, use a disposable checkout, retain diffs and test output, and attach the LumeAPI request id to the CI record. If a Codex upgrade removes the legacy transport, fail closed rather than silently routing to a different provider.

See the GPT API Python guide, lower-cost GPT migration guide, and usage logs.

A realistic production scenario

A six-person platform team standardized on one premium model for Can OpenAI Codex CLI Use LumeAPI as a Custom Model Provider? after a strong demo score. Early invoices looked fine; by week three, failing test loops had doubled input tokens without more accepted output.

They kept the orchestrator but tightened routing: a lower-cost catalog model handled exploration, a mid-tier model handled implementation, and premium routes required a logged failure condition. They truncated test logs and stopped attaching full diffs on every retry.

The breakthrough was reconciling LumeAPI usage records with task ids. Token list price mattered less than eliminating duplicate context across retries.

Expert take

LumeAPI is an independent third-party OpenAI-compatible gateway—not OpenAI, Anthropic, or Google. Published catalog rates can be materially below official reference pricing, but compatibility does not guarantee identical behavior for every native feature, streaming edge case, tool schema, Batch workflow, or prompt-cache semantics.

Follow this advice when you control prompts, retries, and routing and need auditable USD billing across GPT, Claude, and Gemini on one key. Do not cut over blindly if you depend on provider-native capabilities your stack has not tested end to end.

Run a bounded smoke test on your exact SDK, model id, streaming mode, and tool path; reconcile usage logs with orchestrator task ids; and keep a fallback route until error rates and latency are acceptable.

FAQ

Does this guide apply to every LumeAPI model?

Verify the exact model id and rate on /models before production use for Can OpenAI Codex CLI Use LumeAPI as a Custom Model Provider?.

Does Codex CLI still have a public repository?

Yes. The openai/codex repository was public and active when checked July 26, 2026.

Does Codex require the Responses API?

Its current documentation allows Chat Completions or Responses, but marks Chat Completions as deprecated. Treat Responses compatibility as the durable requirement.

Is a successful chat completion enough?

No. Test file editing, tools, streaming, errors, and usage reporting.

Sources and testing boundary

No billable Codex-to-LumeAPI coding run was performed for this report. Treat the configuration as a version-sensitive staging candidate and run the documented Responses, tool-call, streaming, and usage-log tests before production use.

Ready to call these models?

Create a LumeAPI key in under a minute — one OpenAI-compatible gateway for GPT, Claude, Gemini, and more.