Skip to main content

How to Use Gemini 4 Neon in Claude Code and Codex

Claude Code and Codex on the left send requests to the LiteLLM AI gateway in the middle, which routes them to Gemini 4 Neon, Claude Opus 5.5 or GPT-6.2 Astra on the right.

A lot of people have asked us how to use Gemini 4 Neon in Claude Code and Codex, so I wrote this short guide. It takes a few minutes with LiteLLM, and you can switch back to Claude or GPT models whenever you want.

TL;DR

You run LiteLLM on your machine and add Gemini 4 Neon to it (step 1). Then you launch Claude Code or Codex through LiteLLM with the lite CLI (steps 2 to 4). The tool sends requests the way it always does, and LiteLLM translates them for Gemini. Once that works, add Claude and GPT models to the same LiteLLM and switch between all of them with /model (step 5).

1. Add Gemini 4 Neon to LiteLLM​

Gemini 4 Neon costs $3 per 1M input tokens and $15 per 1M output tokens on Google AI Studio (pricing). Add it with a config file or from the Admin UI.

New to LiteLLM?

You need Docker installed. LiteLLM reads its models from a config.yaml file. Make a new folder for it and create the file inside:

mkdir litellm && cd litellm
touch config.yaml

Start the proxy from this folder too, so Docker can find the file.

Paste this into config.yaml. It tells LiteLLM to serve Gemini 4 Neon under the name gemini-4-neon:

litellm/config.yaml
model_list:
- model_name: gemini-4-neon
litellm_params:
model: gemini/gemini-4-neon
api_key: os.environ/GEMINI_API_KEY

Then, from the same litellm folder, export your Gemini API key, generate a master key for the proxy, and start it. The -v flag hands your config.yaml to the container:

export GEMINI_API_KEY="<your-gemini-api-key>"
export LITELLM_MASTER_KEY="sk-$(openssl rand -hex 24)"

docker run -d \
-p 4000:4000 \
-e GEMINI_API_KEY \
-e LITELLM_MASTER_KEY \
-v $(pwd)/config.yaml:/app/config.yaml \
ghcr.io/berriai/litellm:v1.109.1 \
--config /app/config.yaml

Check that it's up with curl http://localhost:4000/health/liveliness. If it isn't, find the container with docker ps -a and run docker logs <container-id> to see why. Keep this terminal open: step 2 reads LITELLM_MASTER_KEY from it.

2. Install the lite CLI​

lite launches Claude Code and Codex with their traffic routed through your proxy. It sets the base URL and key each tool reads, so you don't have to edit ~/.claude/settings.json or ~/.codex/config.toml by hand.

uv tool install 'litellm[cli]==1.109.1'
lite config set base_url http://localhost:4000

Then give lite your key. If you used the config file, run this in the same terminal as step 1:

export LITELLM_PROXY_API_KEY="$LITELLM_MASTER_KEY"

If you used the Admin UI, use the virtual key you created:

export LITELLM_PROXY_API_KEY="sk-<your-virtual-key>"

If your gateway has CLI sign-in turned on, run lite login instead of exporting a key.

3. Use Gemini 4 Neon in Claude Code​

lite claude --model gemini-4-neon

lite claude checks your key against the proxy, exports ANTHROPIC_BASE_URL and ANTHROPIC_AUTH_TOKEN, and starts Claude Code. Claude Code's own flags still work after lite claude, for example lite claude --resume to pick up your last session.

Sketch: Claude Code and Codex send requests to the LiteLLM proxy, which sends Gemini-format requests to Gemini 4 Neon, in three steps

4. Use Gemini 4 Neon in Codex​

lite codex -m gemini-4-neon

lite codex points Codex at the proxy's /v1/responses endpoint with a custom provider, so you don't add one to ~/.codex/config.toml. LiteLLM forwards each Responses API request to Gemini. See Connect Codex CLI to LiteLLM for how it lists models.

5. Switch between Gemini, Claude and GPT​

Add every model you want to the same proxy, for example claude-opus-5-5 with anthropic/claude-opus-5-5 and gpt-6.2-astra with openai/gpt-6.2-astra. Then run /model inside either tool.

Claude Code: lite claude turns on gateway model discovery, so /model lists every model your key can use, labeled From gateway. This needs Claude Code v2.1.129 or later.

Codex: lite codex writes the gateway's chat models to ~/.codex/litellm-models.json on every launch, so /model lists them too.

Sketch: switching between Claude Opus 5.5 and Gemini 4 Neon with /model after launching through lite, in three steps

Spend for every model lands on the same key, so the Usage page shows what each switch cost.

FAQ​

Do I need a Gemini API key?​

Yes. Create one in Google AI Studio and give it to LiteLLM, either as GEMINI_API_KEY or in the Admin UI form. Claude Code and Codex never see it; they only get your LiteLLM key.

Can I use Claude, GPT and Gemini models together?​

Yes. Add each model to the same LiteLLM proxy with its provider's API key, then switch between them with /model in Claude Code or Codex. You don't need a Claude or ChatGPT subscription for this.

Is spend tracked when I switch models?​

Yes. Every request goes through the proxy, so the Logs and Usage pages show the model and the key for each one.

Can I limit which models a key can use?​

Yes. Select the models when you create the virtual key. A key limited to gemini-4-neon and claude-opus-5-5 only shows those two in /model.

References​