Recently, I've faced a need to use an LLM model through a gateway. In my case, it was LiteLLM. LiteLLM is an AI gateway where you can manage your LLMs setup in one place, track the costs, and enjoy observability tools.
I've started investigating possible options. My go-to agent for daily coding is Codex, so I was trying to find a tool that supports custom model providers and which usability is the same or very similar to Codex.
After checking OpenCode, Goose, and some other options, I wasn't happy with the UI, speed, and overall functionality. So I thought, is it possible to configure Codex the way I need? LiteLLM provides an OpenAI-compatible interface, so in theory it should be possible.
Codex itself wasn't able to configure it, so here is how to do it in the old-fashioned way - manually.
Expose your LiteLLM API key as OS environment variable.






