Skip to main content
An gateway routes AI requests through provider credentials stored in . Applications use a gateway token instead of receiving the provider credential.

The complete flow

  1. Choose an AI provider.
  2. Add a provider credential.
  3. Create a gateway in a project.
  4. Attach the credential and choose routing defaults.
  5. Create a gateway token.
  6. Point your provider client at the returned data-plane URL.
  7. Inspect logs, usage and key access.

List providers

MCP request:
MCP tool used: list_providers

Add a provider credential

The credential value is accepted for validation and encrypted storage. It is never returned by list or read operations. SDK:
CLI reads the provider value from an environment variable named by the flag:
Put the value in an AIRCTRL_MCP_KEY_* environment variable and pass only that variable’s name.
MCP tool used: add_provider_key

Create a gateway

MCP uses create_gateway for a bare gateway. Use setup_gateway when the same operation must validate a provider key, bind one live-catalog model, create the gateway, mint a token, and return connection information.
MCP tool used: create_gateway

Create a gateway token

Gateway token plaintext is returned once.CLI command: gateway token-createStore the returned value before leaving the response. Listing tokens later returns metadata only.
MCP request:
MCP tool used: create_gateway_token

Connect an AI client

Use the gateway token with the URLs returned by get_connection_config or setup_gateway.
  • OpenAI-compatible SDKs use the /compat base URL.
  • OpenAI-native requests use the /openai/v1 path.
  • Anthropic clients use the /anthropic base URL.
  • Gemini-compatible clients use the returned Gemini endpoint.
The data plane speaks each provider’s normal protocol. It is not wrapped in separate SDK methods. MCP request:
MCP tool used: get_connection_config

Routing and settings

Use updateGateway, updateGatewaySettings, attachGatewayCredential, and detachGatewayCredential in the SDK. Gateway settings can control:
  • Spend limit and period.
  • Requests per minute.
  • Request logging and optional body logging.
  • Allowed models.
  • Guardrail mode.
  • Cache state and lifetime.
CLI commands: gateway update, settings, credential-attach, and credential-detach.
MCP tool used: set_gateway_settings

Logs and usage

  • Gateway logs show requests for one gateway.
  • Project usage combines gateways in one project.
  • Key access shows whether granted, denied, or failed to retrieve a provider credential.
  • Log-body reads require usage:read-bodies because prompts and responses can contain sensitive data.
  • Spend reads require usage:read-spend.
SDK methods include listGatewayLogs, getGatewayLogDetail, listGatewayKeyAccess, listUsageLogs, getUsageLogDetail, getUsageSpend, and getUsageMetrics.

OpenTelemetry

Use getGatewayOtelExport and updateGatewayOtelExport to configure metrics and traces. Stored header values are write-only and are never returned. CLI commands: gateway otel, gateway otel-update
MCP tool used: get_otel_export

Common failures

  • 403 plan_limit_reached: the account plan cannot create another gateway.
  • 404 gateway_not_found: the gateway is unavailable in the active account.
  • 400: a provider credential belongs to another account or a setting is invalid.
  • 429: API rate limit, gateway rate limit, or spend limit. Read the error code before retrying.