Set up AI agents
Use common AI Gateway project model values, then choose the guide for your AI agent.
This guide explains the common values needed to connect AI agents to a project model. Use it as the index for the agent-specific guides below.
Before you start
Section titled “Before you start”- Install the client you want to use.
- Issue a Gateway Key from the Gateway Keys menu of the project you want to use. See Issue a Gateway Key for the steps.
- Check that the model you want appears in the Models menu of the same project.
A Gateway Key is a secret. Do not put the key value directly in source control, chat messages, or shared screenshots.
Common values
Section titled “Common values”- Model ID: the
provider-name/model-idshown in the setup dialog. - Gateway base URL: the URL shown in the setup dialog, usually ending in
/v1/. - API key environment variable:
AI_GATEWAY_API_KEY.
Configure a client
Section titled “Configure a client”-
Set the Gateway Key as an environment variable where the client runs:
Terminal window export AI_GATEWAY_API_KEY='<your Gateway Key>' -
Point the client’s OpenAI-compatible endpoint to the Gateway base URL.
-
Select the model ID shown in the setup dialog.
Agent guides
Section titled “Agent guides”- Codex (ChatGPT) — Covers Codex CLI and the ChatGPT desktop app.
- Cursor — Configure Cursor to use a project model.
- Pi — Configure Pi’s provider file.
- Hermes — Configure Hermes’ custom provider.
- Claude Code — Connect Claude Code to a project model.
- Desktop Companion CLI — Use the signed macOS Desktop Companion CLI.
Check the connection
Section titled “Check the connection”Restart the client if it was already running. Select the configured model and send a short request. If the response arrives, the connection works.
If the model does not appear
Section titled “If the model does not appear”- Confirm that the model ID and Gateway base URL exactly match the setup dialog.
- Confirm that the API key is the Gateway Key issued for the same project.
- Confirm that the model is allowed in that project’s Models menu.
- If the model’s Provider is not visible to the project, ask an organization administrator to widen its project visibility. See Provider project visibility.
- If the request still fails, ask the AI Gateway administrator to check the route used by your client.