Optional requestFactory: AIGatewayApiRequestFactoryOptional responseProcessor: AIGatewayApiResponseProcessorPrivate configurationPrivate requestPrivate responseThe request object
Optional options: ConfigurationCreate a spend budget. Scope tags may include provider, model, and custom dimensions. Reserved metadata keys are rejected.
The request object
Optional options: ConfigurationCreate a scoped override with a client-generated UUID and the current configuration_revision. If the override can enable full capture for more traffic, set confirm_full_capture to true. Returns HTTP 409 when configuration_revision is stale, the UUID already exists, or the organization has 100 overrides. Missing configuration_revision or required full-capture confirmation returns HTTP 400. Retrying an accepted create with the same UUID returns HTTP 409. To undo a create, read the current configuration revision and delete the override using its returned override revision. Requires ai_gateway_config_write. Restriction policies are saved separately after the returned UUID and revision acknowledge creation. A lost response is an unknown outcome; absence from a filtered configuration response does not prove creation failed.
The request object
Optional options: ConfigurationRequires ai_gateway_config_write and provider Edit. Models and pricing inherit provider access.
Add a manually managed model catalog entry to a provider. Manually managed entries are not modified by
automatic catalog synchronization.
The request object
Optional options: ConfigurationCreate an AI Gateway model group from a name and any combination of model catalog entries, providers, and routing rules, with optional fast-mode and reasoning limits. Include initial access bindings when creating a restricted policy. If the bindings cannot be applied, the policy is not created. To update sharing on an existing policy, use the restriction policy API. If a creation request fails without confirming whether the policy was created, check the policy list before retrying to avoid duplicates.
The request object
Optional options: ConfigurationCreating a provider requires ai_gateway_config_write. No provider View check applies before creation.
Create a provider and its initial model catalog. All discovered models are enabled; optional models are
added as manually managed entries. The slug is the immutable routing identifier.
Provider and initial catalog rows are saved in one transaction. Initial sharing is unavailable:
supplying initial_bindings returns 503 with stage initial_permissions and outcome not_saved.
A failed database commit can return 503 with stage database_commit and outcome unknown; check the
provider list before retrying. Creation without initial_bindings keeps normal unrestricted defaults.
The request object
Optional options: ConfigurationCreate a rate limit. All requests matching its scope share one allowance, unless a selector makes it a template, which gives each matched user, Team, or value its own allowance. Every matching rate limit applies. Returns 409 when another active rate limit has the same user, Team, tags, and selector, or when the organization already has the maximum number of rate limits.
The request object
Optional options: ConfigurationCreate an organization-owned route with ai_gateway_config_write. New provider/model and route references require View. New routes use standard unrestricted defaults. To restrict configuration access, create the route and then apply a restriction policy using its numeric route_id. Sharing follows standard restriction-policy propagation and does not grant or revoke policy-authorized inference. Data capture overrides are managed independently. Each tier has an ordering, which defaults to configured. A weighted_affinity tier distributes first-choice assignments by relative target weights (1 to 10000, default 1) and accepts only distinct model targets with an explicit provider. Weights need not total 100. Configured tiers must omit weights or set them to null.
The request object
Optional options: ConfigurationDelete a manually managed model catalog entry, naming the model in the canonical query parameter. Discovered entries are read-only. Unlike the endpoint that takes the canonical ID in the path, this one accepts canonical IDs that contain /. Requires ai_gateway_config_write and provider Edit. Models and pricing inherit provider access.
The request object
Optional options: ConfigurationClear a provider model's pricing override, naming the model in the canonical query parameter. Unlike the endpoint that takes the canonical ID in the path, this one accepts canonical IDs that contain /. Requires ai_gateway_config_write and provider Edit. Models and pricing inherit provider access.
The request object
Optional options: ConfigurationArchive a spend budget by ID while retaining its accounting history.
The request object
Optional options: ConfigurationDelete an override using its revision and the current configuration_revision. If deleting the override can enable full capture for affected traffic, set confirm_full_capture to true. Returns HTTP 409 when configuration_revision or the override revision is stale, including a concurrent change during deletion. Missing revisions or required full-capture confirmation returns HTTP 400. Requires ai_gateway_config_write and View and Edit access to this override. Hidden overrides return HTTP 404; visible overrides without Edit return HTTP 403. Authorization failures return HTTP 503. If permission cleanup fails after the deletion is committed, the response is HTTP 500 with code deletion_permission_cleanup_failed, meta.configuration_deleted=true, and meta.permissions_cleanup_failed=true. Do not retry the deletion.
The request object
Optional options: ConfigurationRequires ai_gateway_config_write and provider Edit. Models and pricing inherit provider access.
Delete a manually managed model catalog entry by its canonical model ID. Discovered entries are read-only.
A canonical ID that contains / can't be sent in the path; use the /api/v2/providers/{provider_id}/model endpoint with the canonical query parameter instead.
The request object
Optional options: ConfigurationDelete a named model group. The organization-wide policy cannot be deleted. Requires configuration write permission and edit access to the group.
The request object
Optional options: ConfigurationClear a custom provider model's pricing override. A canonical ID that contains / can't be sent in the path; use the /api/v2/providers/{provider_id}/model-pricing endpoint with the canonical query parameter instead. Requires ai_gateway_config_write and provider Edit. Models and pricing inherit provider access.
The request object
Optional options: ConfigurationDelete the routing policy document for a specific inbound pattern.
The request object
Optional options: ConfigurationRequires ai_gateway_config_write and provider View/Edit. Models and pricing inherit provider access. Every affected route and policy membership requires the corresponding Edit permission; force=true never bypasses authorization. Providers used by routing rules return provider_in_use with HTTP 409. Each JSON:API error item's meta contains blocked, restricted_dependencies, policies, rules_to_delete, and rules_to_update. Visible policy entries contain id, name, and editable; visible route entries contain id, slug, and editable. Hidden dependencies are omitted from every collection and reported only by restricted_dependencies. A blocked response changes no configuration; an authorized editor must first remove the blocking references. Retry with force=true to confirm an authorized cascade that removes provider targets and deletes rules left without targets. Surviving tiers keep their ordering and weights. A deletion that would rewrite a surviving tier with an unknown ordering_issue fails with HTTP 409 and code routing_rule_unknown_ordering until that rule is replaced or deleted.
The request object
Optional options: ConfigurationArchive a rate limit by ID. An archived rate limit no longer appears in lists or lookups, and its alert monitor is deleted.
The request object
Optional options: ConfigurationDelete a route with ai_gateway_config_write and route View/Edit. Every affected route and policy membership requires the corresponding Edit permission. The force=true parameter confirms impact and never bypasses authorization. A denied or unavailable check changes no configuration. Visible dependencies include editable; hidden dependencies are omitted and reported only by restricted_dependencies. A blocked response means an authorized editor must first remove blocking references. Each JSON:API error item's meta contains blocked, restricted_dependencies, policies, rules_to_delete, and rules_to_update. Visible policy entries contain id, name, and editable. Route deletion entries contain rule, reason, and editable; update entries contain rule, removed_tiers, and editable. Each rule contains route_id, slug, tiers, created_at, and updated_at with hidden nested selections redacted. The removed_tiers array identifies original tier numbers removed entirely by the cascade. Already-authorized in-flight operations may finish. Referenced rules require force=true. Surviving tiers keep their ordering and weights. A deletion that would rewrite a surviving tier with an unknown ordering_issue fails with HTTP 409 and code routing_rule_unknown_ordering until that rule is replaced or deleted. Restriction cleanup occurs only after confirmed deletion. Cleanup failure returns 500 with configuration_deleted=true and permissions_cleanup_failed=true; refresh instead of assuming the route still exists.
The request object
Optional options: ConfigurationGet a provider model's pricing override and effective pricing source, naming the model in the canonical query parameter. Unlike the endpoint that takes the canonical ID in the path, this one accepts canonical IDs that contain /. Requires ai_gateway_config_read and provider View. Catalog and pricing metadata inherit provider access. Direct reads of hidden resources return 404.
The request object
Optional options: ConfigurationGet a spend budget by ID, including its capacity, scope, reset window, warning threshold, and enforcement mode.
The request object
Optional options: ConfigurationGet the active accounting window, enforced capacity, and current spend.
The request object
Optional options: ConfigurationAggregate counters for an accounting window, including total spend and the numbers of instances at or above the warning threshold and capacity. Use split_dim to aggregate only counters that match every given dimension value.
The request object
Optional options: ConfigurationGet the organization default mode, scoped capture overrides, and configuration revision. Requires ai_gateway_config_read. Only overrides the caller can View are returned. Hidden overrides remain effective and contribute to configuration_revision. An override missing from the response is not necessarily deleted.
Optional options: ConfigurationGet the organization-wide AI Gateway governance settings, which are the default data capture mode and whether requests must reach providers covered by a zero data retention agreement.
Optional options: ConfigurationGet a named policy or the explicit organization-wide policy by id "default". Requires configuration read permission and policy View, including for the default policy. Hidden policies are omitted from lists and return the same not-found response as missing policies. Provider selections cover current and future models and are returned separately from individual model selections.
The request object
Optional options: ConfigurationGet a custom provider model's pricing override and effective pricing source. A canonical ID that contains / can't be sent in the path; use the /api/v2/providers/{provider_id}/model-pricing endpoint with the canonical query parameter instead. Requires ai_gateway_config_read and provider View. Catalog and pricing metadata inherit provider access. Lists omit hidden entries; direct reads of hidden resources return 404.
The request object
Optional options: ConfigurationGet the routing policy document for a specific inbound pattern.
The request object
Optional options: ConfigurationGet a provider by ID, including its routing slug, integration account, and cost multiplier. Credentials stay in the integration account and are never returned. Requires ai_gateway_config_read and provider View. Catalog and pricing metadata inherit provider access. Lists omit hidden entries; direct reads of hidden resources return 404.
The request object
Optional options: ConfigurationGet a rate limit by ID, including its scope, per-minute request and token limits, and whether it is enabled.
The request object
Optional options: ConfigurationAggregate a template rate limit's hot counters, including how many there are, how many are near or at their limit, and the fullest counter's utilization. Hot counters are those that reached 80% or more of a limit, or that limited or would have limited a request, in the last hour. Use split_dim to aggregate only counters that match every given dimension value. When the caller can't see the template's selector, every count is zero and scope_restricted is true. Summaries are cached for up to 15 seconds. Returns 503 when counter usage can't be read.
The request object
Optional options: ConfigurationGet live usage for the organization's rate limits. Returns requests and tokens counted in the rolling one-minute window and requests limited in the last 15 minutes for each enabled rate limit, plus untracked (traffic no enforced rate limit covers) and total (all gateway traffic).
Optional options: ConfigurationGet a routing rule by slug with ai_gateway_config_read and route View. Hidden and missing routes both return 404. Hidden target identities are omitted; parent-local target IDs remain available for retention.
The request object
Optional options: ConfigurationSearch the values that a template budget's split dimensions take across its instance counters in an accounting window. Each dimension returns its top values by spend, with counter counts. Use query or value to narrow results and limit to cap them. The truncated field reports whether more values matched. Each dimension's values are counted under the other dimensions' split_dim filters, so a dimension's own filter does not hide its alternatives. Legacy fixed-scope budgets return an empty list.
The request object
Optional options: ConfigurationList instance counters for an accounting window. Legacy fixed-scope budgets return one pooled row with an empty instance_key. Omit window to use the current window. Use split_dim to keep only counters that match every given dimension value.
The request object
Optional options: ConfigurationList spend budgets for the organization, including active-window spend and effective capacity.
Optional options: ConfigurationList model groups the user can view. The organization-wide policy has id "default" and explicit model, provider, and route selections. Missing or empty selections grant no organization-wide access. Its audience is fixed to the organization; it cannot be renamed or deleted. Named policies retain their access bindings. Requires configuration read permission and policy View, including for the default policy. Hidden policies are omitted from lists and return the same not-found response as missing policies.
Optional options: ConfigurationList all model catalog entries for a provider. Requires ai_gateway_config_read and provider View. Catalog and pricing metadata inherit provider access. Lists omit hidden entries; direct reads of hidden resources return 404.
The request object
Optional options: ConfigurationList all model catalog entries grouped by canonical model ID. Requires ai_gateway_config_read and provider View. Catalog and pricing metadata inherit provider access. Lists omit hidden entries; direct reads of hidden resources return 404.
Optional options: ConfigurationList all routing policy documents for the organization. Pass user_id to filter by user scope.
The request object
Optional options: ConfigurationList live models available to a provider integration account that supports model discovery.
The request object
Optional options: ConfigurationList the model providers connected to the organization. Credentials stay in each provider's integration account and are never returned. Requires ai_gateway_config_read and provider View. Catalog and pricing metadata inherit provider access. Lists omit hidden entries; direct reads of hidden resources return 404.
Optional options: ConfigurationList the hot counters of a template rate limit, one per matched user, Team, or value, with their live usage. The list includes only counters that, in the last hour, reached 80% or more of a limit or limited or would have limited a request. A counter appears within a few minutes of becoming hot. Usage is read for at most 200 counters per request; past that, rows carry usage_known false. Counters for a provider or model the caller can't see are left out, and when the caller can't see the template's selector, the list is empty. A rate limit with one shared allowance, including one whose selector has no per_value entry, returns an empty list. Returns 503 when counter usage can't be read.
The request object
Optional options: ConfigurationAggregate the counters of every template rate limit in the organization in one call. The response has one summary per template, in the same order as the rate limit list. Each summary matches the response of the single-template counter summary endpoint without split_dim, including scope_restricted and truncated. Rate limits with one shared allowance aren't included. Summaries are cached for up to 15 seconds.
Optional options: ConfigurationList the organization's AI Gateway rate limits.
Optional options: ConfigurationList the organization's routing rules that the caller has View access to. Requires ai_gateway_config_read. Hidden route references are omitted from nested targets.
Optional options: ConfigurationOverride active-period capacity for one instance of a template budget, identified by its instance_key. Other instances and the budget's default capacity are unchanged. The override is retained in the budget adjustment audit history. Returns 404 when the instance has no counter in the active period. Not supported for legacy fixed-scope budgets.
The request object
Optional options: ConfigurationReset active-period spend for one instance of a template budget, identified by its instance_key. The reset is retained in the budget adjustment audit history. Returns 404 when the instance has no counter in the active period. Not supported for legacy fixed-scope budgets.
The request object
Optional options: ConfigurationUpdate a manually managed model catalog entry, naming the model in the canonical query parameter. Discovered entries are read-only. Unlike the endpoint that takes the canonical ID in the path, this one accepts canonical IDs that contain /. Requires ai_gateway_config_write and provider Edit. Models and pricing inherit provider access.
The request object
Optional options: ConfigurationSet a provider model's pricing override, naming the model in the canonical query parameter. Unlike the endpoint that takes the canonical ID in the path, this one accepts canonical IDs that contain /. Requires ai_gateway_config_write and provider Edit. Models and pricing inherit provider access.
The request object
Optional options: ConfigurationUpdate a budget's mutable definition. Capacity changes apply to future accounting periods
unless apply_to_current_period is true.
The request object
Optional options: ConfigurationReplace an override using its revision and the current configuration_revision. Changes to capture overrides don't affect routing rules. Returns HTTP 409 when configuration_revision or the override revision is stale, including a concurrent change during replacement. Missing revisions or required full-capture confirmation returns HTTP 400. Requires ai_gateway_config_write and View and Edit access to this override. Hidden overrides return HTTP 404; visible overrides without Edit return HTTP 403. Authorization failures return HTTP 503. The returned UUID and revision acknowledge the saved configuration even if the caller can no longer list it. Restriction policies are saved separately.
The request object
Optional options: ConfigurationReplace the organization-wide AI Gateway governance settings, which are the default data capture mode and whether requests must reach providers covered by a zero data retention agreement.
The request object
Optional options: ConfigurationUpdate a manually managed model catalog entry. Discovered entries are read-only. A canonical ID that contains / can't be sent in the path; use the /api/v2/providers/{provider_id}/model endpoint with the canonical query parameter instead. Requires ai_gateway_config_write and provider Edit. Models and pricing inherit provider access.
The request object
Optional options: ConfigurationUpdate a model group. For id "default", save membership and request options atomically with expected_revision. Empty selections grant no organization-wide access. Applicable authorized named policies override organization-wide request options; a rejected named-policy request cannot fall back to organization-wide options. The organization-wide audience is fixed and grants resource use only. Requires configuration write permission and policy View and Edit, including for the default policy. Management visibility does not change the inference audience or Run access.
The request object
Optional options: ConfigurationSet a custom provider model's pricing override. A canonical ID that contains / can't be sent in the path; use the /api/v2/providers/{provider_id}/model-pricing endpoint with the canonical query parameter instead. Requires ai_gateway_config_write and provider Edit. Models and pricing inherit provider access.
The request object
Optional options: ConfigurationUpdate a provider's display name or cost multiplier. Provider type, integration settings, and slug are immutable. Requires ai_gateway_config_write and provider Edit. Models and pricing inherit provider access.
The request object
Optional options: ConfigurationUpdate a rate limit. Only the attributes sent are changed, and changes never reset current usage. Scope stays editable, except on a template rate limit, whose user_id, team_id, and tags are rejected with 400. Returns 409 when the rule was changed concurrently or the new scope duplicates another rule.
The request object
Optional options: ConfigurationUpdate a route with ai_gateway_config_write and route View/Edit. The slug is immutable; data capture is managed independently. Omitting tiers preserves the entire graph. When tiers are supplied, saved parent-local target IDs retain omitted destination and reasoning, weight, rubric, and default settings. Omitted ordering/classifier settings preserve the saved same-position tier. Explicit null resets nullable settings. New references require View on their resources. A hidden target omitted from tiers must be explicitly listed in removed_target_ids, otherwise the update fails without changes. expected_updated_at rejects stale updates with 409. Sharing-only saves do not replace target rows. Hidden and missing routes return the same 404; visible non-editors receive 403. Inference authorization is unchanged.
The request object
Optional options: ConfigurationCreate or replace the routing policy document for an inbound pattern. Pass user_id to scope the policy to a user.
The request object
Optional options: ConfigurationGenerated using TypeDoc
Requires
ai_gateway_config_writeand provider Edit. Models and pricing inherit provider access. Add multiple manually managed model catalog entries to a provider in a single request. Manually managed entries are not modified by automatic catalog synchronization.