For the complete documentation index, see llms.txt. Markdown versions of all docs pages are available by appending .md to any docs URL.
Gemini
Verified : Code examples on this page have been automatically tested and verified.Route agentgateway LLM traffic to Google Gemini models.
Configure Google Gemini as an LLM provider in agentgateway.
Configuration
You can add the model in the UI or in your configuration file.
To add the model in the UI, follow these steps. The steps create the same model as the Config file tab.
Set your API key in the
GEMINI_API_KEYenvironment variable. The UI checks that the variable exists when you save the model.export GEMINI_API_KEY='<your-api-key>'Create a configuration file with an empty
llmsection, and start agentgateway in the same terminal. Without anllmsection, the UI does not show the LLM > Models page.cat > config.yaml <<'EOF' # yaml-language-server: $schema=https://agentgateway.dev/schema/config llm: models: [] EOF agentgateway -f config.yamlOpen LLM > Models, such as http://localhost:15000/ui/llm/models, and click Add model.
From the Provider dropdown, select Gemini.
Keep the default
gemini/*in the Incoming model match field.For the Provider API key, select Env var, and enter
GEMINI_API_KEY.For Outgoing model, keep Strip gemini/. This option removes the
gemini/prefix before the request is forwarded. To send every request to one model instead, select Explicit, and enter the model name. This option setsparams.model.

Click Save model.
Whether the UI can save depends on your storage mode. For more information, see Save changes from the UI.