Tool setup

Gemini CLI

Route Google's Gemini CLI through the gateway with GEMINI_API_KEY.

Gemini CLI is Google's open-source terminal agent. It can send requests to a custom endpoint via two environment variables.

What you get

  • Gemini CLI running against the gateway. If the operator has mapped non-Gemini models onto Gemini model names, you can reach those too — all on your project's sponsor budget.

Prerequisites

  • Your project access key and base URL from your project control panel — YOUR_PROJECT_KEY and https://v1.opentokenmarket.dev.

  • Gemini CLI installed:

    npm install -g @google/gemini-cli
    

Configure

export GOOGLE_GEMINI_BASE_URL="https://v1.opentokenmarket.dev"
export GEMINI_API_KEY="YOUR_PROJECT_KEY"

Add them to your shell profile to persist. GOOGLE_GEMINI_BASE_URL is the bare origin — the CLI appends the Gemini API path itself.

Run

gemini

The CLI calls whatever Gemini model name it's configured for (e.g. gemini-2.5-pro). On this gateway that name resolves to whatever the operator mapped it to — check the model catalog to see the mapping for your instance.

Verify

curl "https://v1.opentokenmarket.dev/v1beta/models/gemini-2.5-pro:generateContent?key=YOUR_PROJECT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"contents":[{"parts":[{"text":"Say hi in 3 words."}]}]}'

A JSON response with a candidates array means you're connected.

Troubleshooting

  • 401 / API key not valid — GEMINI_API_KEY isn't your project access key. Re-copy it from your control panel.
  • Connection refused / timeout — GOOGLE_GEMINI_BASE_URL is wrong or unreachable. Confirm it matches the base URL on your control panel.
  • model not found — the Gemini model name the CLI uses isn't mapped on this gateway. See the model catalog.
  • budget has been exceeded — ask your sponsor to top up the project.

Which model names to use

Gemini CLI drives its own model names. The model catalog shows which of them this gateway answers and what each maps to upstream.