Ollama with Codex CLI: change the model, keep the acceptance bar

Use the documented Ollama–Codex CLI integration, distinguish the coding client from its model, check web access and compare cost per verified task.

Codex CLI can use Ollama as a model provider. That does not mean you have downloaded an OpenAI hosted Codex model, and it does not make the result equivalent to a particular ChatGPT subscription. The coding client, selected model and inference provider are separate pieces. Verify all three before comparing capability, privacy or price.

The current documented Ollama workflow begins with ollama launch codex. For a local-provider route, OpenAI's CLI reference also documents the open-source-provider options. Use a small repository and a clearly reviewable task first. Once you know whether inference is local or hosted, use the monthly calculator only for the relevant Ollama cloud consumption. Local execution and human review belong in a separate ledger.

Two documented entry points, not two model guarantees

The Ollama integration guide describes a launch profile and model catalog prepared for the session, plus a configuration-only variant. It recommends a substantial context window for coding. The current OpenAI CLI reference documents --oss, --local-provider ollama and model selection with -m. Check the installed version's help before using options copied from another release.

A minimal provider-selection example is codex --oss --local-provider ollama. Select a supported available model through the applicable workflow rather than pasting an arbitrary large model name. This command starts a coding session; it is not a read-only diagnostic. The launch workflow can prepare configuration, so inspect its prompts and preserve intentional existing settings before changing a working setup.

Separate the four identities

Original identity checklist for a Codex–Ollama session
IdentityExample questionWhy it matters
ClientWhich Codex CLI version is running?Flags, configuration and supported workflows vary
ProviderWhich server receives inference requests?Determines the connection and authentication boundary
ModelWhich exact identifier is selected?Determines capability and local resource requirements
ToolsWhich filesystem and network actions are enabled?Determines effects beyond generating an answer

Do not infer the model from the application icon or the provider from the terminal title. A saved profile, project configuration or previous selection can affect the effective session. Record the actual route shown by the tool and verify it with a non-sensitive task. If you intended local-only operation but cannot explain where search or other external calls go, resolve that uncertainty before introducing private source code.

Local inference is not the same as an offline agent

Ollama's Codex documentation states that its integration can execute web search through Ollama with both local and cloud models and that this capability requires sign-in. Thus “the weights are on my laptop” is not a complete privacy assessment. Inspect web-search settings, additional tools and the task's permitted network behavior separately. Follow the current integration documentation if you need to disable that capability.

Keep sandboxing and approval controls in place. A model running on your hardware can still propose a destructive shell command, edit the wrong file or read a secret if its surrounding tools allow it. Start in a disposable folder and give a bounded instruction such as “read these two files and explain the failing test.” Grant only the actions required for the next stage. Do not use a bypass flag as a shortcut around a confusing permission prompt.

Choose an acceptance task that reveals tool behavior

A useful first fixture contains one small function, a test with an obvious expected result and no external services. Ask for a diagnosis first, then allow a narrowly described fix. Require the agent to run the relevant test and report the observed result. Review the actual diff yourself. A message saying that tests passed is not evidence if no corresponding test output exists.

Next try a slightly harder fixture that requires reading a related file. Keep the same task for each model you compare, and preserve the initial repository state between attempts through your normal safe workflow. Count unexpected edits, repeated commands, misunderstood instructions and failed acceptance checks. These observations show whether the integration works as a coding assistant, rather than merely demonstrating that a model can answer conversationally.

Budget for accumulated context and retries

A coding turn can include instructions, file contents, previous tool output and prior conversation in addition to your visible prompt. Long test logs and broad repository searches can consume working context without improving the answer. Give the agent a relevant directory, a specific failure and concise acceptance criteria. Expanding context is sometimes useful, but it should not be the first response to an agent reading everything.

Consider a synthetic comparison: candidate A completes 6 of 10 tasks with 20 total attempts; candidate B completes 9 with 12 attempts. A lower per-request price for A does not establish a lower cost per accepted change. Total the actual usage of all attempts, including failed ones, and divide by accepted outcomes. Track review time separately because a superficially plausible but incorrect patch can be expensive to discover.

A practical cost ledger

For a hosted route, retain the selected model, fresh input, cached input where reported, output and any additional service usage. Apply the provider's current categories and rate basis. For a local route, estimate incremental machine use and record whether the task prevents other work on the computer. Do not call a local run a cloud API charge or treat a ChatGPT subscription as automatically covering a third-party provider.

If a month produces a verified $80 of Ollama hosted consumption, compare that value across relevant plans before adding unrelated software expenses. If the month instead consists entirely of local inference, the cloud calculator is not the right way to price your electricity or hardware. The local total-cost guide helps define that comparison. The accounting boundary matters more than the brand name on the coding client.

Troubleshoot without rebuilding the whole environment

If the CLI rejects an option, check its current help and version. If the provider is unreachable, verify the intended Ollama server. If a simple response works but the coding loop fails, investigate protocol support and model tool-use behavior. If the agent loses earlier facts, inspect context growth. If a supposedly local setup asks for cloud authentication, check model and search routing rather than assuming every sign-in request is an error.

A generated profile is configuration state, not a disposable file to remove blindly. The Ollama guide includes restoration guidance for its generated integration; read it and identify the exact affected state before undoing a setup. Do not delete unrelated Codex history, credentials or project configuration to troubleshoot one provider. Keep a redacted record of the error and the last known working combination.

Frequently asked questions

Does this cover the Codex desktop application?

No. The commands here are for Codex CLI. Desktop model-provider support and settings need their own current documentation; do not assume a CLI profile changes every other surface.

Will a model that chats well necessarily edit code reliably?

No. Coding requires file understanding, tool use, constraint following and verification. Test a representative bounded task before using a model for valuable work.

Is the cheapest token rate the cheapest coding workflow?

Not necessarily. Retries, output length and human review can change the result. Compare accepted tasks under the same criteria and keep synthetic planning numbers separate from your measured results.

Sources: the linked official Ollama integration and OpenAI CLI reference, plus Ollama authentication. This is documentation-based guidance, not a claim of a local Codex benchmark.