base_url not honored for ollama
Resolved 💬 2 comments Opened Jul 30, 2025 by raokrutarth Closed Aug 18, 2025
💡 Likely answer: A maintainer (pbezglasny, contributor)
responded on this thread — see the highlighted reply below.
What version of Codex is running?
codex-cli 0.0.2505291458
Which model were you using?
ollama
What platform is your computer?
Linux 5.4.0-216-generic x86_64 x86_64
What steps can reproduce the bug?
The ollama base url is hardcoded to port 11434 (https://github.com/openai/codex/blob/6b10e22eb3f999fe2b5c6b8054feefbca791e2bd/codex-rs/core/src/model_provider_info.rs#L263) and doesn't work with any other ports. I need to run ollama on another port (11438) and the codex cli keeps making requests to port 11434
config.toml:
[model_providers.ollama]
name = "Ollama"
base_url = "http://localhost:11438/v1"
wire_api = "chat"
[profiles.ol]
model_provider = "ollama"
model = "mistral-small3.2:latest"
````
### What is the expected behavior?
Honor the base_url config when invoking ollama
### What do you see instead?
_No response_
### Additional information
Also tried `OPENAI_BASE_URL="http://localhost:11438/v1" codex exec --profile ol --model mistral-small3.2:latest "follow instructions in ./Task.md"`
2 Comments
It looks like you use an old version of codex based on type script , but provide a config of rust version.
On my local setup the attached toml config is working. Try to update version of codex or use config.json file with type script version
The latest version enables to customize the URL by an env variable, but there is still a bug where config.toml's base_url does not work. My pull request https://github.com/openai/codex/pull/2418 will resolve it. So, for now, use an env variable with 0.22.0 and you can set the URL in config.toml with future versions.