Repository navigation
v1.11.0 — Resources file format 2, internal-call usage events, native Azure OpenAI images and audio
Latest🚀 Get started
New to AISIX? Get the gateway running and route your first LLM request in minutes:
- 📖 Documentation — https://docs.api7.ai/ai-gateway/
- ⚡ Gateway quickstart (one container, declarative
resources.yaml) — https://docs.api7.ai/ai-gateway/getting-started/gateway-quickstart
📦 Download
Pull the container image from the GitHub Container Registry:
docker pull ghcr.io/api7/aisix:1.11.0The rolling latest tag and the docker.io/api7/aisix mirror for private/offline deployments are listed on the package page.
AISIX 1.11.0 makes the resources file the same thing etcd stores: every entry carries its id, a file loads through the same pipeline as etcd, and aisix export round-trips everything the gateway reads except budgets. Model calls the gateway makes on a caller's behalf, for semantic routing, the semantic cache and semantic guardrails, are now usage events of their own. Azure OpenAI provider keys serve images, audio and embeddings natively, and an API key can be granted every model.
- Resources file format 2 (#1449, #1451): entries are
idplus the stored document, one bad entry no longer fails the whole file, andaisix exportnow writes every kind the gateway reads except budgets. A version-1 file no longer loads; see Breaking changes. - Internal model calls as child usage events (#1445): each embedding or classifier call made for a request is its own usage event and OTLP span, marked with
internal_call_purpose. - Native Azure OpenAI images, audio and embeddings (#1441, #1442, #1459): on Azure's own routes, with a new optional
api_versionon the provider key, and dotted deployment names such asgpt-4.1now work. allow_all_modelson API keys (#1440): grants every model, including ones added later.- Keep estimated usage out of token rate limits (#1447): a new
usage_accountingresource. - etcd connection recovery (#1450, #1452, #1453): a watch stuck on a silent reconnect recovers, non-credential etcd errors are retried, and a standalone gateway applies each shared-catalog price from one stream.
Control-plane, console and AISIX Enterprise / AISIX Cloud changes in this release (fine-grained authorization, billing of internal model calls, sale prices on direct models, the platform cost view, control-plane API changes) are described in the AISIX release notes.
⚠️ Breaking changes
The resources file is format version 2 (#1449)
A resources file is now the set of documents etcd would store, written down. A version-1 file no longer loads: the gateway reports unrecognized _format_version "1" and does not start.
_format_versionmust be"2"(quoted).- Every entry needs an
id, a UUID in lowercase hyphenated form, unique within its collection. IDs are no longer derived from entry names, and names no longer have to be unique. - References use IDs, exactly as the stored documents do. The file-only name forms are gone:
provider_key→provider_key_id,semantic.classifier.model_ref→semantic.classifier.model_id,anonymous_key→anonymous_key_id,anonymous.api_key→anonymous.api_key_id,resolve.api_key→resolve.api_key_id, attachmentguardrail_id/scope_idand rate-limitscope_refandmodel/api_keycondition values as names → the target'sid, andapplies_to: "api_key:<derived id>"→applies_to: "api_key:<id>". Name-form fields that the stored documents themselves carry, such asallowed_modelsor a routing target'smodel, still load. key_env: VARon an API key is replaced bykey_hash: ${VAR_SHA256}, the SHA-256 digest of the key as 64 lowercase hex characters (printf '%s' "$KEY" | sha256sum).
Old:
_format_version: "1"
provider_keys:
- display_name: openai-prod
provider: openai
api_key: ${OPENAI_API_KEY}
models:
- display_name: gpt-4o
provider: openai
model_name: gpt-4o
provider_key: openai-prod
api_keys:
- display_name: ci-bot
key_env: CI_BOT_KEY
allowed_models: ["gpt-4o"]New:
_format_version: "2"
provider_keys:
- id: 0b6f3c1e-2f0a-4c5e-9d55-7d1a8b0c2e11
display_name: openai-prod
provider: openai
api_key: ${OPENAI_API_KEY}
models:
- id: 6efd592d-a73b-473d-8e2c-e9e103692f92
display_name: gpt-4o
provider: openai
model_name: gpt-4o
provider_key_id: 0b6f3c1e-2f0a-4c5e-9d55-7d1a8b0c2e11
api_keys:
- id: 4a1c9e2b-7d3f-4b6a-8c5e-1f2a3b4c5d6e
display_name: ci-bot
key_hash: ${CI_BOT_KEY_SHA256}
allowed_models: ["gpt-4o"]How the file loads changes with the format:
- A file that cannot be turned into rows at all (unreadable, invalid YAML, a wrong
_format_version, a missing, malformed or duplicateid, an unset${VAR}) stops the gateway at boot. On aSIGHUPreload, the gateway keeps serving what it has,/status/configreportsout_of_syncwith the problems inrejected[], and the nextSIGHUPreads the file again. - Past that, each entry is checked the way an etcd row is: an invalid entry is dropped and reported in
/status/configrejected[]andaisix_config_rejected_resources, and the rest of the file serves. On a reload, an entry that stops loading keeps serving its last valid value. Before, any bad entry failed the whole file. - An unknown field is ignored and reported as partially compatible, and an unknown top-level key is reported as an unknown kind, instead of failing the file.
- The file's own checks are gone: unique names, references that must name an entry in the file, duplicate credentials, a unique
jwt_provider+jwt_subjectpair, and the write-schema checks the read schema does not repeat. - In file mode,
/status/config'ssource_hashandconfig_hashare computed over the rows rather than the raw file bytes, and a rejection'sresource_idis the entry'sid.
To migrate, rewrite the file in the new format and check it with aisix validate --resources <file>, which prints each rejected entry with its reason and each partially compatible entry as a warning, and exits non-zero if any entry is rejected. A gateway backed by etcd can produce the new format with aisix export. See Format Version 2 in the resources-file reference for the full mapping.
Old field names are no longer read (#1455)
The gateway no longer accepts secret as a provider key's api_key, or display_name as name on MCP servers, A2A agents and passthrough routes. A resources file or an etcd document that still uses one of them fails validation, and the entry is rejected whole, together with what depends on it (models on that provider key, that MCP server's tools). Rename the field to api_key or name. The secret fields inside MCP server and A2A agent auth, and display_name on provider keys, models and API keys, are not affected.
A kind: semantic guardrail with a non-empty deny_examples or allow_examples list now needs the matching deny_threshold or allow_threshold. It used to load with 0.75. Such a guardrail is rejected, and its attachments are skipped, until the threshold is set. A direction with no examples can still leave its threshold out.
gateway_embedding_calls is replaced by child usage events (#1445)
Usage events no longer carry gateway_embedding_calls or gateway_embedding_calls_dropped, and OTLP spans no longer carry the aisix.gateway_embedding_calls* attributes. Each internal model call is its own usage event instead (see Observability). Update exporter queries and dashboards (SLS, object storage, Datadog, OTLP) that read those fields.
📦 Resources file and aisix export
aisix exportwrites every kind the gateway reads except budgets (#1449, #1451). Each entry is its etcdidplus the document exactly as etcd stores it, references unchanged, with secrets still replaced by${VAR}placeholders (a custom guardrail'ssecretsmap is redacted too). Newly exported:passthrough_routes,mcp_policies,teams,users,budget_policy,usage_accounting,pricing, and the shared catalog'spricingunder the file's newglobal:section. A file-mode gateway loading the export prices models, applies estimated-usage accounting and namesteam_name/user_nameexactly as the etcd-backed gateway did. Budgets are still left out, because a budget's exhausted state frozen into a file would keep refusing traffic; stderr says how many were skipped. A reference to an ID that is not among the exported entries is a warning, and the command exits non-zero when the loader rejected a stored row (left out of the file) or a resource is stored under an ID that is not a lowercase hyphenated UUID. Exporting only an environment prefix (--prefix <base>/<env_id>) does not read the shared catalog under<base>/global/, and the export warns for each model whose price would then be missing.- Exported files keep working in file mode (#1446, #1448, #1449). A semantic router whose classifier references its model by
model_id, a conditional rate-limit policy whose conditions name a model or an API key, and anonymous MCP access bound to an API key now behave the same on a file-mode gateway loaded fromaisix exportas on the etcd gateway it came from. Before, the classifier could never be called (every request tookon_failure), the file with such a policy did not load, and every anonymous/mcprequest got401. aisix validateruns the gateway's own loader (#1449), so what it accepts is what the gateway serves.
🔌 Providers and API surface
- Azure OpenAI images, audio and embeddings (#1441). An
azure-openaiprovider key now serves/v1/images/generations,/v1/images/edits,/v1/embeddingsand the three audio routes on Azure's own routes, with theapi-keyheader or an Entra ID token. Before, images answered400, embeddings501, and audio built a request Azure rejected.- The new optional provider key field
api_versiontakes a dated version (2024-10-21,2025-04-01-preview) orv1, which selects Azure's/openai/v1/...routes (previewandlatestare aliases ofv1). When it is unset, each operation keeps its own default version, so chat is unchanged. Realtime and files / batches / fine-tuning read it too, and Entra ID client credentials now work on those routes.
- The new optional provider key field
- Azure
api_baseresolution (#1442). Every Azure route resolvesapi_basethe way chat does, so the endpoint the Azure portal shows (https://<resource>.openai.azure.com/openai/v1) works on realtime and files / batches too. See Upgrade notes for override hosts. - Dotted Azure deployment names (#1459). A deployment name such as
gpt-4.1was refused with400on every endpoint without calling Azure. It now works. A name made only of dots is still refused. allow_all_modelson API keys (#1440).allow_all_models: truegrants every model of every kind, including models added later;allowed_model_idsandallowed_modelsare then not read. It applies to every endpoint's model check, the/v1/modelslisting and the files / batches model fallback, and the admin API shows it.- Semantic router classifier by model (#1445).
semantic.classifier.model_idreferences a direct model whose provider key'sprovideristypesafe. The classifier call then goes out exactly as aPOST /v1/systemoneto that model would, with itsmodel_name, key,api_base, body overrides and headers. It wins over the inlineprovider_key_id+model, which keeps working. - Streaming usage estimate (#1456). A streamed
/v1/chat/completionsrequest withstream_options.include_usage: truenow gets the gateway's estimate in its final usage chunk when the upstream's stream reports no usage, as some OpenAI-compatible servers and relays do. Before, it got no usage chunk. Non-zero counters the upstream reports are kept, and the numbers match the usage record. - Responses encrypted reasoning (#1457, #1458). The gateway now tags
encrypted_contenton a direct model's/v1/responsesoutput too, not only a model group's (aisix_enc_v1:prefix), and the tag records the provider key that served it. A follow-up forwards the ciphertext to the model that issued it, to models on the recorded provider key, and to models on the issuing model's current key, so moving models one by one to a replacement provider key keeps conversations intact. A model that cannot read an item gets it without its ciphertext instead of failing with400 invalid_encrypted_content. See Upgrade notes.
🚦 Rate limits
-
Keep estimated usage out of token limits (#1447). While a
usage_accountingdocument saysexclude_estimated_usage: true, a request whose usage the gateway estimated commits no tokens totpm,tpdor a policy'smax_tokens. Request-count limits and concurrency still count it, and the usage event still carries the estimate. A stream the caller closes before the usage frame arrives is estimated and excluded too, so use it only where every caller is trusted. In a resources file:usage_accounting: - id: 7c1d2e3f-4a5b-4c6d-8e7f-9a0b1c2d3e4f exclude_estimated_usage: true
-
Output guardrail refusals on
/v1/messages(#1433). An answer the output guardrail refuses now counts toward TPM/TPD on/v1/messages, as it already did on chat and/v1/responses. Non-streamed/v1/messagesand buffered/v1/responsescount tokens before the output guardrail runs, so a caller that hangs up during the check is still charged.
🧩 MCP
- MCP SDK upgrade (#1444). rmcp moves to 3.11 and object_store to 0.14, which clears the open RustSec advisories against the gateway. A single upstream MCP message (a tool result or a
tools/listpage) over 64 MiB now fails promptly with the usual-32603error anderror_class="transport"; before, there was no limit. Aninitializethat asks for protocol version2026-07-28is answered with2025-11-25. A 429 carrying a JSON-RPC error is now recorded asupstream_statusinstead ofupstream_in_band; the caller's answer does not change. - MCP OAuth scopes (#1443). For
oauth2_authorization_codeMCP servers, the gateway no longer advertises or grants the upstream's scopes as its own. Protected-resource metadata lists the configured scopes withoutopenidandoffline_access, and omitsscopes_supportedwhen none are left. Both authorization-server documents listscopes_supported: []. Token responses no longer carryscope. The upstream is still asked for the full configured scope set.
📊 Observability
- Internal model calls as child usage events (#1445). Each embedding or classifier call the gateway makes for a request is its own usage event, with
internal_call_purpose(semantic_route_embedding,semantic_route_decision,semantic_cache_embedding,guardrail_embedding), the caller's identity, the called model and its tokens. It goes to every exporter, and on OTLP it is a CLIENT span in the request's trace. A semantic-cache hit still emits the lookup embedding that found it. The request's own events gainroute_target_model_id, the model or group a semantic router chose.aisix_usage_events_emitted_totaland its drop counter count child events, so they rise where these features are used; request metrics do not count them. - Exact
f32values (#1439). Datadog, SLS andaisix exportcarry values such as guardrail thresholds andcache_similarityas configured (0.9, not0.8999999761581421). - MCP OAuth discovery metrics (#1443). The root-level discovery routes (
/.well-known/oauth-protected-resource,/.well-known/oauth-protected-resource/mcp[/{server}],/.well-known/oauth-authorization-server/mcp/{server}) are labelledinbound_protocol="mcp"instead ofopenai. Update dashboards and alerts that filtered them by the old value. - New etcd log lines (#1450). INFO
etcd watch established after a failed cycle, and every 10 seconds a WARNetcd call still pending …while a call is outstanding.
⚡ Performance
- Token estimation off the request worker (#1433, #1437). Local token estimation for usage-free responses above 16 KiB runs on a dedicated thread pool instead of the request's worker, so a large estimate no longer delays other requests on the same worker. Counts do not change. Each pool thread has its own tokenizer instances, and the pool has
proxy.workersthreads (every CPU when unset). See Upgrade notes for memory.
🐛 Fixes
- A gateway could stop applying configuration until restarted after a lossy period on the path to etcd, when a reconnect's TCP connect succeeded but its TLS handshake never completed (#1450). The gateway now drops the stuck connection and dials a new one. With
etcd.request_timeout_msunset, each reconnect first runs a count-only probe read, and the watch create is bounded byetcd.dial_timeout_ms× endpoints × 4 (at least 30 seconds). - An etcd answer that is not a credential refusal (for example
OutOfRange,NotFound, or an unrecognizedUnimplemented) is now retried with backoff instead of ending the gateway at boot (#1452). The gateway stays up with its proxy listener closed until it can load. A permission or credential refusal behaves as before. - In standalone etcd mode (no
env_id), every key under the shared/aisix/global/catalog was delivered twice, by the base prefix's read and watch and by the catalog's, in no fixed order (#1453). A globalpricingrow could briefly go back to an older value, a deleted one could come back, or one deleted between the two start-up reads could survive, until the next write to that key. Each key is now applied from one stream only. Managed mode and file mode load the same rows as before. - A typesafe
api_baseending in/v1,/v1/or/systemoneno longer doubles the path on semantic router classifier calls (#1445). - A Vertex credential's
projectandregion, a Vertex model's upstream model id, and an Azure OpenAI Entra ID credential'stenant_idandclient_idthat contain/,\,?,#,%, a space or an ASCII control character, contain.., or are made only of dots are now refused as a configuration error (#1459). Such a value rewrote or redirected the upstream URL. An Azureapi_basewithout anhttp(s)://scheme is still refused, and the error now says why. - The
latesttag of the gateway image now moves only for the highest stable release (#1461). A patch on an older release line no longer moveslatestback to it.
⬆️ Upgrade notes
These notes apply when you upgrade from 1.10.x or earlier, in addition to Breaking changes above.
Streamed OpenAI-protocol chat always asks the upstream for usage (#1447)
For every streamed chat request to an OpenAI-protocol upstream (OpenAI, Azure OpenAI, and the OpenAI-compatible endpoints of Bedrock and Vertex), the gateway now always sets stream_options.include_usage: true. It merges that into the caller's object, overriding an explicit false, and replaces a non-object value. Before, it did this only when the caller sent no stream_options. The caller still sees usage only if it asked for it, so responses do not change. Usage records for callers that sent include_usage: false now carry the upstream's counts instead of local estimates.
Gateway memory grows with proxy.workers (#1437)
Each token-estimate pool thread holds its own tokenizer for each encoding it has used: about 17 MiB for cl100k, 27 MiB for o200k and 39 MiB for o200k_harmony. The pool has proxy.workers threads, and every CPU the process sees when workers is unset. A gateway that sets workers below its CPU count now gets that many estimate threads instead of one per CPU. Size workers to the CPUs you allocate.
Gateway Helm chart: no default resources, size workers
The aisix chart that ships with this release no longer sets default resources. The former requests: {cpu: 500m, memory: 256Mi} and limits: {memory: 1Gi} are removed, so a release that relied on them renders a pod with no resources after helm upgrade (--reuse-values keeps whatever the old release had). config.proxy.workers has no default, so the gateway uses every CPU the process sees, which is the whole node when there is no CPU limit. Set resources and config.proxy.workers for your deployment before upgrading.
With autoscaling on, a CPU or memory utilization target now fails the render unless the matching resources.requests is set, for an HPA and for a KEDA cpu or memory trigger with metricType: Utilization (KEDA's default). Before, such an autoscaler was deployed and never scaled. targetCPUUtilizationPercentage defaults to 70, so autoscaling.enabled=true alone now needs resources.requests.cpu.
Azure override hosts drop a trailing /openai (#1442)
On every Azure route, an override api_base (a host other than <resource>.openai.azure.com) that ends in /openai or /openai/v1 has that suffix dropped before the route is added. A key that only worked because its upstream really served /openai/v1/openai/... is now sent to /openai/.... An upper-case scheme such as HTTPS:// now works instead of returning 400.
Responses ciphertext is tagged on direct models too (#1457, #1458)
Clients echo the tagged encrypted_content back unchanged, as they already do for model groups. A direct model's tagged item continued outside the gateway, through a passthrough route or sent to the provider directly, now carries the tag and is rejected there, because only the gateway removes it. During a rolling upgrade, a 1.10 gateway that receives a new tag sends a model group's item without its ciphertext, so that turn loses its reasoning reuse without an error. previous_response_id handling does not change.
Child usage events in exporters (#1445)
Exporters now receive one extra event per internal model call. A consumer that treats every usage event as one caller request should filter on internal_call_purpose being absent.
What's Changed
- perf(proxy): run local token estimation on a dedicated thread pool by @jarvis9443 in #1433
- perf(token-estimate): per-thread tokenizer instances, estimate pool sized by proxy.workers by @jarvis9443 in #1437
- fix(telemetry): bound caller text and request size on /dp/telemetry by @jarvis9443 in #1438
- fix(telemetry): keep f32 values exact on /dp/telemetry and in exporters by @jarvis9443 in #1439
- feat(apikey): add allow_all_models to grant every model, including ones added later by @jarvis9443 in #1440
- feat(azure-openai): serve images, audio and embeddings natively and add provider key api_version by @jarvis9443 in #1441
- fix(azure-openai): resolve api_base on realtime and files/batches like the deployment routes by @jarvis9443 in #1442
- fix(mcp-oauth): stop advertising and granting upstream scopes (openid) as the gateway's own by @jarvis9443 in #1443
- fix(mcp): upgrade rmcp to 3.11 and object_store to 0.14, add cargo-deny advisories gate by @jarvis9443 in #1444
- feat(telemetry): emit each gateway-internal model call as a child usage event by @jarvis9443 in #1445
- fix(export): resolve classifier model_id and rate-limit condition ids to names in the resources file by @jarvis9443 in #1446
- fix(export,filesource): name the anonymous MCP principal by api key and check raw key ids on passthrough routes by @jarvis9443 in #1448
- feat(ratelimit): let an environment keep estimated usage out of token rate limits by @jarvis9443 in #1447
- feat(file-source)!: load the resources file as etcd documents through the etcd loader by @jarvis9443 in #1449
- feat(export): export every kind the gateway reads except budgets by @jarvis9443 in #1451
- fix(etcd): recover a watch stuck on a silent reconnect and report per-prefix applied revisions by @jarvis9443 in #1450
- fix(etcd): read each prefix unpinned and retry non-credential etcd answers by @jarvis9443 in #1452
- fix(etcd): apply each catalog key from one watch stream in standalone mode by @jarvis9443 in #1453
- docs(passthrough-route): state which credential headers identity_header refuses, and where by @jarvis9443 in #1454
- refactor!: retire the legacy field-name aliases and the semantic threshold read default by @jarvis9443 in #1455
- fix(chat): carry the usage estimate on the include_usage stream frame by @jarvis9443 in #1456
- fix(responses): bind tagged ciphertext to the provider key that issued it, for direct models too by @jarvis9443 in #1457
- fix(responses): let the origin model and its current key read tagged ciphertext by @jarvis9443 in #1458
- fix(azure,vertex): accept dots in Azure deployment names, refuse dot-segment path tokens by @jarvis9443 in #1459
- ci(docker-image): retry pulling a just-pushed digest before checking it by @jarvis9443 in #1460
- ci(docker-image): sign by created digest, verify run-unique tags strictly, guard :latest by @jarvis9443 in #1461
Full Changelog: v1.10.0...v1.11.0