Skip to main content
POST
Manage your AI Gateway API keys programmatically. Gateway API keys are used to authenticate requests to the Edgee AI Gateway API (https://edgee.io) for making LLM requests.
These endpoints manage Gateway API keys for the AI Gateway API (edgee.io), not the Console API tokens. Do not confuse these two systems.

Request Body

string
required
A descriptive name for this API key (e.g., “Production Backend”, “Development Client”)
string
default:"api"
The type of API key. Options: api (for Gateway requests) or coding_agent (for coding assistants)
string
Required if type is coding_agent. Specifies which coding assistant this key is for.Options: claude_code, opencode, codex, cursor, copilot, crush, codebuddy
array
Optional list of model restrictions. If specified, this key can only access these models. Leave empty for no restrictions.Example: ["anthropic/claude-opus-4-6", "openai/gpt-5.2"]
integer
Optional usage limit in USD for the period set by max_usage_period. If specified, this key stops working after reaching this cost threshold.
string
default:"monthly"
The window max_usage applies to. Options: daily, monthly, all_time. See Usage limits & budgets.
integer
Optional expiration time in days from creation. After this period, the key will stop working.
string
Optional email address associated with this key (for organization/billing tracking).
object
Per-key token compression settings. Accepts an object with the tool_result_trimming, tool_surface_reduction, and output_brevity booleans. A bare true is accepted as a legacy shorthand for tool_result_trimming only.
array
Ordered list of models to try when the requested model’s provider fails. See Retry, Fallback & Reroute.
array
Ordered list of models to serve instead of the requested model. When set, the requested model is never contacted. See Reroute.
boolean
When true, the key may only use BYOK provider keys. Requests for models with no matching BYOK credentials are rejected.
Settings resolve organization > squad > key. A value set at a higher scope overrides what you set here — see how settings resolve.

Response

string
The object type (always “ai_gateway_api_key”)
string
Unique identifier for this API key
string
The organization this key belongs to
string
The name of this API key
string
The type of API key (“api” or “coding_agent”)
string
The coding assistant this key is for (if type is “coding_agent”)
array
List of model restrictions (if any)
integer
Usage limit in USD (if set)
string
The window max_usage applies to: daily, monthly, or all_time
boolean
Whether this key is currently active
boolean
Whether debug mode is enabled for this key
string
ISO 8601 timestamp when the key was created
string
ISO 8601 timestamp when the key will expire (if set)
string
ISO 8601 timestamp of the last usage (if ever used)
string
The actual API key (only shown once at creation or when using the reveal endpoint)

Examples

Tips

  • API Keys vs Console Tokens: Gateway API keys are used to authenticate requests to the Gateway API (edgee.io), while Console tokens authenticate requests to the Console API (api.edgee.app)
  • Model Restrictions: Use the models field to restrict which models a key can access, useful for controlling access and managing costs
  • Usage Limits: Set max_usage with a max_usage_period to cap spend per day, per month, or for the key’s lifetime
  • Expiration: Use expires_in_days to automatically revoke keys after a set period for security rotation
  • Key Visibility: Once created, the key is only shown once. Use the reveal endpoint if you need to see it again, but the key must already exist

Next Steps