<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Yilia</title>
    <description>The latest articles on DEV Community by Yilia (@yilialinn).</description>
    <link>https://dev.to/yilialinn</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F972804%2Ff233b99c-5dfb-4559-912d-5fcd16340f87.jpg</url>
      <title>DEV Community: Yilia</title>
      <link>https://dev.to/yilialinn</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/yilialinn"/>
    <language>en</language>
    <item>
      <title>Operating Serverless APIs: Cold Starts, Idempotency, and Asynchronous Handoffs</title>
      <dc:creator>Yilia</dc:creator>
      <pubDate>Tue, 24 Nov 2026 14:36:39 +0000</pubDate>
      <link>https://dev.to/yilialinn/operating-serverless-apis-cold-starts-idempotency-and-asynchronous-handoffs-e1k</link>
      <guid>https://dev.to/yilialinn/operating-serverless-apis-cold-starts-idempotency-and-asynchronous-handoffs-e1k</guid>
      <description>&lt;p&gt;Originally published by API7.ai on &lt;a href="https://api7.ai/learning-center/api-gateway-guide/operating-serverless-apis-gateway" rel="noopener noreferrer"&gt;API7.ai&lt;/a&gt; on 2026-10-29.&lt;/p&gt;

&lt;p&gt;This republication was prepared with AI assistance. The original article’s drafting process has not been verified.&lt;/p&gt;

&lt;p&gt;An API gateway can authenticate and bound a serverless request, route it to a function or submission service, and expose a stable client contract. It cannot remove cold starts, make a timed-out invocation safe to repeat, or turn queue acceptance into proof that business work completed.&lt;/p&gt;

&lt;p&gt;Design synchronous and asynchronous APIs as different contracts. Synchronous calls need a deadline that includes gateway and function startup. Asynchronous calls need a durable operation identity, status model, duplicate handling, retention policy, and terminal failure path.&lt;/p&gt;

&lt;h2&gt;
  
  
  Key Takeaways
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Choose synchronous execution only when the complete latency distribution fits the client deadline.&lt;/li&gt;
&lt;li&gt;Treat a gateway timeout as an unknown outcome if function execution may already have started.&lt;/li&gt;
&lt;li&gt;Put idempotency in the application state transition, not only in a gateway header.&lt;/li&gt;
&lt;li&gt;Return &lt;code&gt;202 Accepted&lt;/code&gt; only after durable handoff and provide an operation-status contract.&lt;/li&gt;
&lt;li&gt;Separate gateway admission, cloud queue acceptance, function execution, and business completion.&lt;/li&gt;
&lt;li&gt;Test cold, warm, throttled, duplicate, expired, and replayed requests.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Choose the Interaction Contract First
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Contract&lt;/th&gt;
&lt;th&gt;Client receives&lt;/th&gt;
&lt;th&gt;Use when&lt;/th&gt;
&lt;th&gt;Main failure to design&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Synchronous&lt;/td&gt;
&lt;td&gt;Final operation response&lt;/td&gt;
&lt;td&gt;Work reliably finishes inside the total deadline&lt;/td&gt;
&lt;td&gt;Timeout after execution began&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Asynchronous submission&lt;/td&gt;
&lt;td&gt;Operation ID and status location&lt;/td&gt;
&lt;td&gt;Work is long-running, bursty, or retryable in the background&lt;/td&gt;
&lt;td&gt;Accepted but later failed or expired&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Event ingestion&lt;/td&gt;
&lt;td&gt;Acknowledgement that an event entered the platform&lt;/td&gt;
&lt;td&gt;Producer does not need a request-correlated result&lt;/td&gt;
&lt;td&gt;Duplicate delivery and ordering&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Callback or webhook&lt;/td&gt;
&lt;td&gt;Later result pushed to consumer&lt;/td&gt;
&lt;td&gt;Consumer can authenticate callbacks and handle retries&lt;/td&gt;
&lt;td&gt;Spoofed, duplicated, or undeliverable callback&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Do not hide a long-running synchronous function behind a larger gateway timeout. That consumes client, gateway, and function capacity while making recovery ambiguous.&lt;/p&gt;

&lt;h2&gt;
  
  
  Separate the Actors
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmermaid.ink%2Fimg%2Fpako%3AeNpdUk1vwjAM_StWz4MfsMMkBAIhDTHGgUPhEBJvjZaPLnHKKsp_nxs6QPPN9nvPz5bPhfQKi2coPow_yUoEgtf3vQOOaTlJVKEjLQWhAmk0JwcYjV5gUU7elvDJ9ZNoD1f8ou90sfKsEVsnq-CdTxECfieM1MG8nCcnSXsH6FTtNas9UhthtMqjYjpaHSMjO9iW21sGEUOjJQ60baapFMTRIGvynIQdbMqVcOKTdXIBfABs2Po_9iZvsrubOvnwhWHo7nJ3Vi4V2tpTphObAwrCRd0TBuQsI9flusYgslAP5MUj-fA3bJqt1t4Y8DfcctbB4uECsL4mcxiNAX9QpgwLGJMhGPd3v1kfg5ASaxJOIginQKHRDYaWd9UK-2pPWN1tRSA0aJFCe9_xcU6vQhisdoJdJpLeDiJ7VzxBYbkntOJvORf8GDb_jcPEFzHF5fILjpHEUg%3Ftype%3Dpng%26bgColor%3D%21white" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmermaid.ink%2Fimg%2Fpako%3AeNpdUk1vwjAM_StWz4MfsMMkBAIhDTHGgUPhEBJvjZaPLnHKKsp_nxs6QPPN9nvPz5bPhfQKi2coPow_yUoEgtf3vQOOaTlJVKEjLQWhAmk0JwcYjV5gUU7elvDJ9ZNoD1f8ou90sfKsEVsnq-CdTxECfieM1MG8nCcnSXsH6FTtNas9UhthtMqjYjpaHSMjO9iW21sGEUOjJQ60baapFMTRIGvynIQdbMqVcOKTdXIBfABs2Po_9iZvsrubOvnwhWHo7nJ3Vi4V2tpTphObAwrCRd0TBuQsI9flusYgslAP5MUj-fA3bJqt1t4Y8DfcctbB4uECsL4mcxiNAX9QpgwLGJMhGPd3v1kfg5ASaxJOIginQKHRDYaWd9UK-2pPWN1tRSA0aJFCe9_xcU6vQhisdoJdJpLeDiJ7VzxBYbkntOJvORf8GDb_jcPEFzHF5fILjpHEUg%3Ftype%3Dpng%26bgColor%3D%21white" alt="Serverless API request and durable asynchronous handoff diagram" width="1904" height="336"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The gateway admits and routes. The submission service owns durable enqueue and operation creation. The queue or cloud service decides delivery. The function executes. The application state store decides whether a duplicate changes state. Keep these responsibilities distinct in prose, metrics, and incident response.&lt;/p&gt;

&lt;h2&gt;
  
  
  Budget Cold Starts Explicitly
&lt;/h2&gt;

&lt;p&gt;A cold invocation may include environment allocation, runtime initialization, dependency loading, network setup, and application initialization before handler work begins. Measure each function version with production-like package size, memory, networking, region, and dependencies.&lt;/p&gt;

&lt;p&gt;For a synchronous route, budget:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;client deadline &amp;gt; gateway processing + connection + platform queue/startup + function execution + response transfer + recovery margin
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Provisioned concurrency can prepare AWS Lambda execution environments ahead of invocation, but it adds cost and can spill over when demand exceeds the provisioned level. Pin callers to the version or alias that owns the provisioned capacity; invoking another version does not use that pool. Treat this as a measured latency/cost choice, not a promise that every request is warm.&lt;/p&gt;

&lt;h2&gt;
  
  
  Example: Proxy a Bounded Function Endpoint
&lt;/h2&gt;

&lt;p&gt;Apache APISIX 3.19.0's pinned &lt;a href="https://github.com/apache/apisix/blob/3.19.0/apisix/plugins/aws-lambda.lua" rel="noopener noreferrer"&gt;&lt;code&gt;aws-lambda&lt;/code&gt; plugin source&lt;/a&gt; uses the shared &lt;a href="https://github.com/apache/apisix/blob/3.19.0/apisix/plugins/serverless/generic-upstream.lua" rel="noopener noreferrer"&gt;&lt;code&gt;generic-upstream&lt;/code&gt; implementation&lt;/a&gt; to call a configured function URL or API endpoint. The following Route body is a runnable-shape example; replace the placeholder URI and configure cloud authentication through an approved secret path.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;"uri"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"/reports/preview"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"plugins"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;"aws-lambda"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nl"&gt;"function_uri"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"https://example-id.lambda-url.us-east-1.on.aws/preview"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="nl"&gt;"timeout"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;2500&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="nl"&gt;"max_req_body_size"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1048576&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="nl"&gt;"ssl_verify"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="nl"&gt;"keepalive"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="nl"&gt;"keepalive_timeout"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;60000&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="nl"&gt;"keepalive_pool"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;20&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The plugin buffers the request body up to &lt;code&gt;max_req_body_size&lt;/code&gt;; a body-read error, including an oversized body, returns HTTP 400. If the upstream request itself fails, the generic implementation returns HTTP 503. A function response with status 400 or above is passed through rather than automatically retried by this plugin path.&lt;/p&gt;

&lt;p&gt;Its behavior-changing Booleans are explicit:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Parameter&lt;/th&gt;
&lt;th&gt;Default&lt;/th&gt;
&lt;th&gt;
&lt;code&gt;true&lt;/code&gt; path&lt;/th&gt;
&lt;th&gt;
&lt;code&gt;false&lt;/code&gt; path and trust boundary&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;ssl_verify&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;true&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Verifies the TLS server certificate for &lt;code&gt;function_uri&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;Disables server-certificate verification; encryption alone no longer proves the intended endpoint identity&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;keepalive&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;true&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Reuses eligible upstream connections and applies pool/timeout settings&lt;/td&gt;
&lt;td&gt;Does not reuse the connection; pool settings do not apply&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The plugin source also preserves a caller-supplied &lt;code&gt;Authorization&lt;/code&gt; or &lt;code&gt;x-api-key&lt;/code&gt; header instead of overwriting it with configured cloud authorization. Strip or reject untrusted client cloud-credential headers before this plugin, or prove that passing them is the intended contract. Do not let the caller select &lt;code&gt;function_uri&lt;/code&gt;, region, or cloud service.&lt;/p&gt;

&lt;p&gt;This proxy path is still synchronous HTTP from APISIX's perspective. It does not by itself create a durable asynchronous operation.&lt;/p&gt;

&lt;h2&gt;
  
  
  Design a Durable Asynchronous Handoff
&lt;/h2&gt;

&lt;p&gt;A safe submission sequence is:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;authenticate the caller and map it to server-side policy;&lt;/li&gt;
&lt;li&gt;validate payload size, schema, and operation type;&lt;/li&gt;
&lt;li&gt;require or issue a stable idempotency key;&lt;/li&gt;
&lt;li&gt;create an operation record with a unique ID;&lt;/li&gt;
&lt;li&gt;durably enqueue the work and commit the accepted state;&lt;/li&gt;
&lt;li&gt;return &lt;code&gt;202 Accepted&lt;/code&gt; with the operation ID and status URL;&lt;/li&gt;
&lt;li&gt;process the message idempotently;&lt;/li&gt;
&lt;li&gt;write a terminal success or failure state;&lt;/li&gt;
&lt;li&gt;expire payload and status data under a documented retention policy.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;If operation creation and queue publication cannot be atomic, use a transactional outbox or another recovery design. Do not return &lt;code&gt;202&lt;/code&gt; after merely starting an in-memory task.&lt;/p&gt;

&lt;p&gt;Example response:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight http"&gt;&lt;code&gt;&lt;span class="no"&gt;HTTP&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="mf"&gt;1.1&lt;/span&gt; &lt;span class="mi"&gt;202&lt;/span&gt; &lt;span class="nc"&gt;Accepted&lt;/span&gt;
&lt;span class="nc"&gt;Content&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nc"&gt;Type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;application&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;json&lt;/span&gt;
&lt;span class="nc"&gt;Location&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;operations&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;op_01JEXAMPLE&lt;/span&gt;
&lt;span class="nc"&gt;Retry&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nc"&gt;After&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;

&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"operation_id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"op_01JEXAMPLE"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="s2"&gt;"status"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"accepted"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;accepted&lt;/code&gt; means the platform durably accepted responsibility under the stated retention and retry contract. It does not mean the function ran or the business action succeeded.&lt;/p&gt;

&lt;h2&gt;
  
  
  Make Idempotency an Application Invariant
&lt;/h2&gt;

&lt;p&gt;An idempotency key is useful only when the application binds it to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;authenticated caller or tenant;&lt;/li&gt;
&lt;li&gt;operation type and canonical request fingerprint;&lt;/li&gt;
&lt;li&gt;stored result or terminal state;&lt;/li&gt;
&lt;li&gt;retention window;&lt;/li&gt;
&lt;li&gt;conflict behavior when the same key carries a different payload.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The gateway may validate presence and format, but the state-changing service must atomically enforce the key with the business transition. A caller-supplied key is a correlation value, not trusted identity. Namespace it with authenticated context.&lt;/p&gt;

&lt;p&gt;For a duplicate request, return the original operation or result when the fingerprint matches. Return a conflict when the same key is reused for different work. Test concurrent duplicates, not only sequential retries.&lt;/p&gt;

&lt;h2&gt;
  
  
  Understand Cloud Retry Semantics
&lt;/h2&gt;

&lt;p&gt;For AWS Lambda Event Functions, &lt;a href="https://docs.aws.amazon.com/lambda/latest/dg/invocation-async.html" rel="noopener noreferrer"&gt;asynchronous invocation&lt;/a&gt; queues the event and returns &lt;code&gt;202&lt;/code&gt; when Lambda accepts it. AWS documents that function errors are retried twice by default, while throttling and system errors may be retried for up to six hours by default. The queue is eventually consistent, so duplicate delivery is possible even without a function error.&lt;/p&gt;

&lt;p&gt;These are Lambda service semantics, not APISIX plugin enforcement. Configure maximum event age, retries, and an on-failure destination or dead-letter path for the selected function. Keep the handler idempotent even when retries are reduced.&lt;/p&gt;

&lt;h2&gt;
  
  
  Handle Synchronous Unknown Outcomes
&lt;/h2&gt;

&lt;p&gt;When the gateway times out, ask whether the function could still be running or could have committed a side effect. If yes, the result is ambiguous. Do not automatically replay a payment, message, or provisioning request without an idempotency invariant and status lookup.&lt;/p&gt;

&lt;p&gt;Return an operation identifier early when the workflow can outlive the connection. For genuinely synchronous operations, keep the total retry budget inside the client deadline and retry only when the method and application semantics permit it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Observe Every Stage
&lt;/h2&gt;

&lt;p&gt;Track separately:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;gateway admits, rejects, timeouts, and upstream statuses;&lt;/li&gt;
&lt;li&gt;submission acceptance and enqueue latency;&lt;/li&gt;
&lt;li&gt;queue age, backlog, redelivery, and expiry;&lt;/li&gt;
&lt;li&gt;cold/warm initialization and function duration;&lt;/li&gt;
&lt;li&gt;concurrency throttling and provider errors;&lt;/li&gt;
&lt;li&gt;idempotency hits, conflicts, and duplicate suppression;&lt;/li&gt;
&lt;li&gt;business success, failure, and ambiguous state;&lt;/li&gt;
&lt;li&gt;callback attempts and terminal delivery.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Use bounded labels such as API, operation type, function alias, environment, and terminal status. Keep request IDs, user IDs, and idempotency keys out of Prometheus labels; store them in access-controlled logs or traces when policy permits.&lt;/p&gt;

&lt;h2&gt;
  
  
  Serverless API Checklist
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Is the API explicitly synchronous, asynchronous, event-based, or callback-based?&lt;/li&gt;
&lt;li&gt;Does the total synchronous deadline include cold startup and recovery margin?&lt;/li&gt;
&lt;li&gt;Can a timeout occur after side effects begin, and how is that ambiguity resolved?&lt;/li&gt;
&lt;li&gt;Is durable handoff complete before returning &lt;code&gt;202 Accepted&lt;/code&gt;?&lt;/li&gt;
&lt;li&gt;Is the idempotency key namespaced by authenticated identity and request fingerprint?&lt;/li&gt;
&lt;li&gt;Are queue retries, duplicate delivery, expiry, and terminal failure configured and tested?&lt;/li&gt;
&lt;li&gt;Are &lt;code&gt;ssl_verify&lt;/code&gt; and &lt;code&gt;keepalive&lt;/code&gt; defaults and both paths documented?&lt;/li&gt;
&lt;li&gt;Are untrusted client cloud-authorization headers stripped or intentionally accepted?&lt;/li&gt;
&lt;li&gt;Can operators correlate gateway, queue, function, and business outcomes?&lt;/li&gt;
&lt;li&gt;Does rollback preserve compatible function aliases, event schemas, credentials, and status records?&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  FAQ
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Can an API gateway eliminate Lambda cold starts?
&lt;/h3&gt;

&lt;p&gt;No. It can keep upstream connections warm and route to a prepared alias, but execution-environment readiness belongs to the serverless platform and function configuration.&lt;/p&gt;

&lt;h3&gt;
  
  
  Does &lt;code&gt;202 Accepted&lt;/code&gt; mean the function succeeded?
&lt;/h3&gt;

&lt;p&gt;No. It means the chosen submission boundary accepted the work. Provide a status contract and terminal failure path.&lt;/p&gt;

&lt;h3&gt;
  
  
  Is an idempotency header enough to prevent duplicate effects?
&lt;/h3&gt;

&lt;p&gt;No. The application must atomically bind the key to authenticated context, request meaning, and the business state transition.&lt;/p&gt;

&lt;h2&gt;
  
  
  Next Steps
&lt;/h2&gt;

&lt;p&gt;Apply &lt;a href="https://api7.ai/learning-center/api-gateway-guide/api-gateway-timeouts-retries" rel="noopener noreferrer"&gt;safe timeout and retry policy&lt;/a&gt;, design &lt;a href="https://api7.ai/learning-center/api-gateway-guide/asynchronous-api-gateway-patterns" rel="noopener noreferrer"&gt;asynchronous gateway patterns&lt;/a&gt;, and deliver changes through &lt;a href="https://api7.ai/learning-center/api-gateway-guide/api-gateway-change-management-rollback" rel="noopener noreferrer"&gt;gateway change management&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://api7.ai/learning-center/api-gateway-guide/operating-serverless-apis-gateway" rel="noopener noreferrer"&gt;Read the original on API7.ai&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>serverless</category>
      <category>architecture</category>
      <category>aws</category>
    </item>
    <item>
      <title>How to Differential-Test LLM Routing Changes</title>
      <dc:creator>Yilia</dc:creator>
      <pubDate>Thu, 19 Nov 2026 10:02:42 +0000</pubDate>
      <link>https://dev.to/api7/how-to-differential-test-llm-routing-changes-39mb</link>
      <guid>https://dev.to/api7/how-to-differential-test-llm-routing-changes-39mb</guid>
      <description>&lt;p&gt;An LLM router can return the same final &lt;code&gt;200&lt;/code&gt; response after making a very different decision. It may choose another deployment, add a retry, cross a provider boundary, consume a fallback, or start a stream before a later failure. A status-code comparison will miss those regressions.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Differential testing&lt;/strong&gt; runs the same case against a reference router and a candidate router, normalizes their observable results, and compares the behaviors that must remain stable. It is especially useful for a rewrite, version upgrade, configuration migration, or policy refactor whose stated goal is “change the implementation without changing the caller contract.”&lt;/p&gt;

&lt;p&gt;LiteLLM described this approach in its November 11, 2026 account of &lt;a href="https://docs.litellm.ai/blog/router-rust" rel="noopener noreferrer"&gt;moving routing to a Rust core&lt;/a&gt;: each behavior-preserving step received a differential test, and the comparison included more than the selected deployment. This article turns that engineering idea into a gateway-operator acceptance pack that works with any router whose decisions and upstream attempts can be observed.&lt;/p&gt;

&lt;h2&gt;
  
  
  Define “Same Behavior” Before You Run Traffic
&lt;/h2&gt;

&lt;p&gt;The old and new routers do not need identical internal data structures or log text. They need equivalent outcomes in the dimensions your applications and operators depend on.&lt;/p&gt;

&lt;p&gt;Start with a contract table:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Dimension&lt;/th&gt;
&lt;th&gt;Compare when&lt;/th&gt;
&lt;th&gt;Example normalized value&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Caller status&lt;/td&gt;
&lt;td&gt;Every case&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;200&lt;/code&gt;, &lt;code&gt;429&lt;/code&gt;, &lt;code&gt;502&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Caller-visible model or route&lt;/td&gt;
&lt;td&gt;The API exposes one&lt;/td&gt;
&lt;td&gt;&lt;code&gt;chat-prod&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Selected target&lt;/td&gt;
&lt;td&gt;Routing choice matters&lt;/td&gt;
&lt;td&gt;&lt;code&gt;primary-us&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Attempt sequence&lt;/td&gt;
&lt;td&gt;Retry or fallback is enabled&lt;/td&gt;
&lt;td&gt;&lt;code&gt;primary-us, primary-us, backup-eu&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Terminal stream state&lt;/td&gt;
&lt;td&gt;The response streams&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;complete&lt;/code&gt;, &lt;code&gt;upstream_break&lt;/code&gt;, &lt;code&gt;client_cancel&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Upstream request shape&lt;/td&gt;
&lt;td&gt;Translation or passthrough may change&lt;/td&gt;
&lt;td&gt;normalized method, path, headers, and body fields&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Policy result&lt;/td&gt;
&lt;td&gt;Identity, budget, or guardrail applies&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;allowed&lt;/code&gt;, &lt;code&gt;rate_limited&lt;/code&gt;, &lt;code&gt;blocked&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Side effects&lt;/td&gt;
&lt;td&gt;The router writes cooldown, spend, or session state&lt;/td&gt;
&lt;td&gt;normalized state delta&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Latency and cost&lt;/td&gt;
&lt;td&gt;Only for a separately designed benchmark&lt;/td&gt;
&lt;td&gt;distribution and method, not one exact value&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Do not put latency or cost into an equality oracle unless the experiment controls provider, model, cache, concurrency, geography, and pricing. A differential contract test is not automatically a performance benchmark.&lt;/p&gt;

&lt;h2&gt;
  
  
  Use Four Pieces: World, Case, Channels, Oracle
&lt;/h2&gt;

&lt;p&gt;A useful test harness has four explicit pieces:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;World:&lt;/strong&gt; the starting configuration and dependencies—deployments, aliases, health state, cooldowns, Redis rows, credentials, and mock upstream behavior.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Case:&lt;/strong&gt; one ordered sequence of client requests and upstream responses.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Channels:&lt;/strong&gt; the places where behavior is observed—client response, gateway access log, upstream capture, database or Redis state, and usage ledger.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Oracle:&lt;/strong&gt; the rule that decides whether normalized reference and candidate results are equivalent.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This vocabulary helps prevent a common mistake: comparing only the channel that is easiest to collect. If the final client response matches but the candidate sends three upstream attempts instead of one, the caller channel passes while the attempt and cost channels fail.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fnbk8efd4em70mpgs1wu1.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fnbk8efd4em70mpgs1wu1.webp" alt="Pinned fixtures run through reference and candidate routers. Their client response, attempt sequence, selected target, policy result, and state changes are normalized before an oracle compares them. A negative example shows both routers returning 200 from the backup while the candidate makes an extra primary attempt, which is a regression." width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Pin Both Sides of the Comparison
&lt;/h2&gt;

&lt;p&gt;Record exact artifacts before collecting a result:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;reference gateway image, tag, or commit;&lt;/li&gt;
&lt;li&gt;candidate gateway image, tag, or commit;&lt;/li&gt;
&lt;li&gt;configuration and secret revision hashes;&lt;/li&gt;
&lt;li&gt;test-harness commit;&lt;/li&gt;
&lt;li&gt;mock-upstream version and scenario file;&lt;/li&gt;
&lt;li&gt;database and cache seed;&lt;/li&gt;
&lt;li&gt;client protocol and streaming mode.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For AISIX, also record whether the alias is a direct model, multi-target model, or semantic router, and whether the deployment is standalone or managed. Pin the reference and candidate environments to explicit releases or build identifiers, because retry, fallback, session-affinity, and telemetry behavior can change between versions.&lt;/p&gt;

&lt;p&gt;Do not compare “old production” with “whatever main does today.” A difference without pinned inputs is not reproducible.&lt;/p&gt;

&lt;h2&gt;
  
  
  Build the Minimum Case Matrix
&lt;/h2&gt;

&lt;p&gt;Cover the branch points that can change a decision, not merely a list of successful prompts.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Case&lt;/th&gt;
&lt;th&gt;Upstream behavior&lt;/th&gt;
&lt;th&gt;What the oracle should inspect&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Primary success&lt;/td&gt;
&lt;td&gt;First target returns a valid success&lt;/td&gt;
&lt;td&gt;Selected target, one attempt, caller contract&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Retryable &lt;code&gt;5xx&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;First attempt returns &lt;code&gt;503&lt;/code&gt;, next succeeds&lt;/td&gt;
&lt;td&gt;Same-target retry count, fallback boundary, final status&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Upstream &lt;code&gt;429&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;Target returns a rate limit&lt;/td&gt;
&lt;td&gt;Behavior with &lt;code&gt;retry_on_429&lt;/code&gt; off and on&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Non-retryable &lt;code&gt;4xx&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;Target returns &lt;code&gt;400&lt;/code&gt; or &lt;code&gt;401&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;Error returned without spraying invalid traffic to more targets&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Connect failure&lt;/td&gt;
&lt;td&gt;Connection fails before response&lt;/td&gt;
&lt;td&gt;Retry and fallback sequence&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;First-byte timeout&lt;/td&gt;
&lt;td&gt;Stream has not committed bytes&lt;/td&gt;
&lt;td&gt;Whether another eligible target can be attempted&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Mid-stream break&lt;/td&gt;
&lt;td&gt;Bytes have already reached the caller&lt;/td&gt;
&lt;td&gt;Terminal stream state; no claim of transparent failover after delivery&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;All targets unavailable&lt;/td&gt;
&lt;td&gt;Health or policy removes every target&lt;/td&gt;
&lt;td&gt;Configured &lt;code&gt;503&lt;/code&gt; or documented try-anyway behavior&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Caller not authorized&lt;/td&gt;
&lt;td&gt;Caller cannot use the alias or target&lt;/td&gt;
&lt;td&gt;Denial before upstream dispatch&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Cooldown transition&lt;/td&gt;
&lt;td&gt;Repeated failure crosses a health threshold&lt;/td&gt;
&lt;td&gt;State delta and next-request selection&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Alias or wildcard edge&lt;/td&gt;
&lt;td&gt;Requested name resolves indirectly&lt;/td&gt;
&lt;td&gt;Resolved target and caller-visible name&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Empty or unusual input&lt;/td&gt;
&lt;td&gt;Empty string, long value, Unicode, or missing field&lt;/td&gt;
&lt;td&gt;Validation and stable error contract&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Add cases for every custom policy: region tags, team overrides, price-based ranking, sticky assignment, semantic routes, provider-specific headers, or session state.&lt;/p&gt;

&lt;p&gt;AISIX documents streaming retry boundaries that should become separate cases rather than one generic “streaming” row. In current routing documentation, a streaming request can move to another target before response bytes are committed but does not fail over after a stream has started. Verify the exact endpoint and version you operate.&lt;/p&gt;

&lt;h2&gt;
  
  
  Normalize Before Comparing
&lt;/h2&gt;

&lt;p&gt;Raw observations contain noise: request IDs, timestamps, generated response IDs, host ports, log order, and floating-point durations. Strip only fields that the contract declares irrelevant.&lt;/p&gt;

&lt;p&gt;Keep values that reveal a semantic change:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;selected target and attempt order;&lt;/li&gt;
&lt;li&gt;status and structured error code;&lt;/li&gt;
&lt;li&gt;streamed terminal outcome;&lt;/li&gt;
&lt;li&gt;upstream method, path, model, tool fields, and material headers;&lt;/li&gt;
&lt;li&gt;policy decision and authenticated caller scope;&lt;/li&gt;
&lt;li&gt;cooldown, spend, or session-state changes.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Never normalize away a difference merely because it makes the test fail. If a generated ID is irrelevant, write that rule before viewing the candidate result.&lt;/p&gt;

&lt;h2&gt;
  
  
  Run a Small, Auditable Comparator
&lt;/h2&gt;

&lt;p&gt;The script below compares normalized JSON Lines produced by two test runs. Each line must contain a stable &lt;code&gt;case_id&lt;/code&gt;. It ignores no fields by default; pass &lt;code&gt;--ignore&lt;/code&gt; only for fields already classified as noise.&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;```python title="compare_routes.py"&lt;/p&gt;

&lt;h1&gt;
  
  
  !/usr/bin/env python3
&lt;/h1&gt;

&lt;p&gt;import argparse&lt;br&gt;
import json&lt;br&gt;
import sys&lt;br&gt;
from pathlib import Path&lt;/p&gt;

&lt;p&gt;def load(path: Path):&lt;br&gt;
    rows = {}&lt;br&gt;
    for number, line in enumerate(path.read_text().splitlines(), 1):&lt;br&gt;
        if not line.strip():&lt;br&gt;
            continue&lt;br&gt;
        row = json.loads(line)&lt;br&gt;
        case_id = row.pop("case_id", None)&lt;br&gt;
        if not case_id:&lt;br&gt;
            raise ValueError(f"{path}:{number}: missing case_id")&lt;br&gt;
        if case_id in rows:&lt;br&gt;
            raise ValueError(f"{path}:{number}: duplicate case_id {case_id}")&lt;br&gt;
        rows[case_id] = row&lt;br&gt;
    return rows&lt;/p&gt;

&lt;p&gt;def remove_path(value, dotted_path):&lt;br&gt;
    parts = dotted_path.split(".")&lt;br&gt;
    cursor = value&lt;br&gt;
    for part in parts[:-1]:&lt;br&gt;
        if not isinstance(cursor, dict) or part not in cursor:&lt;br&gt;
            return&lt;br&gt;
        cursor = cursor[part]&lt;br&gt;
    if isinstance(cursor, dict):&lt;br&gt;
        cursor.pop(parts[-1], None)&lt;/p&gt;

&lt;p&gt;def main():&lt;br&gt;
    parser = argparse.ArgumentParser()&lt;br&gt;
    parser.add_argument("reference", type=Path)&lt;br&gt;
    parser.add_argument("candidate", type=Path)&lt;br&gt;
    parser.add_argument("--ignore", action="append", default=[])&lt;br&gt;
    args = parser.parse_args()&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;reference = load(args.reference)
candidate = load(args.candidate)
failed = False

for case_id in sorted(reference.keys() | candidate.keys()):
    if case_id not in reference:
        print(f"EXTRA candidate case: {case_id}")
        failed = True
        continue
    if case_id not in candidate:
        print(f"MISSING candidate case: {case_id}")
        failed = True
        continue

    left = reference[case_id]
    right = candidate[case_id]
    for path in args.ignore:
        remove_path(left, path)
        remove_path(right, path)

    if left != right:
        failed = True
        print(f"DIFF {case_id}")
        print("  reference:", json.dumps(left, sort_keys=True))
        print("  candidate:", json.dumps(right, sort_keys=True))

if failed:
    return 1
print(f"PASS: {len(reference)} cases are equivalent")
return 0
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;p&gt;if &lt;strong&gt;name&lt;/strong&gt; == "&lt;strong&gt;main&lt;/strong&gt;":&lt;br&gt;
    sys.exit(main())&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;


Create a passing reference:



```json title="reference.jsonl"
{"case_id":"primary-200","status":200,"attempts":["primary"],"target":"primary","terminal":"complete"}
{"case_id":"primary-503-fallback","status":200,"attempts":["primary","backup"],"target":"backup","terminal":"complete"}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Then introduce a candidate regression:&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;```json title="candidate.jsonl"&lt;br&gt;
{"case_id":"primary-200","status":200,"attempts":["primary"],"target":"primary","terminal":"complete"}&lt;br&gt;
{"case_id":"primary-503-fallback","status":200,"attempts":["primary","primary","backup"],"target":"backup","terminal":"complete"}&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;


Run the comparison:



```shell
python3 compare_routes.py reference.jsonl candidate.jsonl
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The command exits &lt;code&gt;1&lt;/code&gt; and reports the extra primary attempt. That difference matters even though the final status and target match. After correcting the candidate fixture to use the valid JSON array &lt;code&gt;["primary", "backup"]&lt;/code&gt;, the command exits &lt;code&gt;0&lt;/code&gt; and prints &lt;code&gt;PASS: 2 cases are equivalent&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The comparator has intentionally narrow scope. It verifies the normalized artifacts you provide; it does not collect gateway traffic, decide which fields matter, or prove model quality.&lt;/p&gt;

&lt;h2&gt;
  
  
  Collect Multiple Channels Without Confusing Them
&lt;/h2&gt;

&lt;p&gt;For each case, collect evidence at the point where it is authoritative:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Client:&lt;/strong&gt; final HTTP status, headers, response shape, stream frames, and terminal error.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Gateway:&lt;/strong&gt; authenticated caller, resolved alias, selected route, fallback reason, served target, and policy decision.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Upstream fixture:&lt;/strong&gt; every request received, arrival order, body, material headers, and programmed response.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;State store:&lt;/strong&gt; cooldowns, session pins, rate-limit counters, or other expected changes.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Usage ledger:&lt;/strong&gt; request and attempt accounting, but only after defining what one row represents.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In AISIX 1.10.0, &lt;code&gt;x-aisix-served-by&lt;/code&gt; is a debug header that requires &lt;code&gt;proxy.expose_debug_headers: true&lt;/code&gt;, which is off by default and read at startup. Even when enabled, it appears only on qualifying successful &lt;code&gt;/v1/chat/completions&lt;/code&gt; routing responses, not as a universal response field. Use &lt;code&gt;x-aisix-request-id&lt;/code&gt; to correlate the request with the access log's &lt;code&gt;served_by_model&lt;/code&gt;, or use the mock upstream capture, as the default serving-target oracle.&lt;/p&gt;

&lt;h2&gt;
  
  
  Separate Equivalence from Intentional Change
&lt;/h2&gt;

&lt;p&gt;An upgrade may contain both behavior-preserving work and deliberate product changes. Label each case:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;must_match&lt;/code&gt;: any difference is a regression;&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;expected_change&lt;/code&gt;: reference and candidate should differ in a predeclared way;&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;informational&lt;/code&gt;: record the result but do not gate the rollout yet.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For an expected change, write a directional oracle. If the candidate is supposed to stop retrying authentication errors, the test should require one &lt;code&gt;401&lt;/code&gt; attempt and no fallback, not merely allow any difference.&lt;/p&gt;

&lt;p&gt;Keep the old implementation as a reference only while it represents the desired contract. Differential testing can preserve an existing bug perfectly. Pair equivalence with specification tests for behavior that is meant to be correct.&lt;/p&gt;

&lt;h2&gt;
  
  
  Add Noise Detection
&lt;/h2&gt;

&lt;p&gt;Run the reference against itself twice before trusting a reference-versus-candidate difference. If two identical builds disagree, the case is nondeterministic or the normalizer is incomplete.&lt;/p&gt;

&lt;p&gt;Common sources of noise include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;weighted or random selection without a fixed seed;&lt;/li&gt;
&lt;li&gt;shared cooldown or rate-limit state from another case;&lt;/li&gt;
&lt;li&gt;unordered asynchronous logs;&lt;/li&gt;
&lt;li&gt;real provider responses;&lt;/li&gt;
&lt;li&gt;wall-clock TTLs and backoff;&lt;/li&gt;
&lt;li&gt;retries performed by the client SDK rather than the gateway.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Use isolated state, deterministic mock upstreams, fixed clocks or bounded time assertions, and one owner for retries. If randomness is the contract, compare distributions in a separate statistical test instead of forcing one request to match.&lt;/p&gt;

&lt;h2&gt;
  
  
  Roll Out with a Bounded Shadow
&lt;/h2&gt;

&lt;p&gt;After deterministic cases pass, replay a permitted, sanitized sample of representative request shapes through the candidate in a non-serving path. Do not duplicate sensitive prompts or side-effecting tool calls without explicit authorization and controls.&lt;/p&gt;

&lt;p&gt;Compare normalized routing decisions and upstream request shapes. Keep candidate responses away from users until the mismatch classes are understood. A shadow run is evidence about the sampled workload, not proof that every production edge case is covered.&lt;/p&gt;

&lt;h2&gt;
  
  
  Acceptance Checklist
&lt;/h2&gt;

&lt;p&gt;Before switching routers or configurations, require all of the following:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;reference and candidate versions are pinned;&lt;/li&gt;
&lt;li&gt;the behavior contract names caller, attempt, stream, policy, and side-effect dimensions;&lt;/li&gt;
&lt;li&gt;every retry and fallback branch has a deterministic case;&lt;/li&gt;
&lt;li&gt;streaming tests distinguish before-first-byte and after-delivery failure;&lt;/li&gt;
&lt;li&gt;unauthorized and malformed requests prove no upstream dispatch;&lt;/li&gt;
&lt;li&gt;the reference-versus-reference run is stable;&lt;/li&gt;
&lt;li&gt;expected changes use directional assertions;&lt;/li&gt;
&lt;li&gt;mismatches have an owner and disposition;&lt;/li&gt;
&lt;li&gt;no result is presented as a cost, latency, or quality benchmark unless that separate method was run;&lt;/li&gt;
&lt;li&gt;rollback restores both router implementation and compatible state/configuration.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Differential testing is valuable because it makes “behavior-preserving” falsifiable. For an LLM gateway, the observable behavior is larger than the final response: target choice, attempts, policy, streaming terminal state, and side effects are all part of the contract. Capture them explicitly before a router rewrite, upgrade, or configuration migration reaches production.&lt;/p&gt;

&lt;p&gt;For an AISIX rollout, start with the current &lt;a href="https://docs.api7.ai/ai-gateway/routing/routing-and-failover" rel="noopener noreferrer"&gt;Routing and Failover documentation&lt;/a&gt; and adapt the matrix to the exact endpoint, strategy, and version you operate.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>testing</category>
      <category>devops</category>
      <category>api</category>
    </item>
    <item>
      <title>Short Links Are Redirect APIs: Design Them for Safe Retirement</title>
      <dc:creator>Yilia</dc:creator>
      <pubDate>Wed, 18 Nov 2026 10:07:02 +0000</pubDate>
      <link>https://dev.to/yilialinn/short-links-are-redirect-apis-design-them-for-safe-retirement-5h8j</link>
      <guid>https://dev.to/yilialinn/short-links-are-redirect-apis-design-them-for-safe-retirement-5h8j</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fkxxzxl3y2lwp3blkm5d0.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fkxxzxl3y2lwp3blkm5d0.webp" alt="Short Links Are Redirect APIs: Design Them for Safe Retirement" width="800" height="420"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Originally published by Yilia Lin on &lt;a href="https://api7.ai/blog/short-link-redirect-security" rel="noopener noreferrer"&gt;API7.ai&lt;/a&gt; on 2026-11-17.&lt;/p&gt;

&lt;p&gt;This republication was prepared with AI assistance. The original article’s drafting process has not been verified.&lt;/p&gt;

&lt;p&gt;A short URL looks like a piece of marketing copy. Operationally, it is a public API that accepts an identifier and returns a routing decision. That decision may keep executing from old social posts, QR codes, emails, documentation, and printed material long after the campaign owner has moved on.&lt;/p&gt;

&lt;p&gt;The risk became visible again on November 15, 2026. A &lt;a href="https://ransomnews.com/burger-king-tweet-bitly-link-hijack-2026/" rel="noopener noreferrer"&gt;report about old Bitly links&lt;/a&gt; said inactive aliases from old public posts had been recreated and pointed elsewhere; Bitly's response, quoted in the report, said an issue had allowed bad actors to repurpose certain old inactive links. The story drew a large &lt;a href="https://news.ycombinator.com/item?id=50511395" rel="noopener noreferrer"&gt;Hacker News discussion&lt;/a&gt; about outsourced namespaces and long-lived links.&lt;/p&gt;

&lt;p&gt;The durable lesson is not that every shortener is unsafe. It is that a redirect has an owner, a namespace, a destination, HTTP semantics, and a retirement state. If any of those can change without the publisher's control, the link remains an active dependency even when the campaign is “finished.”&lt;/p&gt;

&lt;h2&gt;
  
  
  Key Takeaways
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Treat each short link as a versioned routing record with an owner and review date.&lt;/li&gt;
&lt;li&gt;Prefer a first-party domain so the organization retains namespace control if vendors change.&lt;/li&gt;
&lt;li&gt;Validate destinations against policy; never accept an arbitrary client-supplied redirect target.&lt;/li&gt;
&lt;li&gt;Choose 301, 302, 307, or 308 from method and permanence semantics, not habit.&lt;/li&gt;
&lt;li&gt;Retire old aliases into non-reusable tombstones and monitor them before and after retirement.&lt;/li&gt;
&lt;li&gt;A gateway can enforce redirects on a domain you control; it cannot recover ownership of an external alias.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  A Redirect Has More State Than &lt;code&gt;source → destination&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;The minimal record has two URLs. A production redirect needs more:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Field&lt;/th&gt;
&lt;th&gt;Why it matters&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Public alias&lt;/td&gt;
&lt;td&gt;The durable identifier already embedded in other media&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Owner&lt;/td&gt;
&lt;td&gt;The team accountable for destination changes and retirement&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Allowed destination&lt;/td&gt;
&lt;td&gt;The approved scheme, host, path, and query policy&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Status code&lt;/td&gt;
&lt;td&gt;Whether the move is permanent and whether the method can change&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Created and reviewed dates&lt;/td&gt;
&lt;td&gt;Evidence that the record still has an active purpose&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Expiry and tombstone state&lt;/td&gt;
&lt;td&gt;What happens after the campaign ends&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Change record&lt;/td&gt;
&lt;td&gt;Who changed the target, when, and through which workflow&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;This turns a shortener from a bag of strings into a small API product. The public alias is its contract. The redirect service is its runtime. Analytics and change logs are its operational evidence.&lt;/p&gt;

&lt;p&gt;The lifecycle also differs from a normal content page. Deleting a page usually produces a visible 404. Releasing a short alias for reuse can silently preserve the trusted appearance of the old publisher while changing the destination. A safer retirement state is a tombstone that continues to reserve the alias and returns a controlled response.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmermaid.ink%2Fimg%2Fpako%3AeNplkLFuwzAMRH-F0NwADZCpQ4FMWQokMLq5GRTpCguQxYBi7CHOv0ey3SzlRPLekQTvxrGH-SDzG3l0nRWlr-YnUYnT7RJD7uDbV0Y2BpvPtNl80t5pGNDur1fhoUgCHwROz4t7kWeywRAwtscxQQpWixValApNWUOMlAAPP63uf5BAy46Jvrm_ZOWEtkGG1PX611pHv5D5hENld9t3YiHHSYVjLKbEGlx1mDcyPaS3wZdn3I126Oe3JNxUbDSPxxM36mbv%3Ftype%3Dpng%26bgColor%3D%21white" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmermaid.ink%2Fimg%2Fpako%3AeNplkLFuwzAMRH-F0NwADZCpQ4FMWQokMLq5GRTpCguQxYBi7CHOv0ey3SzlRPLekQTvxrGH-SDzG3l0nRWlr-YnUYnT7RJD7uDbV0Y2BpvPtNl80t5pGNDur1fhoUgCHwROz4t7kWeywRAwtscxQQpWixValApNWUOMlAAPP63uf5BAy46Jvrm_ZOWEtkGG1PX611pHv5D5hENld9t3YiHHSYVjLKbEGlx1mDcyPaS3wZdn3I126Oe3JNxUbDSPxxM36mbv%3Ftype%3Dpng%26bgColor%3D%21white" alt="Lifecycle of a short link from publication to reserved tombstone" width="1133" height="88"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The diagram is a policy model, not a claim that every shortener implements those states.&lt;/p&gt;

&lt;h2&gt;
  
  
  Own the Namespace, Even If a Vendor Runs the Service
&lt;/h2&gt;

&lt;p&gt;A first-party hostname such as &lt;code&gt;go.example.com&lt;/code&gt; does not require an organization to build every analytics and redirect component. It makes the domain and public namespace an organizational asset. DNS can later point that hostname to a different managed service or an internal implementation while the published aliases remain stable.&lt;/p&gt;

&lt;p&gt;Ownership still needs operational controls. Protect the domain registration, DNS account, shortener administration, and deployment pipeline with separate identities and audit logs. Keep an export of redirect records in a recoverable format. Test restoration without assuming the vendor will remain available during an incident.&lt;/p&gt;

&lt;p&gt;A first-party name can still be taken over through a dangling provider binding. If a CNAME continues to point at a managed shortener after the organization releases that hostname from its vendor account, another tenant may be able to claim the abandoned mapping. Microsoft documents this general &lt;a href="https://learn.microsoft.com/en-us/azure/security/fundamentals/subdomain-takeover" rel="noopener noreferrer"&gt;dangling DNS and subdomain-takeover pattern&lt;/a&gt; for deprovisioned cloud resources. During migration or shutdown, keep the old vendor binding until DNS has been switched or removed and its TTL has elapsed. Then verify that the hostname no longer reaches the old provider and that the former mapping cannot be reclaimed before releasing the account-side resource.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F8qhas7opysziszb9e79y.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F8qhas7opysziszb9e79y.webp" alt="Published QR codes, emails, documentation, and printed media point to the owned hostname go.example.com. DNS control lets the organization move the same public alias from redirect service A to service B while retaining the old binding until caches expire." width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For high-value or long-lived links, publish the first-party URL directly. A chain such as first-party short domain → vendor alias → destination adds another mutable dependency and another place where analytics parameters, methods, or query strings can change.&lt;/p&gt;

&lt;p&gt;This is an extension of &lt;a href="https://api7.ai/blog/api-lifecycle-management" rel="noopener noreferrer"&gt;API lifecycle management&lt;/a&gt;: inventory, ownership, versioning, monitoring, and retirement apply to routing records as much as to JSON endpoints.&lt;/p&gt;

&lt;h2&gt;
  
  
  Validate Destinations as Configuration
&lt;/h2&gt;

&lt;p&gt;An open redirect accepts a destination from untrusted input and sends the client there. Attackers use that trusted origin to make phishing and authorization flows look legitimate. The &lt;a href="https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html" rel="noopener noreferrer"&gt;OWASP Unvalidated Redirects and Forwards Cheat Sheet&lt;/a&gt; recommends avoiding user-controlled redirect targets or mapping an identifier to a server-side allowlist.&lt;/p&gt;

&lt;p&gt;Apply the same idea to short-link administration:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Accept destination changes only through an authenticated management path.&lt;/li&gt;
&lt;li&gt;Normalize and parse the URL before policy evaluation; do not rely on prefix string matching.&lt;/li&gt;
&lt;li&gt;Allow &lt;code&gt;https&lt;/code&gt; and approved hosts by default, with a documented exception process.&lt;/li&gt;
&lt;li&gt;Decide whether fragments, credentials, internationalized hostnames, and query parameters are allowed.&lt;/li&gt;
&lt;li&gt;Reject destinations that resolve to internal, loopback, or link-local addresses unless a specific use case requires them; separately reject unexpected URL schemes.&lt;/li&gt;
&lt;li&gt;Show the normalized destination to a reviewer before activation.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Destination validation reduces configuration abuse. It does not prove the destination's content will remain benign. Monitor DNS ownership, certificate changes, reputation signals, and unexpected redirect chains for important targets.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fb68put0mra2fc9i53mx7.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fb68put0mra2fc9i53mx7.webp" alt="An authenticated destination change is normalized, checked against scheme, host, address, and query policy, and reviewed before activation. A failed policy check is rejected without writing the redirect record." width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Pick Redirect Semantics Deliberately
&lt;/h2&gt;

&lt;p&gt;Redirect status codes are not interchangeable. &lt;a href="https://www.rfc-editor.org/rfc/rfc9110.html#section-15.4" rel="noopener noreferrer"&gt;RFC 9110&lt;/a&gt; distinguishes temporary from permanent redirects and explains the historical method behavior. User agents may change POST to GET after 301 or 302. Codes 307 and 308 preserve the request method, with 307 temporary and 308 permanent.&lt;/p&gt;

&lt;p&gt;Most marketing links are GET requests, but a generic redirect service can also receive API callbacks or form submissions. A method-preserving redirect can resend a request body and credentials to the new target. A method-changing redirect can break a client workflow. Therefore, constrain redirect routes to expected methods and select the code with the caller contract in mind.&lt;/p&gt;

&lt;p&gt;In Apache APISIX 3.19, the &lt;a href="https://apisix.apache.org/docs/apisix/3.19/plugins/redirect/" rel="noopener noreferrer"&gt;&lt;code&gt;redirect&lt;/code&gt; plugin&lt;/a&gt; defaults &lt;code&gt;ret_code&lt;/code&gt; to 302 for custom &lt;code&gt;uri&lt;/code&gt; and &lt;code&gt;regex_uri&lt;/code&gt; destinations. The separate &lt;code&gt;http_to_https&lt;/code&gt; mode redirects GET and HEAD with 301 and other methods with 308 when APISIX considers the request to be HTTP; an HTTPS request is not redirected. For a request arriving through a TLS-terminating proxy, APISIX preserves inbound &lt;code&gt;X-Forwarded-Proto&lt;/code&gt; only from addresses configured in &lt;code&gt;apisix.trusted_addresses&lt;/code&gt;; otherwise it overwrites the header with the scheme it observes. That trust boundary must be correct to avoid treating a forwarded HTTPS request as HTTP.&lt;/p&gt;

&lt;p&gt;The plugin permits one redirect mode among &lt;code&gt;http_to_https&lt;/code&gt;, &lt;code&gt;uri&lt;/code&gt;, and &lt;code&gt;regex_uri&lt;/code&gt;; only &lt;code&gt;uri&lt;/code&gt; or &lt;code&gt;regex_uri&lt;/code&gt; may be used for a custom destination redirect. A &lt;code&gt;regex_uri&lt;/code&gt; that does not match is forwarded to the configured upstream, so that pass-through path must be intentional rather than assumed to be a rejection.&lt;/p&gt;

&lt;p&gt;The plugin can execute a reviewed redirect policy on a domain routed through APISIX. It does not create a link-management approval workflow, validate the future content of a destination, or control an alias hosted in someone else's namespace. Keep those boundaries next to the implementation decision.&lt;/p&gt;

&lt;h2&gt;
  
  
  Make Retirement Non-Reusable
&lt;/h2&gt;

&lt;p&gt;Retirement should be an explicit transition:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Stop new publication of the alias.&lt;/li&gt;
&lt;li&gt;Measure recent requests by channel and user agent without logging sensitive query values.&lt;/li&gt;
&lt;li&gt;Notify the owner and known publishers.&lt;/li&gt;
&lt;li&gt;Replace the destination with a controlled notice or an appropriate 404/410 response.&lt;/li&gt;
&lt;li&gt;Reserve the alias indefinitely when old copies cannot be recalled.&lt;/li&gt;
&lt;li&gt;Alert on attempts to recreate or retarget the reserved identifier.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Whether to use 404 or 410 depends on the contract and client behavior. The security property is not the specific code; it is that the old alias cannot later become an unrelated live redirect without an authorized recovery process.&lt;/p&gt;

&lt;p&gt;For QR codes, printed materials, legal notices, password-reset templates, OAuth redirect documentation, and package metadata, assume the reference can outlive the team that created it. Give those aliases a stronger retention class than disposable campaign experiments.&lt;/p&gt;

&lt;h2&gt;
  
  
  Test the Full Redirect Path
&lt;/h2&gt;

&lt;p&gt;A useful acceptance suite checks more than the final &lt;code&gt;Location&lt;/code&gt; value:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;approved and rejected destination hosts;&lt;/li&gt;
&lt;li&gt;encoded and internationalized hostnames;&lt;/li&gt;
&lt;li&gt;GET, HEAD, and unexpected methods;&lt;/li&gt;
&lt;li&gt;query-string preservation and duplication;&lt;/li&gt;
&lt;li&gt;301/302/307/308 method behavior;&lt;/li&gt;
&lt;li&gt;redirect-loop and maximum-hop handling;&lt;/li&gt;
&lt;li&gt;expired alias and tombstone behavior;&lt;/li&gt;
&lt;li&gt;vendor or origin unavailability;&lt;/li&gt;
&lt;li&gt;direct backend access that bypasses the managed redirect route.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Run tests from representative clients because caches and redirect behavior differ. A permanent redirect can be cached beyond a quick rollback window, so stage destination changes with temporary codes when the business contract allows it.&lt;/p&gt;

&lt;p&gt;Log the alias, normalized destination identifier, policy decision, status, and trusted change actor. A request ID helps correlation, but it is not an identity if a caller can supply it unchanged. Generate or overwrite correlation values at a trusted boundary when they are used as audit evidence.&lt;/p&gt;

&lt;h2&gt;
  
  
  Treat the Link as a Small, Durable API
&lt;/h2&gt;

&lt;p&gt;The safest short link is not necessarily self-hosted. It is one whose public namespace, configuration path, destination policy, status semantics, and retirement behavior remain under accountable control.&lt;/p&gt;

&lt;p&gt;Start by inventorying links on public profiles, documentation, QR codes, and long-lived campaigns. Move high-value aliases to a first-party domain, assign owners, reserve retired identifiers, and test the redirect path like any other public API.&lt;/p&gt;

&lt;p&gt;If you use Apache APISIX as the controlled traffic layer, pin behavior to the version you deploy and manage the redirect configuration through reviewed changes. For broader policy, audit, and lifecycle workflows around APIs, explore &lt;a href="https://api7.ai/enterprise" rel="noopener noreferrer"&gt;API7 Enterprise&lt;/a&gt; and the &lt;a href="https://docs.api7.ai/api7-gateway/getting-started/overview" rel="noopener noreferrer"&gt;API7 Gateway documentation&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://api7.ai/blog/short-link-redirect-security" rel="noopener noreferrer"&gt;Read the original on API7.ai&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>security</category>
      <category>webdev</category>
      <category>api</category>
    </item>
    <item>
      <title>HTTP/3 Changes API Debugging: Observe at the Termination Point</title>
      <dc:creator>Yilia</dc:creator>
      <pubDate>Tue, 17 Nov 2026 10:06:02 +0000</pubDate>
      <link>https://dev.to/yilialinn/http3-changes-api-debugging-observe-at-the-termination-point-bmp</link>
      <guid>https://dev.to/yilialinn/http3-changes-api-debugging-observe-at-the-termination-point-bmp</guid>
      <description>&lt;p&gt;Originally published by Yilia Lin on &lt;a href="https://api7.ai/blog/http3-api-observability" rel="noopener noreferrer"&gt;API7&lt;/a&gt; on 2026-11-17.&lt;/p&gt;

&lt;p&gt;This republication was prepared with AI assistance. The original article’s drafting process has not been verified.&lt;/p&gt;

&lt;p&gt;When an HTTP/1.1 API fails, engineers often start with a proxy or packet capture. HTTP/3 changes what those tools can see. The exchange still has a request method, path, and headers plus a response status, but it travels over QUIC on UDP, its protected packets do not expose application data, and its headers use QPACK rather than HTTP/2's HPACK.&lt;/p&gt;

&lt;p&gt;A recent hands-on post about &lt;a href="https://interceptsuite.com/blog/intercept-http3-traffic-quic-qpack-explained/" rel="noopener noreferrer"&gt;intercepting HTTP/3 traffic&lt;/a&gt; reached &lt;a href="https://news.ycombinator.com/item?id=50521870" rel="noopener noreferrer"&gt;Hacker News&lt;/a&gt; and sparked a useful trust-boundary discussion. The operational lesson is broader than one interception tool: API teams need to observe HTTP semantics where the protocol is terminated, then correlate that evidence with the gateway and service hops that follow.&lt;/p&gt;

&lt;p&gt;The goal is not to decrypt production traffic everywhere. It is to give each layer enough trustworthy telemetry to answer whether failure occurred during HTTP/3 discovery, QUIC connection establishment, edge processing, gateway policy, upstream connection, or application execution.&lt;/p&gt;

&lt;h2&gt;
  
  
  Key Takeaways
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;HTTP/3 carries HTTP semantics over QUIC; a TCP-only proxy does not automatically observe that path.&lt;/li&gt;
&lt;li&gt;A packet capture remains useful for network timing and reachability, but protected application data needs endpoint secrets or an authorized termination point.&lt;/li&gt;
&lt;li&gt;Silent fallback to HTTP/2 or HTTP/1.1 can hide an HTTP/3-specific failure.&lt;/li&gt;
&lt;li&gt;Record the negotiated protocol at the client-facing edge and the protocol on each downstream hop.&lt;/li&gt;
&lt;li&gt;Propagate trace context across termination boundaries, but do not treat a caller-supplied ID as trusted identity.&lt;/li&gt;
&lt;li&gt;Apache APISIX can provide gateway-hop telemetry behind an HTTP/3-capable edge; this article does not claim APISIX 3.19 terminates HTTP/3.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  HTTP Semantics Stay; the Transport Changes
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://www.rfc-editor.org/rfc/rfc9114.html" rel="noopener noreferrer"&gt;RFC 9114&lt;/a&gt; maps HTTP semantics onto QUIC. QUIC version 1 runs over UDP and uses TLS 1.3 or later as its handshake protocol. HTTP/3 is selected with the &lt;code&gt;h3&lt;/code&gt; ALPN token, and an HTTPS origin can advertise an alternative HTTP/3 service with &lt;code&gt;Alt-Svc&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;That produces a different wire path from HTTP/2:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmermaid.ink%2Fimg%2Fpako%3AeNo1Tz0LwjAQ_StHVq1S3ToIoqKCQ7V1qg4hPWsgTUI8FWn878ZGb3kH9z7udUyYGlkG7KLMU1y5I9gdThrCLJRETVWEDDZlmY-nZ0iSmT8ucxjA_rhdBCh3hYdV3WAVKUDoWqk5SaPP0ep77YU9YwLGRbt0lHpYc8Inf1XzfAtN3MEaJcXrp_4ReoO7vZFD3oJ1howwykOB7iEFVnNrg-gfy4bA2vAIl3Wo1zG6YtsX1XgnxxV7vz-9Z1Lk%3Ftype%3Dpng%26bgColor%3D%21white" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmermaid.ink%2Fimg%2Fpako%3AeNo1Tz0LwjAQ_StHVq1S3ToIoqKCQ7V1qg4hPWsgTUI8FWn878ZGb3kH9z7udUyYGlkG7KLMU1y5I9gdThrCLJRETVWEDDZlmY-nZ0iSmT8ucxjA_rhdBCh3hYdV3WAVKUDoWqk5SaPP0ep77YU9YwLGRbt0lHpYc8Inf1XzfAtN3MEaJcXrp_4ReoO7vZFD3oJ1howwykOB7iEFVnNrg-gfy4bA2vAIl3Wo1zG6YtsX1XgnxxV7vz-9Z1Lk%3Ftype%3Dpng%26bgColor%3D%21white" alt="HTTP/3 termination and the two downstream hops" width="1278" height="88"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The arrows are separate connections. A successful HTTP/3 client-to-edge request does not prove the edge-to-gateway or gateway-to-service hop used HTTP/3. Conversely, a gateway trace can show a healthy upstream request while omitting a delay that occurred before the edge finished QUIC setup.&lt;/p&gt;

&lt;p&gt;QUIC packet protection is not an optional wrapper. &lt;a href="https://www.rfc-editor.org/rfc/rfc9001.html" rel="noopener noreferrer"&gt;RFC 9001&lt;/a&gt; derives packet-protection keys from TLS and protects handshake, 0-RTT, and 1-RTT packets at different encryption levels. Initial packets use derivable keys and are not confidential, but application data is protected. A raw capture alone should not be expected to reveal request headers and bodies.&lt;/p&gt;

&lt;p&gt;HTTP/3 also replaces HPACK with &lt;a href="https://www.rfc-editor.org/rfc/rfc9204.html" rel="noopener noreferrer"&gt;QPACK&lt;/a&gt;. QPACK uses encoder and decoder streams to coordinate compression state without assuming the total ordering available to HTTP/2 over TCP. That means “find the header bytes in this packet” is the wrong debugging model even after stream data is available.&lt;/p&gt;

&lt;h2&gt;
  
  
  Define the Observation Points Before the Incident
&lt;/h2&gt;

&lt;p&gt;Use four complementary views:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Observation point&lt;/th&gt;
&lt;th&gt;Can establish&lt;/th&gt;
&lt;th&gt;Cannot establish alone&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Client&lt;/td&gt;
&lt;td&gt;Requested URL, attempted protocol, client timing, fallback outcome&lt;/td&gt;
&lt;td&gt;Edge policy and upstream execution&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Network capture&lt;/td&gt;
&lt;td&gt;UDP arrivals at that capture point, addresses, packet sizes and timing, and connection IDs when present&lt;/td&gt;
&lt;td&gt;Protected HTTP fields or a reliable end-to-end loss conclusion without endpoint metrics or authorized secrets&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;HTTP/3 terminator&lt;/td&gt;
&lt;td&gt;Negotiated ALPN, QUIC/TLS outcome, decoded HTTP request, edge response&lt;/td&gt;
&lt;td&gt;Downstream gateway and application behavior unless correlated&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Gateway and service&lt;/td&gt;
&lt;td&gt;Route, policy, upstream timing, application spans and status&lt;/td&gt;
&lt;td&gt;Pre-termination HTTP/3 discovery and handshake failure&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;No single view is “the truth” for the whole request. The useful unit is a correlated timeline with the trust and protocol boundary of each timestamp stated explicitly.&lt;/p&gt;

&lt;p&gt;For example, an edge may return a 503 before forwarding anything. The gateway correctly has no trace. Or the edge may forward a request and the gateway may reject it before the service receives it. Missing application telemetry then reflects policy timing, not necessarily broken tracing.&lt;/p&gt;

&lt;h2&gt;
  
  
  Detect Fallback Instead of Calling It Success
&lt;/h2&gt;

&lt;p&gt;RFC 9114 says connectivity problems such as blocked UDP can prevent a QUIC connection and clients should attempt a TCP-based HTTP version. That improves reachability, but it can conceal an HTTP/3 regression.&lt;/p&gt;

&lt;p&gt;Track at least:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;advertised protocols and the age of the &lt;code&gt;Alt-Svc&lt;/code&gt; record;&lt;/li&gt;
&lt;li&gt;attempted and negotiated protocol;&lt;/li&gt;
&lt;li&gt;QUIC handshake success, failure category, and time;&lt;/li&gt;
&lt;li&gt;fallback protocol and added latency;&lt;/li&gt;
&lt;li&gt;edge-to-gateway protocol;&lt;/li&gt;
&lt;li&gt;gateway-to-upstream protocol;&lt;/li&gt;
&lt;li&gt;status and failure phase.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Do not infer that a 200 response proves HTTP/3 worked. A client may have retried over HTTP/2. Likewise, do not label every UDP failure an attack; enterprise firewalls, carrier networks, NAT behavior, and stale advertisements can all affect the path.&lt;/p&gt;

&lt;p&gt;Canary HTTP/3 separately from the TCP fallback. Synthetic checks should report both the final HTTP result and the negotiated transport. During a rollback, remove or shorten advertisements deliberately and account for client caching rather than assuming every client immediately returns to the old path.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F0ax2il19zs37ypg7jtzz.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F0ax2il19zs37ypg7jtzz.webp" alt="A client attempts HTTP/3 over QUIC. A successful QUIC path and a failed QUIC path followed by HTTP/2 or HTTP/1.1 fallback can both return 200, so telemetry records the attempted protocol, negotiated protocol, fallback latency, and failure phase." width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Correlate Across the Termination Boundary
&lt;/h2&gt;

&lt;p&gt;The &lt;a href="https://www.w3.org/TR/trace-context/" rel="noopener noreferrer"&gt;W3C Trace Context&lt;/a&gt; specification defines &lt;code&gt;traceparent&lt;/code&gt; and &lt;code&gt;tracestate&lt;/code&gt; headers for propagating request context. Because HTTP semantics survive the transport change, a trusted edge can forward trace context to the gateway and application.&lt;/p&gt;

&lt;p&gt;Trust still matters. A public client can supply &lt;code&gt;traceparent&lt;/code&gt;, &lt;code&gt;tracestate&lt;/code&gt;, or a request ID. Decide whether the edge accepts, validates, replaces, or links that context. A correlation value is useful evidence but is not a caller identity, authorization result, or proof that two events came from the same trusted actor.&lt;/p&gt;

&lt;p&gt;At each hop, attach fields such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;edge request identifier generated at the trusted boundary;&lt;/li&gt;
&lt;li&gt;client-facing protocol and ALPN;&lt;/li&gt;
&lt;li&gt;fallback result;&lt;/li&gt;
&lt;li&gt;gateway route and upstream identifier;&lt;/li&gt;
&lt;li&gt;policy outcome and rejection phase;&lt;/li&gt;
&lt;li&gt;upstream connect, first-byte, and total duration;&lt;/li&gt;
&lt;li&gt;application span and business outcome.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Avoid placing credentials, full query strings, or personal data into span attributes. High-cardinality connection identifiers can also create cost and privacy problems; retain only the detail required for a bounded investigation.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F128guy8o1sywnfzwhb2l.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F128guy8o1sywnfzwhb2l.webp" alt="A public client can supply traceparent, tracestate, or a request ID. A trusted HTTP/3 edge validates, replaces, or links that context before forwarding it to APISIX and the service; the shared timeline supports correlation but does not establish identity or authorization." width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;API7's &lt;a href="https://api7.ai/blog/api-observability-guide" rel="noopener noreferrer"&gt;API observability guide&lt;/a&gt; explains how metrics, logs, traces, and SLOs complement one another. HTTP/3 adds another reason not to ask one signal to carry the entire investigation.&lt;/p&gt;

&lt;h2&gt;
  
  
  Place Gateway Telemetry in the Right Scope
&lt;/h2&gt;

&lt;p&gt;If an HTTP/3-capable CDN, load balancer, or edge proxy terminates QUIC and forwards HTTP/2 or HTTP/1.1, Apache APISIX can observe the gateway-facing request and its upstream work. That does not make the APISIX span an HTTP/3 handshake span.&lt;/p&gt;

&lt;p&gt;In Apache APISIX 3.19, the &lt;a href="https://apisix.apache.org/docs/apisix/3.19/plugins/opentelemetry/" rel="noopener noreferrer"&gt;&lt;code&gt;opentelemetry&lt;/code&gt; plugin&lt;/a&gt; reports tracing data and supports binary-encoded OTLP over HTTP. The plugin is disabled in the default plugin list and must be enabled in configuration. On a route, its documented sampler defaults to &lt;code&gt;always_off&lt;/code&gt;, so enabling the plugin binary without setting an appropriate sampler does not mean route spans will appear.&lt;/p&gt;

&lt;p&gt;The same documentation notes that comprehensive request-lifecycle tracing adds span creation and export overhead that can affect throughput and latency. Choose sampling from the incident and SLO requirements, test collector failure behavior, and avoid changing every route to &lt;code&gt;always_on&lt;/code&gt; during a traffic spike without estimating the added load.&lt;/p&gt;

&lt;p&gt;This version-pinned description is intentionally narrow. It does not claim APISIX 3.19 accepts client HTTP/3 connections, exports QUIC transport internals, or reconstructs telemetry that an outer edge never forwarded. Collect HTTP/3 connection evidence at the component that actually terminates QUIC.&lt;/p&gt;

&lt;h2&gt;
  
  
  Use Decryption Only in a Controlled Lab
&lt;/h2&gt;

&lt;p&gt;When decoded wire evidence is necessary, reproduce with a client and server you control. Wireshark documents TLS decryption using a &lt;a href="https://wiki.wireshark.org/TLS/" rel="noopener noreferrer"&gt;key log file&lt;/a&gt;, and HTTP/3-aware tooling can combine secrets with QUIC and QPACK dissection.&lt;/p&gt;

&lt;p&gt;Treat those secrets as sensitive. Do not enable broad production key logging merely to make packet captures convenient. A trusted interception proxy also changes the trust path: the client must trust its certificate authority, and certificate-pinned applications may reject it. Results from that lab prove behavior under the lab's trust configuration, not that arbitrary encrypted traffic can be inspected.&lt;/p&gt;

&lt;p&gt;A focused reproduction sequence is:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Confirm the client build supports HTTP/3.&lt;/li&gt;
&lt;li&gt;Record DNS and &lt;code&gt;Alt-Svc&lt;/code&gt; discovery.&lt;/li&gt;
&lt;li&gt;Force an HTTP/3 attempt and record the negotiated protocol.&lt;/li&gt;
&lt;li&gt;Repeat with UDP blocked to verify the expected fallback.&lt;/li&gt;
&lt;li&gt;Correlate the edge event, gateway trace, and application span.&lt;/li&gt;
&lt;li&gt;Use authorized key logging only if the failure remains below the HTTP layer.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Document the client, QUIC implementation, edge configuration, and gateway version. HTTP/3 behavior can differ across implementations even when the HTTP contract is the same.&lt;/p&gt;

&lt;h2&gt;
  
  
  Debug the Phase, Not Just the Status
&lt;/h2&gt;

&lt;p&gt;HTTP/3 does not make APIs unobservable. It makes the termination boundary impossible to ignore.&lt;/p&gt;

&lt;p&gt;Start by drawing the real connection graph. Mark where QUIC ends, which protocol begins on the next hop, who generates the trusted request ID, and where each metric or span is recorded. Then test HTTP/3 success, UDP failure with fallback, edge rejection, gateway rejection, and upstream failure as separate cases.&lt;/p&gt;

&lt;p&gt;For the gateway hop, review &lt;a href="https://api7.ai/blog/end-to-end-tracing-opentelemetry" rel="noopener noreferrer"&gt;end-to-end tracing with OpenTelemetry&lt;/a&gt; and the &lt;a href="https://apisix.apache.org/plugins/" rel="noopener noreferrer"&gt;Apache APISIX observability plugins&lt;/a&gt;. For managed API traffic policy and observability, explore &lt;a href="https://api7.ai/enterprise" rel="noopener noreferrer"&gt;API7 Enterprise&lt;/a&gt; while keeping HTTP/3 transport evidence at the component that terminates it.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://api7.ai/blog/http3-api-observability" rel="noopener noreferrer"&gt;Read the original on API7&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>devops</category>
      <category>api</category>
      <category>apigateway</category>
    </item>
    <item>
      <title>Kong AI Gateway vs AISIX: Which Gateway Fits When Teams Share AI Models?</title>
      <dc:creator>Yilia</dc:creator>
      <pubDate>Mon, 16 Nov 2026 10:31:24 +0000</pubDate>
      <link>https://dev.to/yilialinn/kong-ai-gateway-vs-aisix-which-gateway-fits-when-teams-share-ai-models-54cm</link>
      <guid>https://dev.to/yilialinn/kong-ai-gateway-vs-aisix-which-gateway-fits-when-teams-share-ai-models-54cm</guid>
      <description>&lt;p&gt;Originally published by Yilia Lin on &lt;a href="https://api7.ai/blog/kong-ai-gateway-vs-aisix" rel="noopener noreferrer"&gt;API7.ai&lt;/a&gt; on 2026-11-06.&lt;/p&gt;

&lt;p&gt;This republication was prepared with AI assistance. The original article’s drafting process has not been verified.&lt;/p&gt;

&lt;p&gt;Once a support assistant and an operations assistant share models, the platform team has more to manage. The two apps need different model permissions, batch jobs need their own rate limits, and the primary model needs a backup target. If each app handles this logic itself, changing a model or an access policy can mean updating and testing multiple configurations.&lt;/p&gt;

&lt;p&gt;An AI gateway can handle these requirements centrally between the apps and their models. AISIX OSS, the open-source LLM gateway in &lt;a href="https://api7.ai/ai-gateway" rel="noopener noreferrer"&gt;AISIX AI Gateway&lt;/a&gt;, lets both apps use the same model alias while keeping separate credentials, model permissions, and usage limits. Primary and backup targets and their failover conditions are configured at the gateway. &lt;strong&gt;You can evaluate these capabilities with AISIX OSS first&lt;/strong&gt;: run one gateway container and configure models and callers in a local resource file, without deploying a control plane first. The platform team can connect an existing app and check whether normal requests, access restrictions, rate limits, and failover behave as expected. &lt;a href="https://docs.api7.ai/ai-gateway/getting-started/gateway-quickstart" rel="noopener noreferrer"&gt;AISIX OSS quickstart&lt;/a&gt; · &lt;a href="https://docs.api7.ai/ai-gateway/traffic-controls/rate-limits" rel="noopener noreferrer"&gt;Rate limits&lt;/a&gt; · &lt;a href="https://docs.api7.ai/ai-gateway/routing/routing-and-failover" rel="noopener noreferrer"&gt;Routing and failover&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Kong AI Gateway also provides model integration and traffic management. For a platform team evaluating the two, the next questions are how to configure these requirements, which capabilities can be tried directly, which require a commercial license, and which components the team will need to maintain in production. We use the two assistants sharing models to compare application integration, failover, spending controls, access and content policies, and day-to-day operations.&lt;/p&gt;

&lt;p&gt;The comparison uses &lt;strong&gt;Kong AI Gateway 2.3.0&lt;/strong&gt; and &lt;strong&gt;AISIX 1.8.0&lt;/strong&gt;. The nine AISIX test cases ran against mock upstreams through one gateway instance. Kong's runtime behavior and both vendors' commercial capabilities are described from official documentation for the relevant deployment. &lt;a href="https://developer.konghq.com/ai-gateway/changelog/#2-3-0" rel="noopener noreferrer"&gt;Kong AI Gateway changelog&lt;/a&gt; · &lt;a href="https://github.com/api7/aisix/releases/tag/v1.8.0" rel="noopener noreferrer"&gt;AISIX 1.8.0 release&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  How much does an existing app need to change?
&lt;/h2&gt;

&lt;p&gt;The support assistant already uses the OpenAI SDK for Chat Completions. It can keep &lt;code&gt;POST /v1/chat/completions&lt;/code&gt; and its message structure, point the SDK at the gateway, use a gateway credential, and set &lt;code&gt;model&lt;/code&gt; to &lt;code&gt;shared-model&lt;/code&gt;. The operations assistant uses the same endpoint and model name with its own credential. Both apps can keep the alias when the platform team changes the upstream target. &lt;a href="https://docs.api7.ai/ai-gateway/reference/proxy-api" rel="noopener noreferrer"&gt;AISIX Proxy API&lt;/a&gt; · &lt;a href="https://developer.konghq.com/ai-gateway/entities/ai-model/#request-routing-rules" rel="noopener noreferrer"&gt;Kong model routing rules&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In AISIX OSS, the alias and its targets can live in &lt;code&gt;resources.yaml&lt;/code&gt;. Our &lt;code&gt;shared-model&lt;/code&gt; alias pointed to a primary and a backup. In Konnect, Kong can expose the same application interface by setting an AI Model's route and matching the alias in the request body with &lt;code&gt;config.route.model&lt;/code&gt;. For self-hosting, Kong documents how decK translates that definition into gateway routes and plugins. For an existing OpenAI Chat Completions client, both evaluations can start by changing the URL, credential, and model name on one existing request. &lt;a href="https://docs.api7.ai/ai-gateway/reference/proxy-api" rel="noopener noreferrer"&gt;AISIX Proxy API&lt;/a&gt; · &lt;a href="https://developer.konghq.com/ai-gateway/entities/ai-model/" rel="noopener noreferrer"&gt;Kong AI Model&lt;/a&gt; · &lt;a href="https://developer.konghq.com/ai-gateway/configure-on-prem/" rel="noopener noreferrer"&gt;Kong on-prem configuration&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If the assistant streams replies to the UI or calls a tool to look up orders, exercise that full path. An alias stays stable, while tool arguments, stream completion events, and native API capabilities depend on the entry point and target. AISIX offers Anthropic Messages and OpenAI Responses endpoints, for example, and Anthropic's &lt;code&gt;count_tokens&lt;/code&gt; requires an Anthropic upstream. Kong also distinguishes OpenAI-compatible formats from provider-native formats. Run the same application request against both targets and check that the app can parse the response and finish the tool call. &lt;a href="https://docs.api7.ai/ai-gateway/providers/compatibility" rel="noopener noreferrer"&gt;AISIX provider compatibility&lt;/a&gt; · &lt;a href="https://developer.konghq.com/ai-gateway/entities/ai-model/#request-and-response-formats" rel="noopener noreferrer"&gt;Kong request and response formats&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What does the user see when the primary model fails?
&lt;/h2&gt;

&lt;p&gt;Suppose the support assistant is drafting a reply when the primary target returns &lt;code&gt;503&lt;/code&gt;. In our test, the primary and backup were two HTTP paths on the same mock service, using the same mock model. We gave the primary higher priority, set same-target retries to &lt;code&gt;0&lt;/code&gt;, and allowed one fallback. App A sent one non-streaming request. AISIX received &lt;code&gt;503&lt;/code&gt; from the primary and &lt;code&gt;200&lt;/code&gt; from the backup, then returned &lt;code&gt;200&lt;/code&gt; with the text &lt;code&gt;backup&lt;/code&gt; to A. In a separate normal case, App B called the same alias and received &lt;code&gt;200&lt;/code&gt; from the primary. &lt;a href="https://docs.api7.ai/ai-gateway/routing/routing-and-failover" rel="noopener noreferrer"&gt;AISIX routing and failover&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;pre data-lang="mermaid"&gt;&lt;code&gt;flowchart TB
    subgraph Fault["App A · Failure case"]
        A["JWT A"] --&amp;gt; GA["AISIX OSS checks caller"]
        GA --&amp;gt; MA["shared-model"]
        MA --&amp;gt; PA["Try primary"]
        PA --&amp;gt;|503| FA["Gateway switches to backup"]
        FA --&amp;gt; QA["Try backup&amp;lt;br/&amp;gt;Keep the same request ID"]
        QA --&amp;gt;|200| RA["App A receives 200 · backup"]
    end

    subgraph Normal["App B · Normal case"]
        B["JWT B"] --&amp;gt; GB["AISIX OSS checks caller"]
        GB --&amp;gt; MB["shared-model"]
        MB --&amp;gt; PB["Try primary"]
        PB --&amp;gt;|200| RB["App B receives 200"]
    end&lt;/code&gt;&lt;/pre&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ft308exu8u883qsaggaiz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ft308exu8u883qsaggaiz.png" alt="Original article diagram 1" width="456" height="811"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Figure 1. Two independent cases on the same AISIX OSS 1.8.0 gateway. Both upstream attempts and the response to App A carried the same request ID. App B's normal request had its own ID.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Kong can also configure tiers with &lt;code&gt;priority&lt;/code&gt;. The default &lt;code&gt;failover_criteria&lt;/code&gt; are &lt;code&gt;error&lt;/code&gt; and &lt;code&gt;timeout&lt;/code&gt;, covering errors or timeouts when connecting, sending the request, or reading response headers. To cover the same &lt;code&gt;503&lt;/code&gt; case, add &lt;code&gt;http_503&lt;/code&gt;, allow a retry, and configure &lt;code&gt;non_idempotent&lt;/code&gt; as documented for this kind of &lt;code&gt;POST&lt;/code&gt;. In a self-hosted deployment, AI Proxy Advanced handles this routing and requires an AI license. &lt;a href="https://developer.konghq.com/ai-gateway/load-balancing/" rel="noopener noreferrer"&gt;Kong load balancing&lt;/a&gt; · &lt;a href="https://developer.konghq.com/plugins/ai-proxy-advanced/examples/semantic-with-fallback/" rel="noopener noreferrer"&gt;Kong &lt;code&gt;503&lt;/code&gt; fallback example&lt;/a&gt; · &lt;a href="https://developer.konghq.com/plugins/ai-proxy-advanced/" rel="noopener noreferrer"&gt;AI Proxy Advanced license&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The test answers what happens when the primary returns an explicit &lt;code&gt;503&lt;/code&gt; before the reply starts. For streaming Chat Completions, AISIX can switch targets only before it starts sending the response. If a timeout interrupts a reply already on screen, the stream ends. Test how the app detects and displays that incomplete reply. &lt;a href="https://docs.api7.ai/ai-gateway/routing/routing-and-failover#handle-streaming-failures" rel="noopener noreferrer"&gt;AISIX streaming failover&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Can you control spending across teams?
&lt;/h2&gt;

&lt;p&gt;Once the operations assistant starts processing tickets in batches, there are four decisions to make. &lt;strong&gt;Usage limits&lt;/strong&gt; determine how many requests or tokens an app can use. &lt;strong&gt;Cost tracking&lt;/strong&gt; prices the usage. &lt;strong&gt;Budget alerts&lt;/strong&gt; tell someone when spending reaches a threshold. &lt;strong&gt;Spend enforcement&lt;/strong&gt; determines whether new requests can still go through.&lt;/p&gt;

&lt;p&gt;AISIX OSS lets you set request, token, or concurrency limits per caller and export metrics, logs, and usage events to your existing observability stack. If replicas need shared counters, you can configure Redis. The platform team can then set separate allowances for the support and operations apps. AISIX Enterprise and Cloud add centralized usage reporting, model pricing management, and monetary budgets. &lt;a href="https://docs.api7.ai/ai-gateway/traffic-controls/rate-limits" rel="noopener noreferrer"&gt;AISIX rate limits&lt;/a&gt; · &lt;a href="https://docs.api7.ai/ai-gateway/getting-started/products-and-deployment-options#compare-management-capabilities" rel="noopener noreferrer"&gt;AISIX management capabilities&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;With AISIX Enterprise or Cloud, you can set budgets for teams, members, callers, or cost tags, among other scopes. Configure alert thresholds and choose whether to block once a budget runs out. The control plane aggregates spending and distributes budget state. Once the gateway receives the exhausted state for a blocking budget, it rejects matching requests before calling the provider. The request that crosses the threshold can still complete, as can requests admitted while the new state is reaching the gateway. &lt;a href="https://docs.api7.ai/ai-gateway/traffic-controls/budgets" rel="noopener noreferrer"&gt;AISIX budget enforcement&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Kong configures alerts and enforcement separately. &lt;strong&gt;Konnect AI Cost Management&lt;/strong&gt; tracks spend and sends threshold notifications. Requests continue when that budget is exceeded. For enforcement, configure &lt;strong&gt;AI Rate Limiting Advanced&lt;/strong&gt; with a &lt;code&gt;cost&lt;/code&gt; strategy and a threshold per time window, scoped to a Consumer or Consumer Group, for example. Self-hosted gateways use the AI-licensed plugin for cost-based rate limiting. &lt;a href="https://developer.konghq.com/ai-cost-management/budgets/" rel="noopener noreferrer"&gt;Kong budget alerts&lt;/a&gt; · &lt;a href="https://developer.konghq.com/ai-gateway/policies/ai-rate-limiting-advanced/" rel="noopener noreferrer"&gt;Kong cost-based rate limiting&lt;/a&gt; · &lt;a href="https://developer.konghq.com/plugins/ai-rate-limiting-advanced/" rel="noopener noreferrer"&gt;Self-hosted rate-limiting plugin&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Kong's 2.3.0 on-prem runtime also introduced a dynamic pricing catalog. With dynamic pricing enabled, explicit target pricing takes precedence, and targets without price fields can use the catalog. The release notes describe how cost-based rate limiting uses catalog prices to reserve quota for in-flight requests. That reservation affects concurrent admission. The gateway calculates the final cost from usage and the applicable price. A concurrent batch test can show how reservations, final usage, and later rejections interact. &lt;a href="https://developer.konghq.com/ai-gateway/changelog/#2-3-0" rel="noopener noreferrer"&gt;Kong AI Gateway 2.3.0 changelog&lt;/a&gt; · &lt;a href="https://developer.konghq.com/ai-gateway/model-cost-management/" rel="noopener noreferrer"&gt;Kong model pricing&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Where do access and content policies take effect?
&lt;/h2&gt;

&lt;p&gt;Both apps can use &lt;code&gt;shared-model&lt;/code&gt;, but the internal model &lt;code&gt;ops-only&lt;/code&gt; is reserved for operations. In the AISIX OSS test, a script issued short-lived &lt;strong&gt;HS256 JWTs&lt;/strong&gt;. The gateway verified the signature, issuer, audience, and expiry, then mapped the token subject to a caller. An invalid signature or an expired JWT returned &lt;code&gt;401&lt;/code&gt;. The support identity received &lt;code&gt;403&lt;/code&gt; when it requested &lt;code&gt;ops-only&lt;/code&gt; with a valid JWT, while operations could call it. Once support used up its configured allowance of two requests per day, its next request received &lt;code&gt;429&lt;/code&gt; and operations could still call the shared alias. All three rejection types occurred before an upstream call. &lt;a href="https://docs.api7.ai/ai-gateway/traffic-controls/jwt-authentication" rel="noopener noreferrer"&gt;AISIX JWT authentication&lt;/a&gt; · &lt;a href="https://docs.api7.ai/ai-gateway/traffic-controls/rate-limits" rel="noopener noreferrer"&gt;AISIX caller and model limits&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Kong can apply Key Auth or OpenID Connect to an AI Model and grant access to selected AI Consumers or Consumer Groups. Self-hosted deployments use the corresponding gateway plugins, and the OpenID Connect plugin requires an Enterprise license. With a real identity provider, test a group membership change using both a still-valid token and a newly issued one to see when it takes effect on the model route. &lt;a href="https://developer.konghq.com/ai-gateway/entities/ai-auth-strategy/" rel="noopener noreferrer"&gt;Kong authentication strategies&lt;/a&gt; · &lt;a href="https://developer.konghq.com/ai-gateway/entities/ai-model/#access-control" rel="noopener noreferrer"&gt;Kong model access control&lt;/a&gt; · &lt;a href="https://developer.konghq.com/plugins/openid-connect/" rel="noopener noreferrer"&gt;Kong OpenID Connect plugin&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;With output blocking or masking enabled, output checks affect when the support agent first sees a reply. On Chat Completions, AISIX guardrails such as custom scripts can check and release windows of content. AISIX semantic screening holds the complete reply for inspection and can deliver it in streaming format after it passes. On Messages and Responses in AISIX 1.8.0, AISIX holds the full response when an output guardrail can block or mask content. &lt;a href="https://docs.api7.ai/ai-gateway/traffic-controls/guardrails/behavior" rel="noopener noreferrer"&gt;AISIX guardrail behavior&lt;/a&gt; · &lt;a href="https://docs.api7.ai/ai-gateway/traffic-controls/guardrails/semantic-screening" rel="noopener noreferrer"&gt;AISIX semantic screening&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Kong's managed &lt;strong&gt;AI Semantic Response Guard&lt;/strong&gt; policy checks the full reply. It sets &lt;code&gt;stream=false&lt;/code&gt; upstream and uses vector similarity rules to decide whether to allow the output. Self-hosted teams can evaluate the AI-licensed gateway plugin of the same name under its documented topology requirements. For chunked inspection, Kong's &lt;strong&gt;AI AWS Guardrails&lt;/strong&gt; policy can run in &lt;code&gt;OUTPUT&lt;/code&gt; or &lt;code&gt;BOTH&lt;/code&gt; mode and send buffered chunks to Bedrock for evaluation. Try the same response that should trigger a block in each configuration and record when the first text appears and how much the app has received at the point of enforcement. &lt;a href="https://developer.konghq.com/ai-gateway/policies/ai-semantic-response-guard/" rel="noopener noreferrer"&gt;Kong managed semantic response policy&lt;/a&gt; · &lt;a href="https://developer.konghq.com/plugins/ai-semantic-response-guard/" rel="noopener noreferrer"&gt;Kong semantic response plugin&lt;/a&gt; · &lt;a href="https://developer.konghq.com/ai-gateway/policies/ai-aws-guardrails/" rel="noopener noreferrer"&gt;Kong AWS Guardrails&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What will your team operate and troubleshoot in production?
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;The gateway handles application requests. The control plane distributes configuration and receives telemetry.&lt;/strong&gt; A deployment decision determines who scales and upgrades the gateway, who responds when it fails, and who operates the management services.&lt;br&gt;
&lt;/p&gt;

&lt;pre data-lang="mermaid"&gt;&lt;code&gt;flowchart TB
    subgraph AISIX["AISIX"]
        direction LR
        AA["App"] --&amp;gt; AG["Gateway · Customer-run"]
        AG --&amp;gt; AM["Upstream model"]
        AF["OSS config file · Customer"] -. Config .-&amp;gt; AG
        AE["Enterprise control plane · Customer"] &amp;lt;-.-&amp;gt; AG
        AC["Cloud control plane · API7"] &amp;lt;-.-&amp;gt; AG
    end

    subgraph KONG["Kong AI Gateway"]
        direction LR
        KA["App"] --&amp;gt; KO["Self-hosted gateway · Customer"]
        KA --&amp;gt; KH["Hybrid gateway · Customer"]
        KA --&amp;gt; KD["Dedicated Cloud gateway · Kong"]
        KO --&amp;gt; KM["Upstream model"]
        KH --&amp;gt; KM
        KD --&amp;gt; KM
        KL["Local administration · Customer"] -. Config .-&amp;gt; KO
        KC["Konnect control plane · Kong"] &amp;lt;-.-&amp;gt; KH
        KF["Dedicated Cloud control plane · Kong"] &amp;lt;-.-&amp;gt; KD
    end&lt;/code&gt;&lt;/pre&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F7o9epfdcjpehkapn5sog.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F7o9epfdcjpehkapn5sog.png" alt="Original article diagram 2" width="799" height="265"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Figure 2. Deployment and operating responsibilities. Solid arrows show the request path through the selected gateway. Dashed arrows show configuration, and two-way dashed arrows include telemetry. The AISIX gateway node represents three separate deployment choices.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;With &lt;strong&gt;AISIX OSS&lt;/strong&gt; in file mode, the customer runs the gateway and maintains the resource file. It can run on its own. With &lt;strong&gt;AISIX Enterprise&lt;/strong&gt;, the customer also operates the &lt;code&gt;cp-api&lt;/code&gt; and &lt;code&gt;dp-manager&lt;/code&gt; services and PostgreSQL. Production use of the control plane and dashboard requires a commercial license. With &lt;strong&gt;AISIX Cloud&lt;/strong&gt;, API7 operates the control plane while the customer continues to operate the gateway, which connects to management over mutual TLS. That suits teams that want hosted management and still need to control where inference traffic flows. &lt;a href="https://docs.api7.ai/ai-gateway/getting-started/products-and-deployment-options" rel="noopener noreferrer"&gt;AISIX deployment options&lt;/a&gt; · &lt;a href="https://docs.api7.ai/ai-gateway/on-premises/deployment" rel="noopener noreferrer"&gt;Enterprise deployment&lt;/a&gt; · &lt;a href="https://docs.api7.ai/ai-gateway/getting-started/aisix-cloud-quickstart" rel="noopener noreferrer"&gt;Enterprise licensing&lt;/a&gt; · &lt;a href="https://docs.api7.ai/ai-gateway/cloud/connect-a-gateway" rel="noopener noreferrer"&gt;Connecting a gateway&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Kong's official &lt;strong&gt;self-hosted&lt;/strong&gt; Compose path for 2.3.0 asks the customer to run the gateway and PostgreSQL, run database migrations, and provide an Enterprise license. Apply the AI configuration with &lt;code&gt;deck ai sync&lt;/code&gt;. In a &lt;strong&gt;Konnect hybrid&lt;/strong&gt; deployment, Kong runs the control plane and the customer runs the gateway. With &lt;strong&gt;Kong Dedicated Cloud&lt;/strong&gt;, Kong runs both and handles gateway scaling, upgrades, and high availability. &lt;a href="https://developer.konghq.com/ai-gateway/install/docker/" rel="noopener noreferrer"&gt;Kong on-prem installation&lt;/a&gt; · &lt;a href="https://developer.konghq.com/ai-gateway/architecture/" rel="noopener noreferrer"&gt;Kong hybrid architecture&lt;/a&gt; · &lt;a href="https://developer.konghq.com/dedicated-cloud-gateways/reference/#ai-gateway-2-0-on-dedicated-cloud-gateways" rel="noopener noreferrer"&gt;Kong Dedicated Cloud&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Open-source availability depends on the component.&lt;/strong&gt; AISIX OSS is an Apache-2.0-licensed AI gateway; the request controls shown here can be evaluated without its commercial control plane. Kong Gateway also has an open-source distribution, while the AI Proxy Advanced and AI Rate Limiting Advanced plugins referenced here require AI licenses. Gateway licensing and infrastructure costs are separate from model-provider usage charges. For the broader commercial packaging, see our &lt;a href="https://api7.ai/blog/kong-konnect-pricing" rel="noopener noreferrer"&gt;Kong Konnect pricing guide&lt;/a&gt;. &lt;a href="https://github.com/api7/aisix/blob/v1.8.0/LICENSE" rel="noopener noreferrer"&gt;AISIX OSS license&lt;/a&gt; · &lt;a href="https://github.com/Kong/kong/blob/master/LICENSE" rel="noopener noreferrer"&gt;Kong Gateway license&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Back to the support request. The app saw &lt;code&gt;200&lt;/code&gt;, but the on-call engineer needs to know that the primary returned &lt;code&gt;503&lt;/code&gt;. Using &lt;code&gt;x-aisix-request-id&lt;/code&gt; from the response, we can find these three entries in the gateway logs. The extract shortens the request ID and keeps the fields relevant to troubleshooting.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;request_id=79eec4ce… target_model=primary error="upstream returned HTTP 503: injected fault"
request_id=79eec4ce… attempt_index=1 attempt_kind=fallback status=200
request_id=79eec4ce… status_code=200 served_by_model=backup routing_attempt_count=2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The entries show the primary failure, the successful fallback, and the final outcome for the app. Monitoring client outcomes separately from upstream failures and successful fallbacks lets you spot a deteriorating primary even when application success stays flat. In a Kong evaluation, use &lt;code&gt;X-Kong-Request-Id&lt;/code&gt; to find the request in logs and verify which attempt fields, such as &lt;code&gt;tries&lt;/code&gt;, are available on the AI route you deploy. &lt;a href="https://docs.api7.ai/ai-gateway/observability/metrics-and-usage-events" rel="noopener noreferrer"&gt;AISIX metrics and usage events&lt;/a&gt; · &lt;a href="https://developer.konghq.com/gateway/logs/" rel="noopener noreferrer"&gt;Kong request IDs&lt;/a&gt; · &lt;a href="https://developer.konghq.com/plugins/file-log/" rel="noopener noreferrer"&gt;Kong log fields&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Start with one existing application
&lt;/h2&gt;

&lt;p&gt;Pick an app you already run and use a test client as the second caller. Give each caller its own credential and use the same model alias. Confirm the app handles the normal reply. Then trigger an access denial or request limit for one identity and check that the other can still call. Finally, make the primary return &lt;code&gt;503&lt;/code&gt;, record what the app receives, and find both upstream attempts using the request ID.&lt;/p&gt;

&lt;p&gt;If you are looking for a self-hosted Kong AI Gateway alternative to evaluate model access, caller limits, and configured failover, start with AISIX OSS. Once you need centralized budgets, reporting, or audit history, evaluate Enterprise or Cloud. All three use the same gateway runtime and proxy API, so the app can keep its API contract while the platform team migrates or recreates management resources such as models, credentials, and policies. If you want a vendor to operate the gateway from day one, use the same acceptance cases to evaluate Kong Dedicated Cloud. &lt;a href="https://docs.api7.ai/ai-gateway/getting-started/products-and-deployment-options#plan-a-migration" rel="noopener noreferrer"&gt;AISIX migration planning&lt;/a&gt; · &lt;a href="https://developer.konghq.com/dedicated-cloud-gateways/reference/#ai-gateway-2-0-on-dedicated-cloud-gateways" rel="noopener noreferrer"&gt;Kong Dedicated Cloud&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For a broader shortlist, see our &lt;a href="https://api7.ai/ai-gateway-comparison" rel="noopener noreferrer"&gt;AI gateway comparison&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://api7.ai/blog/kong-ai-gateway-vs-aisix" rel="noopener noreferrer"&gt;Read the original on API7.ai&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>devops</category>
      <category>architecture</category>
    </item>
    <item>
      <title>Kong vs LiteLLM vs AISIX: Choosing a Self-Hosted AI Gateway</title>
      <dc:creator>Yilia</dc:creator>
      <pubDate>Fri, 13 Nov 2026 13:03:31 +0000</pubDate>
      <link>https://dev.to/yilialinn/kong-vs-litellm-vs-aisix-choosing-a-self-hosted-ai-gateway-13b7</link>
      <guid>https://dev.to/yilialinn/kong-vs-litellm-vs-aisix-choosing-a-self-hosted-ai-gateway-13b7</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fkulpxsqvbcb8i7ypfxjq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fkulpxsqvbcb8i7ypfxjq.png" alt="Kong vs LiteLLM vs AISIX: Choosing a Self-Hosted AI Gateway" width="800" height="420"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Originally published by Yilia Lin on &lt;a href="https://api7.ai/blog/self-hosted-ai-gateway-kong-litellm-aisix" rel="noopener noreferrer"&gt;API7.ai&lt;/a&gt; on 2026-11-09.&lt;/p&gt;

&lt;p&gt;This republication was prepared with AI assistance. The original article’s drafting process has not been verified.&lt;/p&gt;

&lt;p&gt;Your model calls work in development. Now the support and operations teams need to share the endpoint. The rollout checklist grows quickly: issue separate application credentials, restrict model access, cap batch workloads, configure a backup model target, and add a second gateway instance so a restart does not interrupt every caller.&lt;/p&gt;

&lt;p&gt;An AI gateway can take on these responsibilities incrementally. With &lt;a href="https://api7.ai/ai-gateway" rel="noopener noreferrer"&gt;AISIX AI Gateway&lt;/a&gt;, for example, you can configure models, caller permissions, usage limits, and primary/backup routing in an OSS resource file. The gateway handles request controls for the shared endpoint. When you need self-service administration, centralized reporting, or monetary budgets, you can evaluate &lt;a href="https://docs.api7.ai/ai-gateway/getting-started/products-and-deployment-options" rel="noopener noreferrer"&gt;Enterprise or Cloud&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://api7.ai/kong-ai-gateway-vs-litellm" rel="noopener noreferrer"&gt;LiteLLM and Kong AI Gateway&lt;/a&gt; address many of the same needs. When &lt;a href="https://api7.ai/ai-gateway-comparison" rel="noopener noreferrer"&gt;comparing AI gateways&lt;/a&gt;, consider what it takes to meet the same requirements: which components you deploy, which state must be shared, which capabilities need a commercial license, and who maintains the resulting system.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fuvtrjtwgbj99c37t0wti.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fuvtrjtwgbj99c37t0wti.png" alt="Deployment stages from one application to centralized management" width="800" height="124"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Figure 1. Expand the acceptance criteria as requirements grow. Centralized management is optional, rather than a destination every team must reach.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What do you need to run for the first application?
&lt;/h2&gt;

&lt;p&gt;Start with an existing application that uses OpenAI Chat Completions. Have it request a stable model alias, while the gateway maintains the provider, targets, and credentials behind that alias. Keep real application requests in the evaluation. If the app relies on tool calling or streaming, validate those behaviors alongside ordinary text responses.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;AISIX OSS&lt;/strong&gt; starts with &lt;a href="https://docs.api7.ai/ai-gateway/getting-started/gateway-quickstart" rel="noopener noreferrer"&gt;one gateway container and a &lt;code&gt;resources.yaml&lt;/code&gt; file&lt;/a&gt;. The file declares provider credentials, models, and caller credentials. You can start without a dashboard, control plane, or separate configuration store. You still need upstream endpoints and credentials, but the gateway components you operate for the initial trial are limited.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;LiteLLM Proxy&lt;/strong&gt; can also start small. It provides both an in-application SDK and a Proxy service for multiple applications; this article compares the Proxy. You can start a basic proxy &lt;a href="https://docs.litellm.ai/docs/proxy/quick_start" rel="noopener noreferrer"&gt;through the CLI&lt;/a&gt; and use &lt;a href="https://docs.litellm.ai/docs/proxy/configs" rel="noopener noreferrer"&gt;&lt;code&gt;config.yaml&lt;/code&gt;&lt;/a&gt; to declare the model list and routing settings. &lt;strong&gt;PostgreSQL is not a prerequisite for every LiteLLM request.&lt;/strong&gt; It enters the deployment when you adopt built-in management capabilities such as Virtual Keys and spend tracking.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Kong AI Gateway&lt;/strong&gt; requires choosing a deployment path first. Here we follow the database-backed path in the &lt;a href="https://developer.konghq.com/ai-gateway/install/docker/" rel="noopener noreferrer"&gt;official AI Gateway 2.3.0 on-premises installation&lt;/a&gt;: the gateway stores configuration in PostgreSQL, installation includes a database migration job, and an Enterprise license is required. decK applies configuration. Neither decK nor the migration job should be counted as an additional long-running gateway service.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Kong Gateway also supports &lt;a href="https://developer.konghq.com/gateway/db-less-mode/" rel="noopener noreferrer"&gt;declarative configuration in DB-less mode&lt;/a&gt;, and AI plugins document their &lt;a href="https://developer.konghq.com/plugins/ai-proxy-advanced/" rel="noopener noreferrer"&gt;supported topologies&lt;/a&gt;. This is a separate option to validate against the relevant Gateway version and plugin configuration; the database-backed installation steps do not apply unchanged.&lt;/p&gt;

&lt;p&gt;Basic forwarding is the starting point. Add credentials, permissions, limits, and backup targets to the same acceptance criteria to see how the deployment changes.&lt;/p&gt;

&lt;h2&gt;
  
  
  How much can you manage with open source when two teams share models?
&lt;/h2&gt;

&lt;p&gt;Give support and operations separate credentials for the same model alias. Support must not access an operations-only model, and the operations batch workload needs its own limit. If the primary target fails, the gateway should try a backup according to its configuration. These requirements turn a working proxy into a service that applications can share.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;For teams that need model permissions, usage limits, and primary/backup routing, AISIX OSS can keep this configuration in the resource file without first deploying centralized management or a configuration database.&lt;/strong&gt; &lt;a href="https://docs.api7.ai/ai-gateway/traffic-controls/caller-api-keys" rel="noopener noreferrer"&gt;Caller model permissions&lt;/a&gt;, &lt;a href="https://docs.api7.ai/ai-gateway/traffic-controls/rate-limits" rel="noopener noreferrer"&gt;request or token limits&lt;/a&gt;, and &lt;a href="https://docs.api7.ai/ai-gateway/routing/routing-and-failover" rel="noopener noreferrer"&gt;model targets&lt;/a&gt; are gateway resources. The platform team remains responsible for credential distribution, configuration deployment, and rollback.&lt;/p&gt;

&lt;p&gt;For example, this &lt;a href="https://docs.api7.ai/ai-gateway/reference/resources-file" rel="noopener noreferrer"&gt;caller configuration excerpt&lt;/a&gt; assumes that &lt;code&gt;shared-model&lt;/code&gt; already exists and reads credentials from environment variables. Support and operations receive limits of 60 and 10 requests per minute respectively. A complete resource file also needs provider and model definitions.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;api_keys&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
  &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="na"&gt;display_name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;support-app&lt;/span&gt;
    &lt;span class="na"&gt;key_env&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;SUPPORT_CALLER_KEY&lt;/span&gt;
    &lt;span class="na"&gt;allowed_models&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s"&gt;shared-model&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="na"&gt;rate_limit&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s"&gt;rpm:&lt;/span&gt; &lt;span class="mi"&gt;60&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="na"&gt;display_name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;ops-app&lt;/span&gt;
    &lt;span class="na"&gt;key_env&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;OPS_CALLER_KEY&lt;/span&gt;
    &lt;span class="na"&gt;allowed_models&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s"&gt;shared-model&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="na"&gt;rate_limit&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s"&gt;rpm:&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A standard LiteLLM approach uses &lt;a href="https://docs.litellm.ai/docs/proxy/virtual_keys" rel="noopener noreferrer"&gt;Virtual Keys&lt;/a&gt;: create keys for individual applications, restrict their models, and configure rate limits and budgets. This built-in key management path requires PostgreSQL to persist the relevant resources and usage records. You take on database operations and gain management APIs for issuing and maintaining keys.&lt;/p&gt;

&lt;p&gt;Kong combines &lt;a href="https://developer.konghq.com/ai-gateway/configure-on-prem/" rel="noopener noreferrer"&gt;caller identity, model access rules, and plugins&lt;/a&gt;. In self-hosted deployments, multi-target routing and AI token or monetary rate limits involve plugins such as AI Proxy Advanced and &lt;a href="https://developer.konghq.com/plugins/ai-rate-limiting-advanced/" rel="noopener noreferrer"&gt;AI Rate Limiting Advanced&lt;/a&gt;, which require AI licensing. Check the actual plugins and entitlements you need; access to the base gateway does not establish that those AI capabilities are free.&lt;/p&gt;

&lt;p&gt;For a shared model endpoint, these are the differences to keep in view:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Requirement&lt;/th&gt;
&lt;th&gt;AISIX&lt;/th&gt;
&lt;th&gt;LiteLLM Proxy&lt;/th&gt;
&lt;th&gt;Kong AI Gateway&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Separate credentials and model permissions&lt;/td&gt;
&lt;td&gt;OSS: caller API keys and model permissions in the resource file&lt;/td&gt;
&lt;td&gt;OSS: built-in Virtual Keys with PostgreSQL&lt;/td&gt;
&lt;td&gt;Caller identity and model access rules; check the selected AI plugin licenses&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Primary/backup model routing&lt;/td&gt;
&lt;td&gt;OSS: targets and failover in the resource file&lt;/td&gt;
&lt;td&gt;OSS: configurable &lt;a href="https://docs.litellm.ai/docs/proxy/reliability" rel="noopener noreferrer"&gt;fallbacks&lt;/a&gt;
&lt;/td&gt;
&lt;td&gt;
&lt;a href="https://developer.konghq.com/plugins/ai-proxy-advanced/" rel="noopener noreferrer"&gt;AI Proxy Advanced&lt;/a&gt; requires AI licensing&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Token-based usage limits&lt;/td&gt;
&lt;td&gt;OSS: caller or model limits; Redis for shared counters&lt;/td&gt;
&lt;td&gt;OSS: Virtual Key limits; Redis for multiple instances&lt;/td&gt;
&lt;td&gt;AI Rate Limiting Advanced requires AI licensing; Redis is the shared-counter option shown here&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Monetary budgets and blocking&lt;/td&gt;
&lt;td&gt;
&lt;a href="https://docs.api7.ai/ai-gateway/traffic-controls/budgets" rel="noopener noreferrer"&gt;Enterprise/Cloud&lt;/a&gt;; enable &lt;code&gt;Hard stop at limit&lt;/code&gt; for blocking&lt;/td&gt;
&lt;td&gt;OSS includes basic Virtual Key budgets&lt;/td&gt;
&lt;td&gt;
&lt;a href="https://developer.konghq.com/ai-gateway/policies/ai-rate-limiting-advanced/" rel="noopener noreferrer"&gt;AI rate limiting&lt;/a&gt; with &lt;code&gt;cost&lt;/code&gt; for blocking; &lt;a href="https://developer.konghq.com/ai-cost-management/budgets/" rel="noopener noreferrer"&gt;Konnect budgets&lt;/a&gt; are alert-only&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Whether you configure &lt;a href="https://docs.litellm.ai/docs/proxy/reliability" rel="noopener noreferrer"&gt;LiteLLM fallbacks&lt;/a&gt; or another gateway's backup targets, validate the failure conditions. Make the primary target return an explicit error before the response starts, then inspect the client result and upstream attempts. Separately, test a disconnect after content has started reaching the client. These failures affect the application differently. AISIX streaming failover has a &lt;a href="https://docs.api7.ai/ai-gateway/routing/routing-and-failover#handle-streaming-failures" rel="noopener noreferrer"&gt;boundary before response delivery begins&lt;/a&gt;: configuring a backup does not mean it can resume an interrupted answer.&lt;/p&gt;

&lt;h2&gt;
  
  
  Which state must be shared when you add replicas?
&lt;/h2&gt;

&lt;p&gt;A per-minute limit working on one instance does not prove that it remains one aggregate limit after scaling. With independent counters, an application reaching different instances may consume each instance's allowance separately. Scaling therefore brings traffic distribution, configuration rollout, and shared counters into the same discussion.&lt;/p&gt;

&lt;p&gt;Use one scenario to compare dependencies: two applications have separate credentials, model permissions, and request or token limits; the gateway has primary/backup model targets and two instances sharing caller rate-limit counters. Integrate ingress, model upstreams, and observability with your existing environment. The diagram focuses on what three selected deployment paths add.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F87vzipxzfqcmxg6hew1o.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F87vzipxzfqcmxg6hew1o.png" alt="Selected self-hosted gateway configuration and state dependencies" width="799" height="516"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Figure 2. Configuration and state dependencies for three self-hosted paths under the same requirements. Each group is an alternative. Dotted lines represent configuration or state access, not inference traffic. Common ingress, model upstreams, and observability are omitted. decK is a configuration tool; the database migration job is not shown.&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;AISIX OSS&lt;/strong&gt; can stay in file mode and use &lt;a href="https://docs.api7.ai/ai-gateway/deployment/open-source-gateway-on-kubernetes" rel="noopener noreferrer"&gt;Redis for shared rate-limit counters&lt;/a&gt;. Its default counter storage is process memory: loading identical resource files on two instances does not automatically share allowances.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;LiteLLM Proxy&lt;/strong&gt; retains PostgreSQL for its built-in Virtual Keys path and uses Redis to share state such as rate-limit and routing information in &lt;a href="https://docs.litellm.ai/docs/proxy/deploy" rel="noopener noreferrer"&gt;multi-instance production deployments&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Kong AI Gateway&lt;/strong&gt;: the path shown uses Redis for shared AI rate-limit counters and retains PostgreSQL for database-backed configuration. Kong also offers &lt;a href="https://developer.konghq.com/ai-gateway/policies/ai-rate-limiting-advanced/" rel="noopener noreferrer"&gt;strategies such as &lt;code&gt;local&lt;/code&gt; and &lt;code&gt;cluster&lt;/code&gt;&lt;/a&gt;, with topology-specific restrictions: &lt;code&gt;cluster&lt;/code&gt; is unavailable in DB-less, hybrid, and Konnect deployments. Counter synchronization also affects accuracy.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The diagram represents three selected paths; each product also supports other component combinations.&lt;/p&gt;

&lt;p&gt;Validate configuration rollout across instances too. Suppose you change the primary target for &lt;code&gt;shared-model&lt;/code&gt; from A to B. A &lt;code&gt;200&lt;/code&gt; at the shared endpoint does not confirm that both instances have updated. In a test environment, inspect the actual target used by each instance, then verify rollback. The official AISIX Helm path &lt;a href="https://docs.api7.ai/ai-gateway/deployment/open-source-gateway-on-kubernetes#apply-a-change-to-the-resources-file" rel="noopener noreferrer"&gt;applies resource changes through a Pod rolling update&lt;/a&gt;. Whichever rollout path you choose for LiteLLM or Kong should pass the same scope-of-effect check. A successful configuration submission is insufficient.&lt;/p&gt;

&lt;p&gt;Run the same failure checks for all three options. If shared counters become unreachable, does the deployment reject requests, use local counters, or take another configured fallback path? How does it resume sharing state after recovery? For example, AISIX can &lt;a href="https://docs.api7.ai/ai-gateway/traffic-controls/rate-limits#choose-rate-limit-counter-storage" rel="noopener noreferrer"&gt;fall back to local counting&lt;/a&gt; when its Redis rate-limit backend is unavailable; a single cluster-wide allowance is no longer enforced during that period. Strict quota requirements need alerts and an operational response for this boundary.&lt;/p&gt;

&lt;p&gt;Your operational scope now includes state services, configuration and Secret distribution, monitoring, upgrades, and rollback. Counting components is useful, but understanding their responsibilities and failure effects is equally relevant.&lt;/p&gt;

&lt;h2&gt;
  
  
  What changes when you need budgets, audit, and self-service administration?
&lt;/h2&gt;

&lt;p&gt;As application numbers grow, teams may want a UI for issuing keys, viewing spend, setting monetary budgets, and tracing configuration changes. These requirements do not necessarily introduce a separate control plane. Some products serve management APIs and a UI from the existing service; others add management services or have the vendor operate them.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;AISIX&lt;/strong&gt; places centralized management in Enterprise or Cloud. &lt;a href="https://docs.api7.ai/ai-gateway/on-premises/deployment" rel="noopener noreferrer"&gt;With Enterprise&lt;/a&gt;, the customer operates the gateway, &lt;code&gt;cp-api&lt;/code&gt;, &lt;code&gt;dp-manager&lt;/code&gt;, and PostgreSQL; production use needs a commercial license. &lt;a href="https://docs.api7.ai/ai-gateway/cloud/connect-a-gateway" rel="noopener noreferrer"&gt;With Cloud&lt;/a&gt;, API7 operates the control plane and the customer continues to run the gateway. &lt;strong&gt;API7 operates the control plane; gateway operations remain the customer's responsibility.&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;AISIX OSS request, token, and concurrency limits do not replace the &lt;a href="https://docs.api7.ai/ai-gateway/traffic-controls/budgets" rel="noopener noreferrer"&gt;monetary budgets in Enterprise or Cloud&lt;/a&gt;. Those budgets combine model pricing and aggregated spend. With &lt;code&gt;Hard stop at limit&lt;/code&gt; enabled, once the gateway receives an exhausted-budget state, it blocks matching subsequent calls. Budgets can also be configured for warnings without blocking. The request that crosses the threshold, and requests admitted while that state propagates, can still incur charges.&lt;/p&gt;

&lt;p&gt;When adding management services to an OSS deployment, AISIX retains its &lt;a href="https://docs.api7.ai/ai-gateway/getting-started/products-and-deployment-options" rel="noopener noreferrer"&gt;gateway runtime and proxy API conventions&lt;/a&gt;. You still need to plan the migration of managed resources, credentials, and policies. A team that has validated application integration can preserve the interface it has tested while adding centralized reports and budgets, with explicit ownership of the new services.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;LiteLLM Proxy&lt;/strong&gt; in its open-source edition includes an Admin UI, Virtual Keys, basic budgets, and spend tracking. In a &lt;a href="https://docs.litellm.ai/docs/proxy/deploy" rel="noopener noreferrer"&gt;monolithic deployment&lt;/a&gt;, the same service can handle model traffic, management APIs, and the UI. Check &lt;a href="https://docs.litellm.ai/docs/enterprise" rel="noopener noreferrer"&gt;Enterprise licensing&lt;/a&gt; for features such as audit logs and delegated administration. LiteLLM documents enabling Enterprise with a license on the same Gateway image, so that upgrade path does not require a separate control plane.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Kong AI Gateway&lt;/strong&gt;: in its &lt;a href="https://developer.konghq.com/ai-gateway/architecture/" rel="noopener noreferrer"&gt;Konnect hybrid deployment&lt;/a&gt;, Kong operates the control plane and the customer operates the gateway. &lt;a href="https://developer.konghq.com/dedicated-cloud-gateways/reference/#ai-gateway-20-on-dedicated-cloud-gateways" rel="noopener noreferrer"&gt;Dedicated Cloud&lt;/a&gt; puts both under Kong's operation, including gateway scaling, upgrades, and high availability. That changes the division of operational responsibility and should be evaluated separately from the self-hosted paths above.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Kong also distinguishes two monetary controls. &lt;a href="https://developer.konghq.com/ai-cost-management/budgets/" rel="noopener noreferrer"&gt;Konnect AI Cost Management budgets&lt;/a&gt; track spend and send alerts; requests can continue after a threshold is reached. Blocking by monetary usage requires separately configuring &lt;a href="https://developer.konghq.com/ai-gateway/policies/ai-rate-limiting-advanced/" rel="noopener noreferrer"&gt;AI rate limiting with the &lt;code&gt;cost&lt;/code&gt; strategy&lt;/a&gt;. A budget displayed in a spend dashboard does not establish request enforcement.&lt;/p&gt;

&lt;p&gt;For cost comparisons, itemize gateway and storage resources, backup and upgrade work, commercial licensing, and model usage charges. Estimate which manual tasks self-service removes and who maintains the additional services. Open source or fewer components alone cannot establish a lower total cost.&lt;/p&gt;

&lt;h2&gt;
  
  
  Make the decision with one set of acceptance criteria
&lt;/h2&gt;

&lt;p&gt;Use your immediate requirements to narrow the shortlist:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;AISIX OSS&lt;/strong&gt;: start here if you want file-based model routing, caller permissions, and usage limits without first running a control plane or configuration database. Include Redis for shared counters, and validate your rollout and rollback process.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;LiteLLM Proxy&lt;/strong&gt;: prioritize this path if you rely on its SDK or provider integrations, or want built-in Virtual Keys and basic monetary budgets in OSS. Include PostgreSQL, Redis for multiple instances, and their operational work in the evaluation, including when assessing &lt;a href="https://api7.ai/litellm-alternative" rel="noopener noreferrer"&gt;other self-hosted alternatives&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Kong AI Gateway&lt;/strong&gt;: consider this path if you already operate Kong and can reuse that experience. Check the required AI plugin licenses and dependencies for your chosen topology.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Start with one existing application. Add a second caller and verify model permissions and independent limits. Add a backup target and second gateway instance, then test failures, shared counters, configuration changes, and rollback. At each step, record the additional components, licensing conditions, and operational ownership. Choose based on what your team actually needs to deliver.&lt;/p&gt;

&lt;p&gt;Self-hosting the gateway alone does not determine where inference traffic goes: requests still reach the configured model upstreams, and logs and traces may have separate destinations. Include those destinations in the deployment inventory.&lt;/p&gt;

&lt;p&gt;To evaluate an open-source LLM gateway with file-based configuration, follow the &lt;a href="https://docs.api7.ai/ai-gateway/getting-started/gateway-quickstart" rel="noopener noreferrer"&gt;AISIX OSS quickstart&lt;/a&gt;. Get a real application request through first, then add your production requirements step by step.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://api7.ai/blog/self-hosted-ai-gateway-kong-litellm-aisix" rel="noopener noreferrer"&gt;Read the original on API7.ai&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>devops</category>
      <category>architecture</category>
    </item>
    <item>
      <title>AI Gateway Configuration Changes: Validate, Reload, Verify, and Roll Back</title>
      <dc:creator>Yilia</dc:creator>
      <pubDate>Fri, 13 Nov 2026 00:21:08 +0000</pubDate>
      <link>https://dev.to/yilialinn/ai-gateway-configuration-changes-validate-reload-verify-and-roll-back-3eba</link>
      <guid>https://dev.to/yilialinn/ai-gateway-configuration-changes-validate-reload-verify-and-roll-back-3eba</guid>
      <description>&lt;p&gt;Originally published by Yilia Lin on &lt;a href="https://api7.ai/blog/ai-gateway-configuration-change-runbook" rel="noopener noreferrer"&gt;API7.ai&lt;/a&gt; on 2026-11-09.&lt;/p&gt;

&lt;p&gt;This republication was prepared with AI assistance. The original article’s drafting process has not been verified.&lt;/p&gt;

&lt;p&gt;An AI gateway configuration change is complete only when four separate gates pass: the candidate file is valid, the gateway accepts it, the effective configuration changes as intended, and caller behavior still meets its contract. A healthy process alone is not proof that the new configuration was applied.&lt;/p&gt;

&lt;p&gt;This runbook uses &lt;strong&gt;AISIX OSS 1.8.0&lt;/strong&gt; in declarative file mode. It covers &lt;code&gt;resources.yaml&lt;/code&gt;, offline validation, &lt;code&gt;SIGHUP&lt;/code&gt; reload, &lt;code&gt;/status/config&lt;/code&gt;, negative caller tests, and rollback to a known-good file. AISIX Enterprise and AISIX Cloud use a control plane instead of this file-mode procedure; apply the same four gates through their documented change and status surfaces.&lt;/p&gt;

&lt;p&gt;The commands are documentation- and source-backed examples. They are not presented as a live production deployment test. Use an isolated gateway and non-production provider credentials before adapting them to your environment.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Four Gates
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Gate&lt;/th&gt;
&lt;th&gt;Question&lt;/th&gt;
&lt;th&gt;Required evidence&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Validate&lt;/td&gt;
&lt;td&gt;Can this exact file be decoded and resolved?&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;aisix validate&lt;/code&gt; exits zero with every referenced environment variable present&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Apply&lt;/td&gt;
&lt;td&gt;Did the running process accept a changed configuration?&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;/status/config&lt;/code&gt; reports &lt;code&gt;synced&lt;/code&gt;, no rejected entries, and a changed &lt;code&gt;apply_seq&lt;/code&gt; or configuration hash&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Verify&lt;/td&gt;
&lt;td&gt;Do allowed and denied callers see the intended behavior?&lt;/td&gt;
&lt;td&gt;Positive and negative request results plus gateway-visible logs or metrics&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Roll back&lt;/td&gt;
&lt;td&gt;Can operators restore the previous effective configuration?&lt;/td&gt;
&lt;td&gt;Known-good file reapplied, status reconverged, and the old caller contract rechecked&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Do not merge these gates into one “deployment succeeded” signal. A YAML parser cannot prove references resolve. A successful signal delivery cannot prove the reload was accepted. Readiness can remain healthy while the gateway serves its last valid configuration after a rejected reload.&lt;/p&gt;

&lt;h2&gt;
  
  
  Prerequisites and Starting State
&lt;/h2&gt;

&lt;p&gt;Prepare:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;an AISIX OSS 1.8.0 container running in file mode;&lt;/li&gt;
&lt;li&gt;the exact &lt;code&gt;resources.yaml&lt;/code&gt; mounted into the container;&lt;/li&gt;
&lt;li&gt;every environment variable referenced by that file;&lt;/li&gt;
&lt;li&gt;a known-good copy stored outside the container's writable layer;&lt;/li&gt;
&lt;li&gt;one allowed caller credential and one intentionally denied credential or model;&lt;/li&gt;
&lt;li&gt;a low-risk route and provider suitable for a smoke request; and&lt;/li&gt;
&lt;li&gt;a change record with owner, intent, affected resources, validation window, and rollback trigger.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The quickstart-style examples below assume a working directory containing both &lt;code&gt;config.yaml&lt;/code&gt; and &lt;code&gt;resources.yaml&lt;/code&gt;. The directory mount keeps the same file path visible across edits; a single-file bind mount can retain the old inode after an atomic host-side replacement. For a clean, isolated exercise, use these complete starting files:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="c1"&gt;# config.yaml
&lt;/span&gt;&lt;span class="na"&gt;resources_file&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;/etc/aisix/resources.yaml&lt;/span&gt;
&lt;span class="na"&gt;proxy&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;addr&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"0.0.0.0:3000"&lt;/span&gt;
&lt;span class="na"&gt;admin&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;enabled&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;
&lt;span class="na"&gt;observability&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;metrics&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;prometheus&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;enabled&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
      &lt;span class="na"&gt;addr&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"0.0.0.0:9090"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="c1"&gt;# resources.yaml
&lt;/span&gt;&lt;span class="na"&gt;_format_version&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"1"&lt;/span&gt;
&lt;span class="na"&gt;provider_keys&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
  &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="na"&gt;display_name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;openai-main&lt;/span&gt;
    &lt;span class="na"&gt;provider&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;openai&lt;/span&gt;
    &lt;span class="na"&gt;api_key&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;${OPENAI_API_KEY}&lt;/span&gt;
&lt;span class="na"&gt;models&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
  &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="na"&gt;display_name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;my-model&lt;/span&gt;
    &lt;span class="na"&gt;provider&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;openai&lt;/span&gt;
    &lt;span class="na"&gt;model_name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;gpt-4o-mini&lt;/span&gt;
    &lt;span class="na"&gt;provider_key&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;openai-main&lt;/span&gt;
&lt;span class="na"&gt;api_keys&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
  &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="na"&gt;display_name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;local-dev&lt;/span&gt;
    &lt;span class="na"&gt;key_env&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;CALLER_API_KEY&lt;/span&gt;
    &lt;span class="na"&gt;allowed_models&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"my-model"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Have your secret mechanism export a valid, non-production &lt;code&gt;OPENAI_API_KEY&lt;/code&gt; and a separate non-production &lt;code&gt;CALLER_API_KEY&lt;/code&gt; into the shell environment. An unexported shell variable can pass a local &lt;code&gt;test&lt;/code&gt; but will not reach &lt;code&gt;docker run -e&lt;/code&gt;. Confirm both are nonempty without printing them. This example makes a provider request and may incur provider charges. Start the isolated gateway before making the candidate edit:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;test&lt;/span&gt; -n &lt;span class="s2"&gt;"$OPENAI_API_KEY"&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;test&lt;/span&gt; -n &lt;span class="s2"&gt;"$CALLER_API_KEY"&lt;/span&gt;
docker run -d --name aisix-quickstart \
  -v &lt;span class="s2"&gt;"$PWD:/etc/aisix:ro"&lt;/span&gt; \
  -e OPENAI_API_KEY -e CALLER_API_KEY \
  -p 127.0.0.1:3000:3000 -p 127.0.0.1:9090:9090 \
  ghcr.io/api7/aisix:1.8.0
curl -fsS http://127.0.0.1:9090/status/config
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The expected starting status is &lt;code&gt;synced&lt;/code&gt;, with one model and one caller key in &lt;code&gt;applied.resource_counts&lt;/code&gt;. If startup fails, inspect &lt;code&gt;docker logs aisix-quickstart&lt;/code&gt;; the image entrypoint requires &lt;code&gt;/etc/aisix/config.yaml&lt;/code&gt;. The example below uses these names and addresses:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;container: aisix-quickstart
resources: $PWD/resources.yaml -&amp;gt; /etc/aisix/resources.yaml
proxy:     http://127.0.0.1:3000
status:    http://127.0.0.1:9090/status/config
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Do not put provider or caller secrets into the file, shell history, screenshots, or change record. Reference environment variables and provide them through the deployment's secret mechanism.&lt;/p&gt;

&lt;h2&gt;
  
  
  Gate 1: Validate the Exact Candidate
&lt;/h2&gt;

&lt;p&gt;Make a recoverable backup before editing:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;cp resources.yaml resources.known-good.yaml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For this exercise, replace &lt;code&gt;resources.yaml&lt;/code&gt; with the complete candidate below. It adds &lt;code&gt;my-model-next&lt;/code&gt; using the same provider key and &lt;code&gt;model_name: gpt-4o-mini&lt;/code&gt;, then permits the original caller to use it. This is an alias and access-list change; it does not test a new provider model.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="c1"&gt;# resources.yaml (complete candidate)
&lt;/span&gt;&lt;span class="na"&gt;_format_version&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"1"&lt;/span&gt;
&lt;span class="na"&gt;provider_keys&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
  &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="na"&gt;display_name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;openai-main&lt;/span&gt;
    &lt;span class="na"&gt;provider&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;openai&lt;/span&gt;
    &lt;span class="na"&gt;api_key&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;${OPENAI_API_KEY}&lt;/span&gt;
&lt;span class="na"&gt;models&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
  &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="na"&gt;display_name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;my-model&lt;/span&gt;
    &lt;span class="na"&gt;provider&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;openai&lt;/span&gt;
    &lt;span class="na"&gt;model_name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;gpt-4o-mini&lt;/span&gt;
    &lt;span class="na"&gt;provider_key&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;openai-main&lt;/span&gt;
  &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="na"&gt;display_name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;my-model-next&lt;/span&gt;
    &lt;span class="na"&gt;provider&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;openai&lt;/span&gt;
    &lt;span class="na"&gt;model_name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;gpt-4o-mini&lt;/span&gt;
    &lt;span class="na"&gt;provider_key&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;openai-main&lt;/span&gt;
&lt;span class="na"&gt;api_keys&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
  &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="na"&gt;display_name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;local-dev&lt;/span&gt;
    &lt;span class="na"&gt;key_env&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;CALLER_API_KEY&lt;/span&gt;
    &lt;span class="na"&gt;allowed_models&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"my-model"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"my-model-next"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If the edit uses only environment variables already present in the running container, validate through that container:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker &lt;span class="nb"&gt;exec&lt;/span&gt; aisix-quickstart \
  /usr/local/bin/aisix validate --resources /etc/aisix/resources.yaml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A successful validation reports that the file loaded and includes its resource count. Record the exit status and sanitized output.&lt;/p&gt;

&lt;p&gt;If the candidate introduces a new &lt;code&gt;${VARIABLE}&lt;/code&gt;, the running container cannot inherit a variable exported later on the host. Validate in a short-lived container with the complete environment instead:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker run --rm \
  -v &lt;span class="s2"&gt;"$PWD:/etc/aisix:ro"&lt;/span&gt; \
  -e OPENAI_API_KEY \
  -e CALLER_API_KEY \
  -e NEW_PROVIDER_API_KEY \
  --entrypoint /usr/local/bin/aisix \
  ghcr.io/api7/aisix:1.8.0 \
  validate --resources /etc/aisix/resources.yaml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;AISIX 1.8.0 runs the same file-loading pipeline for validation, startup, and &lt;code&gt;SIGHUP&lt;/code&gt;: environment interpolation, schema decoding, name-reference resolution, and enabled guardrail build checks. Review every warning as well as the exit status: some conditions warn rather than fail, including unattached guardrails and sanitized MCP tool-name collisions. Validation is stronger than YAML syntax checking, but it still does not call the provider or prove application behavior.&lt;/p&gt;

&lt;h3&gt;
  
  
  Negative Validation Is Part of the Evidence
&lt;/h3&gt;

&lt;p&gt;Keep one sanitized negative fixture for the class of change you are making. Examples include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;a model referencing a missing provider credential;&lt;/li&gt;
&lt;li&gt;a caller key allowing a model alias that does not exist;&lt;/li&gt;
&lt;li&gt;an invalid resource field or schema shape;&lt;/li&gt;
&lt;li&gt;a missing environment variable; or&lt;/li&gt;
&lt;li&gt;a duplicate or invalid resource identifier.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The negative fixture should fail validation. If both the good and deliberately broken files pass, the gate is not testing the dependency you think it is.&lt;/p&gt;

&lt;h2&gt;
  
  
  Gate 2: Apply the Candidate
&lt;/h2&gt;

&lt;p&gt;Capture the current status before reloading:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl -fsS http://127.0.0.1:9090/status/config &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; status.before.json
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For a candidate that introduces no new environment variables, request a reload:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker &lt;span class="nb"&gt;kill&lt;/span&gt; --signal=HUP aisix-quickstart
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If new environment variables are required, recreate the container with the same mounted file and the expanded environment. A signal cannot add variables to a running process:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker rm -f aisix-quickstart
docker run -d --name aisix-quickstart \
  -v &lt;span class="s2"&gt;"$PWD:/etc/aisix:ro"&lt;/span&gt; \
  -e OPENAI_API_KEY \
  -e CALLER_API_KEY \
  -e NEW_PROVIDER_API_KEY \
  -p 127.0.0.1:3000:3000 -p 127.0.0.1:9090:9090 \
  ghcr.io/api7/aisix:1.8.0
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The mounted directory must still contain &lt;code&gt;config.yaml&lt;/code&gt;; the container entrypoint exits if that file is absent. Preserve any other original flags, mounts, and environment settings when adapting this recreation command. The status and metrics listener is unauthenticated in this deployment mode, so keep it on host loopback or an equivalently private administrative interface. Recreation changes the failure surface. Verify startup, listener binding, secret availability, and the first configuration apply before sending traffic.&lt;/p&gt;

&lt;h2&gt;
  
  
  Gate 3: Prove the Effective State
&lt;/h2&gt;

&lt;p&gt;Fetch status again:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl -fsS http://127.0.0.1:9090/status/config &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; status.after.json
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Check the fields, not only the HTTP status:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;configuration state is &lt;code&gt;synced&lt;/code&gt;;&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;rejected&lt;/code&gt; is empty;&lt;/li&gt;
&lt;li&gt;the applied resource counts match the candidate;&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;apply_seq&lt;/code&gt; or the reported configuration hash changed when the effective content changed; and&lt;/li&gt;
&lt;li&gt;the applied timestamp is later than the change request.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;An identical reload may leave &lt;code&gt;apply_seq&lt;/code&gt; unchanged. Treat that as “no effective change,” not as a failed signal.&lt;/p&gt;

&lt;p&gt;AISIX 1.8.0 retains the last valid file-mode configuration when a later reload is rejected and reports the mismatch through &lt;code&gt;/status/config&lt;/code&gt;. This availability behavior is useful, but it creates an important distinction:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ready and serving != candidate accepted and current
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Do not use &lt;code&gt;/readyz&lt;/code&gt; alone as configuration evidence. Readiness answers whether the instance can serve traffic; configuration status answers which state it accepted and whether the source is in sync.&lt;/p&gt;

&lt;h3&gt;
  
  
  Verify Caller Behavior
&lt;/h3&gt;

&lt;p&gt;For the concrete alias change above, first check discovery with the allowed caller, then send small smoke requests to both the original and new aliases through the proxy. These commands require a working provider credential, network access, and an upstream model available to your account:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl -sS http://127.0.0.1:3000/v1/models \
  -H &lt;span class="s2"&gt;"Authorization: Bearer $CALLER_API_KEY"&lt;/span&gt;
curl -sS http://127.0.0.1:3000/v1/chat/completions \
  -H &lt;span class="s2"&gt;"Authorization: Bearer $CALLER_API_KEY"&lt;/span&gt; \
  -H &lt;span class="s1"&gt;'Content-Type: application/json'&lt;/span&gt; \
  -d &lt;span class="s1"&gt;'{"model":"my-model","messages":[{"role":"user","content":"Reply with OK."}]}'&lt;/span&gt;
curl -sS http://127.0.0.1:3000/v1/chat/completions \
  -H &lt;span class="s2"&gt;"Authorization: Bearer $CALLER_API_KEY"&lt;/span&gt; \
  -H &lt;span class="s1"&gt;'Content-Type: application/json'&lt;/span&gt; \
  -d &lt;span class="s1"&gt;'{"model":"my-model-next","messages":[{"role":"user","content":"Reply with OK."}]}'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Expect &lt;code&gt;my-model-next&lt;/code&gt; in the allowed model list and a successful chat response. A provider error is not proof of an accepted caller contract; check the provider key, model availability, and gateway logs. Send negative requests and record their response bodies and status codes:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl -sS -w &lt;span class="s1"&gt;'\nHTTP %{http_code}\n'&lt;/span&gt; http://127.0.0.1:3000/v1/models \
  -H &lt;span class="s1"&gt;'Authorization: Bearer deliberately-invalid-key'&lt;/span&gt;
curl -sS -w &lt;span class="s1"&gt;'\nHTTP %{http_code}\n'&lt;/span&gt; http://127.0.0.1:3000/v1/chat/completions \
  -H &lt;span class="s2"&gt;"Authorization: Bearer $CALLER_API_KEY"&lt;/span&gt; \
  -H &lt;span class="s1"&gt;'Content-Type: application/json'&lt;/span&gt; \
  -d &lt;span class="s1"&gt;'{"model":"unknown-alias","messages":[{"role":"user","content":"Reply with OK."}]}'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The exact error code can depend on the failed layer, so compare it with your version's documented behavior rather than asserting a universal code. Run at least these four request cases:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Test&lt;/th&gt;
&lt;th&gt;Expected result&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Existing allowed caller and model&lt;/td&gt;
&lt;td&gt;Still succeeds within its existing contract&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;New or changed allowed caller/model&lt;/td&gt;
&lt;td&gt;Succeeds and resolves the intended alias&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Invalid caller credential&lt;/td&gt;
&lt;td&gt;Fails at the expected authentication decision point&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Unknown model alias&lt;/td&gt;
&lt;td&gt;Fails with the documented client-visible error class&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;When the change affects streaming, tools, structured output, guardrails, caching, or fallback, add a contract test for that behavior. A non-streaming &lt;code&gt;200&lt;/code&gt; does not prove streaming compatibility, and a provider response does not prove a denial policy was evaluated.&lt;/p&gt;

&lt;p&gt;Record request IDs, requested aliases, resolved upstream targets when exposed, status or error class, and the gateway configuration hash. Do not record prompt bodies or secrets unless a separate privacy and retention policy permits it. The four request cases are an acceptance checklist, not a claim that this article's author executed them against a live gateway.&lt;/p&gt;

&lt;h2&gt;
  
  
  Gate 4: Roll Back Deliberately
&lt;/h2&gt;

&lt;p&gt;Define rollback triggers before applying the candidate. Examples:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;configuration state becomes &lt;code&gt;out_of_sync&lt;/code&gt;;&lt;/li&gt;
&lt;li&gt;any required resource is rejected;&lt;/li&gt;
&lt;li&gt;an allowed caller loses access;&lt;/li&gt;
&lt;li&gt;a denied caller gains access;&lt;/li&gt;
&lt;li&gt;streaming or tool behavior violates the contract;&lt;/li&gt;
&lt;li&gt;error rate or latency crosses the preapproved window; or&lt;/li&gt;
&lt;li&gt;the new provider or dependency is unavailable.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Restore the known-good file through your deployment mechanism, validate it, and then reload or recreate the container according to its environment-variable needs. For production, use the deployment's atomic file replacement method and keep the directory mounted so the gateway sees the new inode. Do not edit the live file repeatedly until the status turns green; that destroys the exact candidate and makes the incident harder to reconstruct.&lt;/p&gt;

&lt;p&gt;For a local exercise:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;cp resources.known-good.yaml resources.yaml
docker &lt;span class="nb"&gt;exec&lt;/span&gt; aisix-quickstart \
  /usr/local/bin/aisix validate --resources /etc/aisix/resources.yaml
docker &lt;span class="nb"&gt;kill&lt;/span&gt; --signal=HUP aisix-quickstart
curl -fsS http://127.0.0.1:9090/status/config
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then repeat the positive and negative caller checks. In this exercise, &lt;code&gt;my-model&lt;/code&gt; should remain available and &lt;code&gt;my-model-next&lt;/code&gt; should disappear from discovery and fail as an unknown alias. Rollback is complete only when the previous behavior is restored, not when the old file is copied back. If the candidate introduced a new environment variable and required recreation, restore the original environment and other container settings as part of the rollback; &lt;code&gt;SIGHUP&lt;/code&gt; cannot remove or add process environment variables.&lt;/p&gt;

&lt;h2&gt;
  
  
  Troubleshoot by Failure Stage
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Symptom&lt;/th&gt;
&lt;th&gt;First check&lt;/th&gt;
&lt;th&gt;Likely boundary&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;validate&lt;/code&gt; reports a missing variable&lt;/td&gt;
&lt;td&gt;Container environment and secret name&lt;/td&gt;
&lt;td&gt;Deployment/secret delivery&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Validation reports an unknown reference&lt;/td&gt;
&lt;td&gt;Resource name and apply order&lt;/td&gt;
&lt;td&gt;Candidate configuration&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Signal sent but &lt;code&gt;apply_seq&lt;/code&gt; unchanged&lt;/td&gt;
&lt;td&gt;Compare configuration hash and file mount&lt;/td&gt;
&lt;td&gt;No effective change or wrong mounted file&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Gateway ready but status &lt;code&gt;out_of_sync&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;rejected&lt;/code&gt; entries and last applied hash&lt;/td&gt;
&lt;td&gt;Candidate rejected; last valid state still serving&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;New alias returns not found&lt;/td&gt;
&lt;td&gt;Applied model resource and caller allowlist&lt;/td&gt;
&lt;td&gt;Resource or access mapping&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Request reaches wrong provider&lt;/td&gt;
&lt;td&gt;Requested alias and resolved target&lt;/td&gt;
&lt;td&gt;Model/routing configuration&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Only streaming or tools fail&lt;/td&gt;
&lt;td&gt;Endpoint-specific contract test&lt;/td&gt;
&lt;td&gt;Provider adapter or model capability&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Rollback file validates but behavior differs&lt;/td&gt;
&lt;td&gt;Environment, credentials, and dependent services&lt;/td&gt;
&lt;td&gt;Incomplete rollback boundary&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  File Mode, Enterprise, and Cloud Are Different Paths
&lt;/h2&gt;

&lt;p&gt;This procedure is for AISIX OSS file mode. A directly operated OSS gateway can also use etcd; that path has watch, revision, and connectivity semantics that are not equivalent to &lt;code&gt;SIGHUP&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;AISIX Enterprise and AISIX Cloud distribute configuration through their control planes. Do not copy file-mode commands into those deployments. Use their version-specific status, rollout, and audit surfaces, and validate mixed-version compatibility before applying a field that an older gateway cannot load.&lt;/p&gt;

&lt;p&gt;Across all modes, preserve the same evidence chain:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;candidate -&amp;gt; validation -&amp;gt; accepted revision -&amp;gt; caller contract -&amp;gt; rollback proof
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Definition of Done
&lt;/h2&gt;

&lt;p&gt;A configuration change is complete when:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;the exact candidate and known-good files are retained with hashes;&lt;/li&gt;
&lt;li&gt;offline validation passed with the same environment-variable set used at apply time;&lt;/li&gt;
&lt;li&gt;a deliberately broken fixture failed for the expected reason;&lt;/li&gt;
&lt;li&gt;the gateway reported the intended effective state, not only process readiness;&lt;/li&gt;
&lt;li&gt;positive and negative caller tests passed through the real gateway path;&lt;/li&gt;
&lt;li&gt;version, request, configuration, and operator evidence can be correlated without secrets;&lt;/li&gt;
&lt;li&gt;rollback triggers were declared before rollout; and&lt;/li&gt;
&lt;li&gt;rollback was either exercised or proven through a recent equivalent drill.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The goal is not zero configuration failures. It is a change process in which a rejected candidate is visible, the last valid state is understood, and operators can restore the caller contract without guessing.&lt;/p&gt;

&lt;p&gt;Start with the &lt;a href="https://docs.api7.ai/ai-gateway/deployment/configuration-propagation" rel="noopener noreferrer"&gt;AISIX configuration propagation guide&lt;/a&gt;, then adapt this runbook to the deployment mode and release you actually operate.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://api7.ai/blog/ai-gateway-configuration-change-runbook" rel="noopener noreferrer"&gt;Read the original on API7.ai&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>devops</category>
      <category>ai</category>
      <category>api</category>
    </item>
    <item>
      <title>Strict JSON Parsing Is Part of Your API Contract</title>
      <dc:creator>Yilia</dc:creator>
      <pubDate>Wed, 11 Nov 2026 14:29:51 +0000</pubDate>
      <link>https://dev.to/yilialinn/strict-json-parsing-is-part-of-your-api-contract-3jda</link>
      <guid>https://dev.to/yilialinn/strict-json-parsing-is-part-of-your-api-contract-3jda</guid>
      <description>&lt;p&gt;Originally published by Yilia Lin on &lt;a href="https://api7.ai/blog/strict-json-api-contracts" rel="noopener noreferrer"&gt;API7.ai&lt;/a&gt; on 2026-11-10.&lt;/p&gt;

&lt;p&gt;This republication was prepared with AI assistance. The original article’s drafting process has not been verified.&lt;/p&gt;

&lt;p&gt;Two services can accept the same JSON bytes and still disagree about what the request means. One parser may keep the first occurrence of a duplicate member, another may keep the last, and a third may reject the object. If an API gateway, authorization layer, and business service make different choices, a request can pass one check and reach another component with changed meaning.&lt;/p&gt;

&lt;p&gt;Go 1.27 has made that old interoperability problem newly visible. The Go team made &lt;a href="https://go.dev/blog/jsonv2" rel="noopener noreferrer"&gt;&lt;code&gt;encoding/json/v2&lt;/code&gt; and &lt;code&gt;encoding/json/jsontext&lt;/code&gt; generally available&lt;/a&gt; on November 4, 2026. The release attracted a substantial &lt;a href="https://news.ycombinator.com/item?id=50369106" rel="noopener noreferrer"&gt;Hacker News discussion&lt;/a&gt;, but the lesson for API teams is larger than a Go package upgrade: JSON parsing behavior is part of the API contract, even when OpenAPI never mentions it.&lt;/p&gt;

&lt;p&gt;The goal is not to demand one parser for every component. It is to define one accepted wire format, test it at every boundary, and make rejection explicit when components could interpret a payload differently.&lt;/p&gt;

&lt;h2&gt;
  
  
  Key Takeaways
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;JSON syntax, schema validation, and business validation answer different questions.&lt;/li&gt;
&lt;li&gt;Go's v2 defaults reject invalid UTF-8 and duplicate object member names; v1 compatibility remains available.&lt;/li&gt;
&lt;li&gt;A gateway schema check should not be assumed to reproduce an application's parser semantics.&lt;/li&gt;
&lt;li&gt;Migration tests need malformed and ambiguous byte sequences, not only valid Go values.&lt;/li&gt;
&lt;li&gt;Rejecting ambiguity early is useful, but the service still owns authorization and business invariants.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The Contract Begins Before the Schema
&lt;/h2&gt;

&lt;p&gt;An OpenAPI schema can say that &lt;code&gt;role&lt;/code&gt; is a string with two allowed values. It cannot help if two parsers disagree about which &lt;code&gt;role&lt;/code&gt; value exists:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nl"&gt;"user"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"42"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nl"&gt;"role"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"viewer"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nl"&gt;"role"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"admin"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://www.rfc-editor.org/rfc/rfc8259#section-4" rel="noopener noreferrer"&gt;RFC 8259&lt;/a&gt; says object member names should be unique and warns that behavior becomes unpredictable when they are not. Implementations have historically differed: some report the last pair, some report an error, and some expose every pair. A schema engine usually receives a decoded object after that choice has already been made.&lt;/p&gt;

&lt;p&gt;The same separation appears with invalid UTF-8, trailing data, case-insensitive field matching, unknown members, number precision, and &lt;code&gt;null&lt;/code&gt;. These are not all syntax errors, and different APIs may intentionally choose different policies. The contract must say which bytes are acceptable and what each accepted value means.&lt;/p&gt;

&lt;p&gt;Model the request path as four layers:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fqkh0zqcfq66ftm4m28gu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fqkh0zqcfq66ftm4m28gu.png" alt="HTTP body bytes through JSON syntax, schema and size, data binding, and authorization and business rules" width="798" height="153"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;pre data-lang="mermaid"&gt;&lt;code&gt;flowchart LR
    Bytes[HTTP body bytes] --&amp;gt; Syntax[JSON syntax policy]
    Syntax --&amp;gt; Schema[Schema and size policy]
    Schema --&amp;gt; Binding[Language data binding]
    Binding --&amp;gt; Rules[Authorization and business rules]&lt;/code&gt;&lt;/pre&gt;



&lt;p&gt;The layers can run in more than one component. What matters is that a later layer never receives a meaning that an earlier policy did not evaluate.&lt;/p&gt;

&lt;h2&gt;
  
  
  What Go 1.27 Changes
&lt;/h2&gt;

&lt;p&gt;The original &lt;code&gt;encoding/json&lt;/code&gt; package remains supported under the Go compatibility promise. Go 1.27 adds stable v2 packages rather than silently changing every v1 call site. That is important because stricter behavior can break an application that unknowingly depends on older defaults.&lt;/p&gt;

&lt;p&gt;The Go announcement identifies several v2 defaults with contract impact:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;invalid UTF-8 produces an error;&lt;/li&gt;
&lt;li&gt;a duplicate object member name produces an error;&lt;/li&gt;
&lt;li&gt;object members match Go struct fields case-sensitively;&lt;/li&gt;
&lt;li&gt;nil slices and maps marshal as empty arrays and objects rather than &lt;code&gt;null&lt;/code&gt;;&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;time.Duration&lt;/code&gt; has no implicit representation and requires an explicit choice.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These are v2 defaults, not claims about every JSON implementation. Most behavior differences have compatibility options, and v1 and v2 can interoperate while call sites migrate. That makes a staged rollout possible, but it also creates a mixed-mode period in which two services—or two paths inside one service—may apply different rules.&lt;/p&gt;

&lt;p&gt;Do not test the migration only by marshaling a struct with v1 and v2 and comparing happy-path output. Start with captured request bytes and include the cases that motivated the new defaults.&lt;/p&gt;

&lt;h2&gt;
  
  
  Keep Gateway and Application Responsibilities Separate
&lt;/h2&gt;

&lt;p&gt;An API gateway is a useful place to enforce a documented request envelope: methods, content type, maximum body size, required properties, types, lengths, and enumerated values. It is not automatically the final authority on how an application parser binds JSON into language types.&lt;/p&gt;

&lt;p&gt;In Apache APISIX 3.19, the &lt;a href="https://apisix.apache.org/docs/apisix/3.19/plugins/request-validation/" rel="noopener noreferrer"&gt;&lt;code&gt;request-validation&lt;/code&gt; plugin&lt;/a&gt; can validate headers and a decoded request body against JSON Schema. Its documented default maximum buffered request body is 67,108,864 bytes, and its default rejection status is 400. Configure a smaller route-specific limit when the API does not need such a large body.&lt;/p&gt;

&lt;p&gt;The tagged &lt;a href="https://github.com/apache/apisix/blob/3.19.0/apisix/plugins/request-validation.lua" rel="noopener noreferrer"&gt;APISIX 3.19 implementation&lt;/a&gt; reads the body, decodes it, and passes the resulting object to schema validation. After a JSON body passes, the plugin re-encodes that decoded object and replaces the request body sent upstream. This keeps the object checked by the schema aligned with the JSON representation forwarded on that managed path.&lt;/p&gt;

&lt;p&gt;That normalization has a precise boundary. The documentation does not promise that duplicate JSON member names are rejected; their treatment occurs during APISIX's decode step before schema validation. Re-encoding also does not control how the application binds the normalized JSON into language types, and it does not cover a client that can reach the service without this plugin. Therefore, test the managed path, application binding, and any direct or alternate path rather than claiming that a body schema makes every parser equivalent.&lt;/p&gt;

&lt;p&gt;That boundary supports a safer design:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Layer&lt;/th&gt;
&lt;th&gt;Good enforcement target&lt;/th&gt;
&lt;th&gt;Do not infer&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Gateway route&lt;/td&gt;
&lt;td&gt;Method, content type, route-specific size, schema, normalized JSON forwarded after validation&lt;/td&gt;
&lt;td&gt;Duplicate-name rejection, business authorization, or application binding equivalence&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;JSON parser&lt;/td&gt;
&lt;td&gt;UTF-8, duplicate names, trailing data, numeric representation&lt;/td&gt;
&lt;td&gt;Schema completeness or caller permission&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Data binding&lt;/td&gt;
&lt;td&gt;Field names, unknown fields, &lt;code&gt;null&lt;/code&gt;, type conversion&lt;/td&gt;
&lt;td&gt;Domain validity&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Application&lt;/td&gt;
&lt;td&gt;Tenant, object ownership, state transition, invariants&lt;/td&gt;
&lt;td&gt;That an earlier check covered every alternate path&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Send the exact same raw-byte corpus through the complete managed route and every alternate path. Capture the normalized body forwarded by the gateway, then verify the application's binding and outcome. A decoded object used as the test input is insufficient evidence because it has already discarded the ambiguity you need to detect.&lt;/p&gt;

&lt;h2&gt;
  
  
  Build an Ambiguity Test Corpus
&lt;/h2&gt;

&lt;p&gt;Create a small, versioned set of raw HTTP requests. It should include valid examples plus cases such as:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;a duplicate security-relevant member with conflicting values;&lt;/li&gt;
&lt;li&gt;an unknown member next to a valid object;&lt;/li&gt;
&lt;li&gt;invalid UTF-8 inside a string;&lt;/li&gt;
&lt;li&gt;a valid JSON value followed by trailing non-whitespace data;&lt;/li&gt;
&lt;li&gt;field names that differ only by case;&lt;/li&gt;
&lt;li&gt;integers beyond the exact range used by a downstream runtime;&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;null&lt;/code&gt;, absent, empty-array, and empty-object variants;&lt;/li&gt;
&lt;li&gt;duplicate or conflicting &lt;code&gt;Content-Type&lt;/code&gt; headers;&lt;/li&gt;
&lt;li&gt;compressed and uncompressed bodies near the configured limits.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;For each request, record the expected outcome at every hop: accepted or rejected, status code, stable error identifier, and whether the upstream received a request. Treat a disagreement as a release blocker when it can change authentication, authorization, money, quota, routing, or object ownership.&lt;/p&gt;

&lt;p&gt;API tests should also compare versions during migration. Run the corpus against the current v1 path, the proposed v2 path, and any compatibility options. A deliberate behavior change belongs in release notes and consumer tests; an accidental difference belongs in the defect queue.&lt;/p&gt;

&lt;p&gt;API7's guide to &lt;a href="https://api7.ai/blog/detect-breaking-api-changes" rel="noopener noreferrer"&gt;preventing breaking API changes&lt;/a&gt; covers broader compatibility practices. The strict-parser corpus adds a lower layer: it verifies that both versions agree on which request exists before comparing the response.&lt;/p&gt;

&lt;h2&gt;
  
  
  Return Errors Clients Can Act On
&lt;/h2&gt;

&lt;p&gt;Strict rejection helps only when clients can distinguish a permanent contract error from a transient infrastructure failure. A duplicate member or invalid UTF-8 should not look like an upstream timeout that invites a retry storm.&lt;/p&gt;

&lt;p&gt;Use a stable error code, a concise message, and a request identifier that is generated or overwritten at a trusted boundary. Avoid echoing the entire malformed body into logs or responses. The raw body may contain credentials or personal data, and some invalid byte sequences are unsafe to render.&lt;/p&gt;

&lt;p&gt;The article on &lt;a href="https://api7.ai/blog/structured-errors-http-apis" rel="noopener noreferrer"&gt;structured HTTP API errors&lt;/a&gt; explains the response side of that contract. Align those errors with gateway rejections so a client does not need unrelated parsers for every failure source.&lt;/p&gt;

&lt;p&gt;Observability should count rejection classes without treating every rejected request as an attack. A deployment with new v2 defaults may initially expose legitimate clients that sent duplicate names accidentally. Measure by route, client identity when trustworthy, parser version, and reason; then fix or explicitly grandfather the contract instead of weakening the default invisibly.&lt;/p&gt;

&lt;h2&gt;
  
  
  Migrate One Boundary at a Time
&lt;/h2&gt;

&lt;p&gt;A practical Go migration can proceed in four stages:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Inventory parser call sites.&lt;/strong&gt; Include custom &lt;code&gt;UnmarshalJSON&lt;/code&gt; methods, stream decoders, middleware, signature verification, and test helpers.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Run v1 and v2 in comparison mode.&lt;/strong&gt; Use production-shaped samples in a protected environment and record accept/reject and bound-value differences. Do not process the request twice in production when that would repeat side effects.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Choose compatibility options explicitly.&lt;/strong&gt; Document each retained v1 behavior, its owner, and an exit condition. Avoid a single global switch when routes have different contracts.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Change the authoritative path.&lt;/strong&gt; Release client-facing behavior notes, watch rejection metrics, and keep a bounded rollback that restores the previous parser without changing unrelated API policy.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Go's migration support makes gradual adoption possible; it does not decide which behavior your API promises. That decision belongs to the API owner and must be reflected in specifications, examples, tests, gateway policy, and service code.&lt;/p&gt;

&lt;h2&gt;
  
  
  Make One Meaning the Success Condition
&lt;/h2&gt;

&lt;p&gt;Strict JSON parsing is not a language preference. It is a way to prevent a request from changing meaning as it moves between enforcement points.&lt;/p&gt;

&lt;p&gt;Start with one security-sensitive write API. Capture raw requests, define duplicate-name and UTF-8 behavior, set a route-specific body limit, and run the ambiguity corpus through the gateway and service. Then migrate the application parser with comparison evidence rather than assuming valid fixtures cover the contract.&lt;/p&gt;

&lt;p&gt;For a managed gateway enforcement layer, review &lt;a href="https://api7.ai/enterprise" rel="noopener noreferrer"&gt;API7 Enterprise&lt;/a&gt; and the &lt;a href="https://docs.api7.ai/api7-gateway/getting-started/overview" rel="noopener noreferrer"&gt;API7 Gateway documentation&lt;/a&gt;, while keeping parser-specific semantics pinned to the exact service runtime you deploy.&lt;/p&gt;

</description>
      <category>api</category>
      <category>json</category>
    </item>
    <item>
      <title>Partial API Outages Need Retry Budgets, Not Retry Storms</title>
      <dc:creator>Yilia</dc:creator>
      <pubDate>Tue, 10 Nov 2026 11:14:42 +0000</pubDate>
      <link>https://dev.to/api7/partial-api-outages-need-retry-budgets-not-retry-storms-i9k</link>
      <guid>https://dev.to/api7/partial-api-outages-need-retry-budgets-not-retry-storms-i9k</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F0gggr9rkg5r6tv5lj1id.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F0gggr9rkg5r6tv5lj1id.webp" alt="Partial API Outages Need Retry Budgets, Not Retry Storms" width="800" height="420"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Originally published by Yilia Lin on &lt;a href="https://api7.ai/blog/api-retry-budgets-partial-outages" rel="noopener noreferrer"&gt;API7.ai&lt;/a&gt; on November 10, 2026.&lt;/p&gt;

&lt;p&gt;This syndication copy was prepared with AI assistance. Original drafting provenance has not been verified.&lt;/p&gt;

&lt;p&gt;During a partial outage, some requests succeed while others time out. A client may not know whether a write happened before the connection disappeared. A “retry three times” rule adds traffic and can duplicate effects.&lt;/p&gt;

&lt;p&gt;GitHub offered a current example on November 4, 2026. Its &lt;a href="https://www.githubstatus.com/incidents/smtdswd1h2w4" rel="noopener noreferrer"&gt;permanent incident record&lt;/a&gt; reported elevated errors and intermittent failures affecting Git Operations, API Requests, Issues, and Pull Requests during a morning incident. The accompanying &lt;a href="https://news.ycombinator.com/item?id=50363274" rel="noopener noreferrer"&gt;Hacker News discussion&lt;/a&gt; shows the user experience: results differed by operation and region, and repeated commands became an improvised recovery strategy.&lt;/p&gt;

&lt;p&gt;GitHub said a root-cause analysis would follow; this article does not infer a cause. When a dependency is partly available, which layer may retry an operation, for how long, and with what protection against duplicate work?&lt;/p&gt;

&lt;h2&gt;
  
  
  Key Takeaways
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;A transport failure does not prove that an upstream operation failed before taking effect.&lt;/li&gt;
&lt;li&gt;Retry policy starts with operation semantics and failure phase, not a universal attempt count.&lt;/li&gt;
&lt;li&gt;Give one layer ownership of retries and enforce a total deadline and attempt budget.&lt;/li&gt;
&lt;li&gt;Use exponential backoff with jitter for retryable transient failures.&lt;/li&gt;
&lt;li&gt;A gateway can bound upstream attempts and timeouts; it cannot make a non-idempotent business operation safe.&lt;/li&gt;
&lt;li&gt;Test delayed success, lost responses, overload, and recovery—not only immediate connection refusal.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Classify the Operation Before the Error
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://www.rfc-editor.org/rfc/rfc9110#section-9.2.2" rel="noopener noreferrer"&gt;HTTP Semantics&lt;/a&gt; defines an idempotent method as one whose intended effect is the same after one or several identical requests. PUT, DELETE, and safe methods are idempotent by definition; POST is not generally idempotent. A client can retry an idempotent request automatically after a communication failure, while retrying a non-idempotent request requires knowledge that the request is safe or a way to detect whether it already succeeded.&lt;/p&gt;

&lt;p&gt;Method names are only the starting point. A nominally idempotent handler can still append duplicate audit events or send repeated notifications. An idempotency key can make a particular POST operation retry-safe when the service binds the key to the caller and request payload, coordinates concurrent uses, and reliably records the effect and outcome.&lt;/p&gt;

&lt;p&gt;For example, atomically reserve a key before processing and make concurrent duplicates wait or return an in-progress result; reject reuse with a different payload. A reservation alone is not enough: if the service crashes after charging a payment but before recording the outcome, blindly executing again can charge twice. Couple the reservation, effect, and outcome transactionally where possible, or use a durable recovery and reconciliation protocol with an idempotent downstream operation. Define expiry and recovery for abandoned in-progress records. The &lt;a href="https://aws.amazon.com/builders-library/making-retries-safe-with-idempotent-APIs/" rel="noopener noreferrer"&gt;AWS idempotent API guidance&lt;/a&gt; explains the atomicity requirement.&lt;/p&gt;

&lt;p&gt;Create an operation registry rather than a retry rule per status code:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Operation class&lt;/th&gt;
&lt;th&gt;Example&lt;/th&gt;
&lt;th&gt;Automatic retry condition&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Read with no side effect&lt;/td&gt;
&lt;td&gt;Fetch deployment state&lt;/td&gt;
&lt;td&gt;Within deadline after a retryable transport or service failure&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Idempotent state change&lt;/td&gt;
&lt;td&gt;Replace configuration at a known resource URI&lt;/td&gt;
&lt;td&gt;Same precondition and payload; stop on conflict&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Deduplicated command&lt;/td&gt;
&lt;td&gt;Create payment with an idempotency key&lt;/td&gt;
&lt;td&gt;Key reservation, effect, and recovery prevent concurrent or crash-induced duplicates&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Non-idempotent command&lt;/td&gt;
&lt;td&gt;Trigger an unkeyed deployment&lt;/td&gt;
&lt;td&gt;Do not automatically retry after an ambiguous send&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Record the owner, attempt and concurrency limits, deadline, and reconciliation method.&lt;/p&gt;

&lt;h2&gt;
  
  
  Locate the Failure Phase
&lt;/h2&gt;

&lt;p&gt;“Timeout” compresses several different states:&lt;br&gt;
&lt;/p&gt;

&lt;pre data-lang="mermaid"&gt;&lt;code&gt;flowchart LR
    Client --&amp;gt;|request| Gateway[API gateway]
    Gateway --&amp;gt;|attempt| Dependency[Dependency API]
    Dependency --&amp;gt;|effect may commit| Store[(State)]
    Dependency -. response lost or delayed .-&amp;gt; Gateway
    Gateway -. bounded result .-&amp;gt; Client&lt;/code&gt;&lt;/pre&gt;



&lt;ul&gt;
&lt;li&gt;A connection may fail before the request is sent.&lt;/li&gt;
&lt;li&gt;The body may be partly or fully sent before the connection drops.&lt;/li&gt;
&lt;li&gt;The dependency may commit the operation and lose the response.&lt;/li&gt;
&lt;li&gt;A queue may accept work but delay its webhook or status update.&lt;/li&gt;
&lt;li&gt;The gateway may time out while the dependency continues processing.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Only the first case clearly indicates that the dependency did not receive the request. Even then, name resolution, proxies, and reused connections can complicate what the client observes. Log the phase you can establish, but do not turn “no response” into “no side effect.”&lt;/p&gt;

&lt;p&gt;For ambiguous writes, reconcile. Query by idempotency key, operation ID, resource version, or business key before sending another command. If the API offers no reconciliation key, the safe answer may be to stop and require operator or application-specific recovery.&lt;/p&gt;

&lt;h2&gt;
  
  
  Give Retries One Owner
&lt;/h2&gt;

&lt;p&gt;A client, SDK, service mesh, gateway, and backend library can each retry. Three attempts at three layers can multiply upstream calls, particularly when an overloaded dependency receives synchronized retries.&lt;/p&gt;

&lt;p&gt;Choose the layer with the best view of operation semantics. An SDK may understand idempotency and client deadlines; a gateway may see upstream availability and enforce a fleet-wide attempt ceiling. Other layers should either disable retries or consume a shared budget.&lt;/p&gt;

&lt;p&gt;Express the budget as constraints rather than one magic number:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;maximum upstream attempts, including the first;&lt;/li&gt;
&lt;li&gt;end-to-end deadline;&lt;/li&gt;
&lt;li&gt;per-attempt connect, send, and read timeouts;&lt;/li&gt;
&lt;li&gt;maximum concurrent retries per route or dependency;&lt;/li&gt;
&lt;li&gt;retryable failure classes;&lt;/li&gt;
&lt;li&gt;backoff schedule with jitter;&lt;/li&gt;
&lt;li&gt;maximum stale or fallback response age, if a fallback exists.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The &lt;a href="https://aws.amazon.com/builders-library/timeouts-retries-and-backoff-with-jitter/" rel="noopener noreferrer"&gt;AWS Builders' Library guidance&lt;/a&gt; explains why retries can amplify overload and why backoff plus jitter spreads recovery traffic. A retry budget should shrink when the original request volume or error rate rises, not remain an unlimited percentage of a failing dependency's capacity.&lt;/p&gt;

&lt;h2&gt;
  
  
  Configure APISIX Without Inventing Idempotency
&lt;/h2&gt;

&lt;p&gt;Apache APISIX 3.19 exposes upstream &lt;code&gt;retries&lt;/code&gt;, &lt;code&gt;retry_timeout&lt;/code&gt;, and separate connect, send, and read timeouts in the &lt;a href="https://apisix.apache.org/docs/apisix/3.19/admin-api/#upstream" rel="noopener noreferrer"&gt;Admin API upstream schema&lt;/a&gt;. Its documentation says &lt;code&gt;retries&lt;/code&gt; defaults according to the number of available backend nodes; setting it to &lt;code&gt;0&lt;/code&gt; disables retries. Setting &lt;code&gt;retry_timeout&lt;/code&gt; to &lt;code&gt;0&lt;/code&gt; disables that retry timeout.&lt;/p&gt;

&lt;p&gt;Those knobs bound gateway behavior. They do not establish whether a request is safe to repeat, whether an upstream committed a side effect, or whether another client layer is also retrying. APISIX configures retry attempts, while the effective NGINX proxy settings and request phase determine whether another upstream attempt is eligible.&lt;/p&gt;

&lt;p&gt;Under the &lt;a href="https://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_next_upstream" rel="noopener noreferrer"&gt;NGINX HTTP proxy defaults&lt;/a&gt;, &lt;code&gt;error&lt;/code&gt; and &lt;code&gt;timeout&lt;/code&gt; are eligible failure types; configured settings can differ. A &lt;code&gt;POST&lt;/code&gt;, &lt;code&gt;LOCK&lt;/code&gt;, or &lt;code&gt;PATCH&lt;/code&gt; already sent upstream is normally not passed to another server unless &lt;code&gt;non_idempotent&lt;/code&gt; is enabled. Switching is possible only before anything has been sent to the client; with request buffering disabled, a body that has begun sending upstream cannot be passed to another server. Before enabling retries on a write route, test the effective configuration, method, body behavior, failure phase, and upstream implementation against the pinned APISIX and NGINX versions you operate.&lt;/p&gt;

&lt;p&gt;Use route-specific policy. A GET route backed by several equivalent replicas may justify a small retry budget. A POST command without an idempotency key may justify &lt;code&gt;retries: 0&lt;/code&gt;, a short deadline, and an explicit unknown-outcome response from the application. A large streamed upload has different send and replay costs from a small metadata read.&lt;/p&gt;

&lt;p&gt;Health checks and circuit breakers solve adjacent problems, not the same one. A health check can remove a failing node after evidence accumulates; it does not explain an already ambiguous request. A breaker can reduce calls after configured failures; it does not deduplicate committed work. API7's earlier overview of &lt;a href="https://api7.ai/blog/10-common-api-resilience-design-patterns" rel="noopener noreferrer"&gt;API resilience patterns&lt;/a&gt; describes those mechanisms broadly. The retry-budget layer connects them to one operation's semantics.&lt;/p&gt;

&lt;h2&gt;
  
  
  Make Overload Responses Actionable
&lt;/h2&gt;

&lt;p&gt;A dependency that knows it is overloaded can return 429 or 503 and may include &lt;code&gt;Retry-After&lt;/code&gt;. Clients should honor a valid instruction within their own deadline and retry budget, rather than layering an unrelated rapid loop on top. Absence of &lt;code&gt;Retry-After&lt;/code&gt; is not permission for immediate synchronized retries.&lt;/p&gt;

&lt;p&gt;Separate permanent from transient failures:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;most authentication, authorization, schema, and business-rule 4xx responses should not be retried unchanged;&lt;/li&gt;
&lt;li&gt;a conflict may require reading the new resource version and making a new decision;&lt;/li&gt;
&lt;li&gt;429 or 503 may be retryable after delay when the operation is safe;&lt;/li&gt;
&lt;li&gt;a timeout or connection loss needs the failure-phase and idempotency analysis above;&lt;/li&gt;
&lt;li&gt;a malformed response is not automatically safer to repeat than an explicit error.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Return a stable error class and operation identifier without exposing secrets or raw upstream bodies.&lt;/p&gt;

&lt;h2&gt;
  
  
  Observe the Budget, Not Just the Error Rate
&lt;/h2&gt;

&lt;p&gt;An outage dashboard needs to show how recovery policy changes load. Record:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;original requests and additional attempts separately;&lt;/li&gt;
&lt;li&gt;attempt number and retry owner;&lt;/li&gt;
&lt;li&gt;remaining deadline at each attempt;&lt;/li&gt;
&lt;li&gt;failure phase and selected upstream;&lt;/li&gt;
&lt;li&gt;idempotency-key presence, without logging sensitive key material;&lt;/li&gt;
&lt;li&gt;outcome: succeeded, rejected, timed out, reconciled, or unknown;&lt;/li&gt;
&lt;li&gt;time spent in backoff and time spent waiting on the dependency.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Use a gateway-generated or sanitized request identifier for traffic correlation. A caller-supplied identifier is useful for joining events only after collision and spoofing risks are handled; it is not trusted identity.&lt;/p&gt;

&lt;p&gt;Alert on retry amplification—the ratio of upstream attempts to original requests—alongside latency and error rate. A falling client error rate can hide a large increase in dependency load if retries eventually succeed.&lt;/p&gt;

&lt;h2&gt;
  
  
  Test the Ambiguous Paths
&lt;/h2&gt;

&lt;p&gt;Failure testing should include more than returning 503 immediately. Use a staging dependency or controlled fault injection to simulate:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;connection refusal before send;&lt;/li&gt;
&lt;li&gt;slow connect, slow response headers, and slow body;&lt;/li&gt;
&lt;li&gt;a committed write followed by a dropped response;&lt;/li&gt;
&lt;li&gt;a 429 or 503 with and without &lt;code&gt;Retry-After&lt;/code&gt;;&lt;/li&gt;
&lt;li&gt;duplicate delivery with the same idempotency key;&lt;/li&gt;
&lt;li&gt;simultaneous recovery by many clients;&lt;/li&gt;
&lt;li&gt;an unhealthy node re-entering service;&lt;/li&gt;
&lt;li&gt;delayed webhook or job-status events after the synchronous call fails.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Assert the total upstream attempt count, not only the final response. Confirm that a committed command produces one business effect, that retry traffic stays within its concurrency and deadline limits, and that the final state can be reconciled after an unknown outcome.&lt;/p&gt;

&lt;p&gt;The &lt;a href="https://apisix.apache.org/docs/apisix/3.19/plugins/fault-injection/" rel="noopener noreferrer"&gt;&lt;code&gt;fault-injection&lt;/code&gt; plugin&lt;/a&gt; can generate configured delays or aborts for APISIX test routes. It cannot reproduce every after-commit failure inside a dependency, so combine gateway-layer faults with an instrumented test service.&lt;/p&gt;

&lt;h2&gt;
  
  
  Budget Recovery Before the Next Incident
&lt;/h2&gt;

&lt;p&gt;Retries are borrowed capacity. They can recover from a short partial failure, but they spend additional dependency work and caller time. Without idempotency, a clear owner, and an end-to-end budget, they can convert uncertainty into duplicate effects or a larger outage.&lt;/p&gt;

&lt;p&gt;Start with one high-value dependency. List its operations, mark which are idempotent or deduplicated, disable competing retry layers, and test a lost response after commit. Then set gateway attempts and timeouts from that evidence rather than from a universal default.&lt;/p&gt;

&lt;p&gt;For centralized traffic policy, review &lt;a href="https://api7.ai/enterprise" rel="noopener noreferrer"&gt;API7 Enterprise&lt;/a&gt; and the &lt;a href="https://docs.api7.ai/api7-gateway/key-concepts/upstreams-and-load-balancing" rel="noopener noreferrer"&gt;API7 Gateway upstream documentation&lt;/a&gt;, while keeping idempotency and reconciliation in the application contract that owns the business effect.&lt;/p&gt;

</description>
      <category>apigateway</category>
      <category>devops</category>
      <category>api</category>
      <category>sre</category>
    </item>
    <item>
      <title>LiteLLM vs AISIX: Choosing an AI Gateway for Production</title>
      <dc:creator>Yilia</dc:creator>
      <pubDate>Mon, 09 Nov 2026 10:13:09 +0000</pubDate>
      <link>https://dev.to/yilialinn/litellm-vs-aisix-choosing-an-ai-gateway-for-production-2fl0</link>
      <guid>https://dev.to/yilialinn/litellm-vs-aisix-choosing-an-ai-gateway-for-production-2fl0</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fb05od7lk04knz1adzz1t.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fb05od7lk04knz1adzz1t.png" alt="LiteLLM vs AISIX: Choosing an AI Gateway for Production" width="800" height="420"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Originally published by Yilia Lin on &lt;a href="https://api7.ai/blog/litellm-vs-aisix-production-ai-gateway" rel="noopener noreferrer"&gt;API7.ai&lt;/a&gt; on 2026-11-05.&lt;/p&gt;

&lt;p&gt;This syndication copy was prepared with AI assistance. Original drafting provenance has not been verified.&lt;/p&gt;

&lt;p&gt;Imagine maintaining an AI customer-support assistant. At first, it calls one model provider with an API key. Later, you add a second model to improve answers and a backup deployment to handle rate limits. As an internal knowledge base, operations tools, and other teams join, the call path takes on more responsibilities.&lt;/p&gt;

&lt;p&gt;Who holds the provider credentials? Which requests can switch targets when the primary model fails? How do you separate team spending? Can sensitive output be handled before a user sees it?&lt;/p&gt;

&lt;p&gt;At this stage, an AI gateway affects application reliability and the amount of operational work your team handles each day.&lt;/p&gt;

&lt;p&gt;LiteLLM and AISIX can both take on that responsibility. They share capabilities across model access, routing, rate limits, caching, and guardrails, but differ in how you use them, what their open-source editions include, and how they operate. Those differences help determine which fits your application.&lt;/p&gt;

&lt;h2&gt;
  
  
  How much must change in an existing application?
&lt;/h2&gt;

&lt;p&gt;One clear LiteLLM strength is flexibility at the point of integration. Python applications can use its SDK directly, or teams can deploy a separate Gateway that serves applications written in different languages. Its documented API surface is broad, spanning chat, Responses, embeddings, multimodal endpoints, OCR, and search. See the &lt;a href="https://docs.litellm.ai/docs/" rel="noopener noreferrer"&gt;LiteLLM introduction&lt;/a&gt; and &lt;a href="https://docs.litellm.ai/docs/supported_endpoints" rel="noopener noreferrer"&gt;supported endpoints&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Applications already using the SDK can retain that calling pattern while adopting routing and governance. Teams that rely on many provider interfaces may also benefit from its range of adapters.&lt;/p&gt;

&lt;p&gt;AISIX centers on a separate gateway. Provider credentials, model aliases, caller keys, and runtime policies are gateway resources. In OSS mode, operators can declare those resources in a configuration file. Applications request model aliases while the platform team manages the providers and access rules behind them. See the &lt;a href="https://docs.api7.ai/ai-gateway/reference/resources-file" rel="noopener noreferrer"&gt;AISIX resources-file reference&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;This approach becomes particularly useful when several applications share models. The support assistant, knowledge base, and operations tool can each have a caller identity, while the platform team maintains provider credentials, model configuration, and policies centrally. Provider changes have a common place to be managed.&lt;/p&gt;

&lt;p&gt;A common endpoint still needs validation with real requests. AISIX exposes Chat Completions, Anthropic Messages, and Responses, with provider and model-type constraints on individual routes. For example, embeddings use the OpenAI adapter family, and some stateful APIs require a direct model. See the &lt;a href="https://docs.api7.ai/ai-gateway/reference/proxy-api" rel="noopener noreferrer"&gt;AISIX Proxy API reference&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Start migration testing with a typical application conversation, then add streaming, tool calls, and multimodal requests. Check that the existing SDK can complete the workflow. Tool arguments, terminal events, and error formats can all affect application behavior.&lt;/p&gt;

&lt;h2&gt;
  
  
  What will users experience when the primary model fails?
&lt;/h2&gt;

&lt;p&gt;Return to the support assistant. It normally uses a primary model and tries a backup during an upstream failure. As traffic grows, you may also want to distribute requests across deployments or prefer a less expensive target.&lt;/p&gt;

&lt;p&gt;LiteLLM supports load balancing across deployments, including selection based on active work, latency, and cost, along with retries and fallback configuration. See &lt;a href="https://docs.litellm.ai/docs/proxy/load_balancing" rel="noopener noreferrer"&gt;LiteLLM routing and load balancing&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;AISIX organizes this through a multi-target model. The application requests a business-facing alias, and the gateway selects a direct model according to policy. Target weights and priorities organize active and backup pools; consistent hashing can establish target affinity using a configured request key. See &lt;a href="https://docs.api7.ai/ai-gateway/routing/routing-and-failover" rel="noopener noreferrer"&gt;AISIX multi-target routing and failover&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;For a platform team, model changes become centrally managed traffic changes.&lt;/strong&gt; The support application keeps its business alias while operators adjust targets, traffic distribution, and backup relationships in the gateway. That reduces the provider-switching logic individual applications must maintain.&lt;/p&gt;

&lt;p&gt;The configuration has boundaries. AISIX fails over on eligible failures. Upstream 429 responses need the relevant retry configuration, and an unreadable response with a successful status is not treated as a retryable upstream failure. Target affinity also does not replace application session-state management.&lt;/p&gt;

&lt;p&gt;User-visible reliability depends on the time the application can wait and the stage at which a failure occurs. Switching before a normal response returns differs from recovering after a stream has delivered partial output. Tool execution adds the risk of repeated calls.&lt;/p&gt;

&lt;p&gt;Give both gateways the same failure scenarios: a primary returning 503, rate limiting, timeouts, and a connection dropping after streaming starts. Observe the client result and correlate it with upstream records to establish which attempts occurred. That is how to determine whether recovery meets the application's needs.&lt;/p&gt;

&lt;h2&gt;
  
  
  Can you control spending across multiple teams?
&lt;/h2&gt;

&lt;p&gt;Once support, engineering, and operations share models, a single total bill cannot answer every management question. Teams need to attribute spending and set limits for different uses.&lt;/p&gt;

&lt;p&gt;LiteLLM's open-source Gateway includes basic budgets, spend tracking, and an Admin UI. Keys can carry monetary limits and budget periods, making it an attractive starting point for teams seeking basic spending controls in open source. See &lt;a href="https://docs.litellm.ai/docs/proxy/users" rel="noopener noreferrer"&gt;LiteLLM budgets and rate limits&lt;/a&gt; and its &lt;a href="https://docs.litellm.ai/docs/enterprise" rel="noopener noreferrer"&gt;edition overview&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;AISIX's centralized budgets belong to Enterprise and Cloud. They cover scopes such as organizations, environments, caller keys, provider keys, teams, members, and cost attribution tags. Their value is clearest when multiple people and teams share a service: spending responsibility can follow the organization's management structure, and the gateway enforces the resulting budget state. See &lt;a href="https://docs.api7.ai/ai-gateway/traffic-controls/budgets" rel="noopener noreferrer"&gt;AISIX budgets&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Budgets and rate limits work together. A monetary budget constrains spending over a period; request, Token, and concurrency limits protect shared capacity from a busy workload. AISIX supports limits on keys, models, and separate policies, with multiple matching limits applying to a request. See &lt;a href="https://docs.api7.ai/ai-gateway/traffic-controls/rate-limits" rel="noopener noreferrer"&gt;AISIX rate limits&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Keep settlement timing in mind. Full cost is often known after a request completes. Under AISIX's documented budget mechanism, the control plane counts spending and propagates exhausted state; the gateway checks before subsequent upstream calls. In-flight requests and propagation time can therefore cause overspend. Design budgets alongside alerts and capacity limits.&lt;/p&gt;

&lt;h3&gt;
  
  
  Calculate cache value from your traffic
&lt;/h3&gt;

&lt;p&gt;Caching offers another way to reduce spending, but coverage differs.&lt;/p&gt;

&lt;p&gt;LiteLLM's response cache covers several call types, including embeddings, Responses, and Messages. AISIX's current response-cache path is limited to non-streaming Chat Completions, with memory and Redis backends. Its semantic cache also has an OSS configuration path. See &lt;a href="https://docs.litellm.ai/docs/proxy/caching" rel="noopener noreferrer"&gt;LiteLLM caching&lt;/a&gt;, &lt;a href="https://docs.api7.ai/ai-gateway/traffic-controls/caching" rel="noopener noreferrer"&gt;AISIX response caching&lt;/a&gt;, and &lt;a href="https://docs.api7.ai/ai-gateway/traffic-controls/semantic-caching" rel="noopener noreferrer"&gt;AISIX semantic caching&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;If repeated embedding calls dominate your workload, LiteLLM's broader cache coverage deserves attention. If repetitive chat requests are your main workload, evaluate AISIX's cache policies and sharing scope against those requests.&lt;/p&gt;

&lt;p&gt;The support scenario also illustrates a constraint: similar questions do not necessarily have shareable answers. Order status, account details, and current prices depend on context. Decide which responses may be reused before enabling caching.&lt;/p&gt;

&lt;h2&gt;
  
  
  When do access and content policies take effect?
&lt;/h2&gt;

&lt;p&gt;Sharing one provider key across applications makes permissions, attribution, and revocation harder to manage. Give applications or agents distinct identities, then grant access to the models and resources they need.&lt;/p&gt;

&lt;p&gt;LiteLLM provides virtual keys for model access and spend tracking. Its documented key-management setup uses PostgreSQL, with objects managed through the API or UI. See &lt;a href="https://docs.litellm.ai/docs/proxy/virtual_keys" rel="noopener noreferrer"&gt;LiteLLM Virtual Keys&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;An AISIX capability worth examining is JWT authentication in the OSS gateway. An agent presents a short-lived Token; the gateway verifies its signature and configured claim requirements, then maps the external identity to a caller key. The request inherits that key's model permissions, rate limits, and usage attribution. The agent does not need the caller key's plaintext value. See &lt;a href="https://docs.api7.ai/ai-gateway/traffic-controls/jwt-authentication" rel="noopener noreferrer"&gt;AISIX JWT authentication&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;For teams already using identity systems such as Keycloak or Entra ID, this offers a path to reuse their existing identity infrastructure.&lt;/strong&gt; They can build model-access policy around existing identities and reduce the need to distribute long-lived credentials to agents. Trust configuration and identity mapping are still required; administrator SSO is configured separately.&lt;/p&gt;

&lt;h3&gt;
  
  
  The timing of content checks
&lt;/h3&gt;

&lt;p&gt;Identity determines who can call. Guardrails address risks in request and response content.&lt;/p&gt;

&lt;p&gt;LiteLLM provides input, output, and other execution modes, including checks during background logging. Whether a check can block or mask content depends on the integration and mode. See &lt;a href="https://docs.litellm.ai/docs/proxy/guardrails/quick_start" rel="noopener noreferrer"&gt;LiteLLM guardrails&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;AISIX's treatment of streamed output is worth examining. Enforcing output guardrails hold content while checking a full response or buffered windows, depending on the guardrail and endpoint. Monitor mode observes and records matches. See &lt;a href="https://docs.api7.ai/ai-gateway/traffic-controls/guardrails/behavior" rel="noopener noreferrer"&gt;AISIX guardrail behavior&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;For the support assistant, this addresses a direct need: deciding what to do with sensitive output before the relevant content reaches a user. Buffering and inspection behavior matter particularly when sensitive text spans stream chunks.&lt;/p&gt;

&lt;p&gt;The trade-off should be explicit. Buffering can delay the first content delivered to the client. Guardrails also have endpoint coverage, recognized-content, buffer-size, and failure-policy constraints; buffering alone does not prove that every forwarded byte was inspected. Deployment requires deciding what must be blocked and how much waiting the application can accept.&lt;/p&gt;

&lt;h2&gt;
  
  
  What must you maintain and troubleshoot in production?
&lt;/h2&gt;

&lt;p&gt;For teams operating AI access as shared infrastructure, another AISIX attraction is the ability to start with a declaratively configured standalone gateway and choose a control plane as management needs grow.&lt;/p&gt;

&lt;p&gt;The OSS resources file can fit an existing version-control and change-management process. Operators still own validation and deployment. A successful load replaces the active resource snapshot, so updates must retain the complete configuration. See the &lt;a href="https://docs.api7.ai/ai-gateway/reference/resources-file" rel="noopener noreferrer"&gt;AISIX resources-file documentation&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;For centralized management, teams can host the Enterprise control plane or use the API7-hosted Cloud control plane. In both cases, the gateway continues to run in the customer's infrastructure and sends live model requests to providers. The control plane handles management and receives relevant health and usage information; telemetry scope still needs separate configuration and review. See &lt;a href="https://docs.api7.ai/ai-gateway/getting-started/products-and-deployment-options" rel="noopener noreferrer"&gt;AISIX deployment options&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;This separates decisions about gateway placement from responsibility for operating the control plane. A team seeking less management-service maintenance while running its own gateway can evaluate Cloud. Changing management modes still requires resource recreation or migration planning; a shared proxy API does not imply automatic configuration migration.&lt;/p&gt;

&lt;p&gt;LiteLLM also supports component separation. Its production guide offers monolithic deployment or separate Gateway, Backend, and UI services that scale independently, using PostgreSQL and Redis for the relevant management and shared-state needs. See &lt;a href="https://docs.litellm.ai/docs/proxy/deploy" rel="noopener noreferrer"&gt;LiteLLM production deployment&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Compare deployment complexity at equivalent scope. A basic proxy and a deployment with budgets, UI, multi-instance rate limits, and centralized governance naturally require different maintenance work.&lt;/p&gt;

&lt;p&gt;AISIX control-plane recovery also has conditions. A running gateway can keep its accepted configuration during disconnection, while new configuration waits for reconnection. Recovery across process restarts requires explicitly enabling the disk snapshot cache. Features that depend on control-plane state, such as budgets, need their own outage-policy assessment. See &lt;a href="https://docs.api7.ai/ai-gateway/cloud/offline-resilience" rel="noopener noreferrer"&gt;AISIX offline resilience&lt;/a&gt; and &lt;a href="https://docs.api7.ai/ai-gateway/traffic-controls/budgets#behavior-during-a-control-plane-outage" rel="noopener noreferrer"&gt;budget outage behavior&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  See the failures behind a successful response
&lt;/h3&gt;

&lt;p&gt;A successful final response does not mean the call path is healthy.&lt;/p&gt;

&lt;p&gt;Suppose the primary returns 502 and a backup completes the answer. The business team sees a successful interaction, but the platform team still needs to know the primary is failing. Otherwise, backup capacity may keep hiding the problem.&lt;/p&gt;

&lt;p&gt;LiteLLM provides OpenTelemetry and integrations with observability tools to bring request information into an existing tracing system. See &lt;a href="https://docs.litellm.ai/docs/observability/opentelemetry_v2" rel="noopener noreferrer"&gt;LiteLLM OpenTelemetry&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;AISIX documentation distinguishes client requests, upstream attempts, and usage events. Attempts can be correlated by request identifier and sequence. Streamed requests also need a distinction between the initial HTTP status and the terminal outcome. See &lt;a href="https://docs.api7.ai/ai-gateway/observability/metrics-and-usage-events" rel="noopener noreferrer"&gt;AISIX metrics and usage events&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;This distinction has a practical operational benefit. Business success rates describe user experience; upstream attempt records help locate provider and routing problems. Teams can see how many requests failover rescued and investigate the extra waiting and calls behind those successes.&lt;/p&gt;

&lt;p&gt;Use a real request to evaluate troubleshooting: can you find the actual target, retry order, stage timings, and consumption records? Walking through that question often reveals more than browsing a monitoring feature list.&lt;/p&gt;

&lt;h3&gt;
  
  
  Evaluate performance under equivalent conditions
&lt;/h3&gt;

&lt;p&gt;AISIX implements its gateway in Rust, but performance still needs measurement. LiteLLM also documents a Rust Gateway Beta, whose coverage and release status require separate verification. Without equivalent hardware, enabled features, and request workloads, this article does not rank latency or throughput. See &lt;a href="https://docs.litellm.ai/docs/proxy/rust_gateway" rel="noopener noreferrer"&gt;LiteLLM Rust Gateway Beta&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Open-source and commercial feature boundaries
&lt;/h2&gt;

&lt;p&gt;Before adopting an open-source gateway, define the functionality you need.&lt;/p&gt;

&lt;p&gt;LiteLLM's open-source Gateway includes basic budgets, spend tracking, and an Admin UI, lowering the barrier to basic management. SSO, SCIM, audit, and advanced organizational governance have Enterprise licensing boundaries, with free allowances or conditions for some features. See the &lt;a href="https://docs.litellm.ai/docs/enterprise" rel="noopener noreferrer"&gt;LiteLLM edition overview&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;AISIX OSS provides gateway capabilities such as model proxying, routing, rate limits, caching, guardrails, and JWT. A centralized dashboard, organizational governance, and budgets belong to the Enterprise or Cloud control plane. See the &lt;a href="https://docs.api7.ai/ai-gateway/cloud/control-plane" rel="noopener noreferrer"&gt;AISIX control-plane overview&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Free basic budgets and a management UI are a clear LiteLLM advantage. AISIX OSS is a fit to evaluate for teams operating a separate gateway through declarative resources and existing identity systems. Once centralized governance is needed, compare commercial plans, licensing scope, and maintenance responsibilities.&lt;/p&gt;

&lt;h2&gt;
  
  
  Start by validating one application
&lt;/h2&gt;

&lt;p&gt;Make the choice with an application whose scope you can define clearly.&lt;/p&gt;

&lt;p&gt;First, run normal conversations, streaming, and tool calls through each candidate. Then deliberately introduce a primary failure: return 503, trigger a timeout, or interrupt a stream. Check whether the backup takes over as configured, whether the client receives a result it can handle, and whether logs reconstruct the sequence. This is a proposed validation method; this article has not run a comparative fault test.&lt;/p&gt;

&lt;p&gt;Once normal and failure paths meet expectations, add cost, identity, and content policies incrementally. Retain the original endpoint and a rollback path during cutover, and observe success rates, latency, and spending under a small traffic share first.&lt;/p&gt;

&lt;p&gt;LiteLLM is a natural starting point if your team already relies heavily on its SDK, needs a broad API surface, or wants budgets and a management UI in an open-source Gateway.&lt;/p&gt;

&lt;p&gt;AISIX deserves focused validation if the team wants to operate model access as independent infrastructure. Declarative resources bring configuration into existing change processes; JWT connects agents to an established identity system; routing and guardrails centralize traffic policy; and the distinction between requests and attempts helps explain production problems. Together with self-hosted or hosted control-plane options, these mechanisms form its practical value for platform teams.&lt;/p&gt;

&lt;p&gt;Start with the &lt;a href="https://docs.litellm.ai/docs/" rel="noopener noreferrer"&gt;LiteLLM quickstart&lt;/a&gt; or &lt;a href="https://docs.api7.ai/ai-gateway/getting-started/products-and-deployment-options" rel="noopener noreferrer"&gt;AISIX deployment guide&lt;/a&gt;, and validate those trade-offs with your application.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Sources checked on November 5, 2026. This article follows official documentation from both projects. No equivalent-load performance benchmark or comparative fault test was run; availability depends on the deployed version, provider, and configuration.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>devops</category>
      <category>architecture</category>
    </item>
    <item>
      <title>Migrating from LiteLLM to AISIX: Keep Model Profiles, Add Gateway Orchestration</title>
      <dc:creator>Yilia</dc:creator>
      <pubDate>Fri, 06 Nov 2026 10:38:59 +0000</pubDate>
      <link>https://dev.to/yilialinn/migrating-from-litellm-to-aisix-keep-model-profiles-add-gateway-orchestration-372o</link>
      <guid>https://dev.to/yilialinn/migrating-from-litellm-to-aisix-keep-model-profiles-add-gateway-orchestration-372o</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ftj5bb7grhpx0uck2x0vm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ftj5bb7grhpx0uck2x0vm.png" alt="Migrating from LiteLLM to AISIX: Keep Model Profiles, Add Gateway Orchestration" width="800" height="420"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Originally published by Yilia Lin on &lt;a href="https://api7.ai/blog/litellm-migration-aliases-inference-parameters" rel="noopener noreferrer"&gt;API7.ai&lt;/a&gt; on 2026-11-05.&lt;/p&gt;

&lt;p&gt;This syndication copy was prepared with AI assistance. Original drafting provenance has not been verified.&lt;/p&gt;

&lt;p&gt;A useful LiteLLM-to-AISIX migration has two stages: preserve the model profile an application calls, then put the model-specific rules and workflows you need into gateway configuration. The application keeps a stable model alias while operators manage the behavior behind it.&lt;/p&gt;

&lt;p&gt;This practice gives the migration three concrete purposes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Centralize target-specific effort rules in model configuration, giving operators one place to maintain those translations.&lt;/li&gt;
&lt;li&gt;Manage model and access resources as a reviewable bundle, retaining the last valid snapshot when a malformed update is rejected.&lt;/li&gt;
&lt;li&gt;Put panel-and-judge orchestration behind one alias, so an application can make one request to a gateway-managed workflow.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A &lt;a href="https://www.reddit.com/r/selfhosted/comments/1xircvc/gomodel_alternative_to_litellm_ai_gateway/" rel="noopener noreferrer"&gt;self-hosted gateway discussion&lt;/a&gt; and its &lt;a href="https://github.com/ENTERPILOT/GoModel/issues/1333" rel="noopener noreferrer"&gt;configuration example&lt;/a&gt; supplied the starting problem: one Qwen model, several aliases, and sampling and reasoning settings bound to those aliases. We used that profile to validate the migration contract, then exercised the three AISIX capabilities above.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Validation scope.&lt;/strong&gt; The examples use real gateways with an explicitly synthetic local upstream. They establish configuration and request behavior, not model quality, production availability, or a real Token bill.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Keep the application alias and move its model profile
&lt;/h2&gt;

&lt;p&gt;Start with the calling contract the application already depends on. A LiteLLM alias can carry more than an upstream model name. The tested source profile included &lt;code&gt;temperature&lt;/code&gt;, &lt;code&gt;top_p&lt;/code&gt;, &lt;code&gt;top_k&lt;/code&gt;, &lt;code&gt;min_p&lt;/code&gt;, &lt;code&gt;presence_penalty&lt;/code&gt;, &lt;code&gt;repetition_penalty&lt;/code&gt;, &lt;code&gt;reasoning_effort&lt;/code&gt;, and &lt;code&gt;chat_template_kwargs&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Here is the LiteLLM input used for the low-effort alias. Other aliases, authentication, limits, and fallback targets are outside this excerpt:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"model_list"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"model_name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"qwen-thinking-low"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"litellm_params"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"temperature"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mf"&gt;1.0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"top_p"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mf"&gt;0.95&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"top_k"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"min_p"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mf"&gt;0.0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"presence_penalty"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mf"&gt;0.0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"repetition_penalty"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mf"&gt;1.0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"reasoning_effort"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"low"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"chat_template_kwargs"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
          &lt;/span&gt;&lt;span class="nl"&gt;"enable_thinking"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
          &lt;/span&gt;&lt;span class="nl"&gt;"preserve_thinking"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
          &lt;/span&gt;&lt;span class="nl"&gt;"reasoning_effort"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"low"&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"model"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"hosted_vllm/Qwen/Qwen3-0.6B"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"api_base"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"http://capture:18481/primary/v1"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"api_key"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"unused-local-key"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"timeout"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;60&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;AISIX separates the caller-facing model from its ProviderKey. The model selects an upstream ID and credential resource; the ProviderKey's &lt;code&gt;request.default_body_fields&lt;/code&gt; supplies missing outbound fields. This loaded excerpt reproduced the alias-only defaults:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"_format_version"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"1"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"provider_keys"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"display_name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"local-low"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"provider"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"vllm"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"adapter"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"openai"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"api_key"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"unused-local-key"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"api_base"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"http://capture:18481/primary/v1"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"request"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"default_body_fields"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
          &lt;/span&gt;&lt;span class="nl"&gt;"temperature"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mf"&gt;1.0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
          &lt;/span&gt;&lt;span class="nl"&gt;"top_p"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mf"&gt;0.95&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
          &lt;/span&gt;&lt;span class="nl"&gt;"top_k"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
          &lt;/span&gt;&lt;span class="nl"&gt;"min_p"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mf"&gt;0.0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
          &lt;/span&gt;&lt;span class="nl"&gt;"presence_penalty"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mf"&gt;0.0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
          &lt;/span&gt;&lt;span class="nl"&gt;"repetition_penalty"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mf"&gt;1.0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
          &lt;/span&gt;&lt;span class="nl"&gt;"reasoning_effort"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"low"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
          &lt;/span&gt;&lt;span class="nl"&gt;"chat_template_kwargs"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"enable_thinking"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"preserve_thinking"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"reasoning_effort"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"low"&lt;/span&gt;&lt;span class="w"&gt;
          &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"models"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"display_name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"qwen-thinking-low"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"provider"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"vllm"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"model_name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Qwen/Qwen3-0.6B"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"provider_key"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"local-low"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"timeout"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;60000&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"retries"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;These configuration excerpts omit the caller key and other lab targets, and use local lab addresses and dummy credentials. For another deployment, replace the endpoint, credential, and model with your own values.&lt;/p&gt;

&lt;p&gt;This alias-only client body omits the lab's correlation field. The tested route was &lt;code&gt;http://127.0.0.1:18402/v1/chat/completions&lt;/code&gt;, using the dummy lab caller key:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"model"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"qwen-thinking-low"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"messages"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"role"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"user"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"content"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"What is 2 + 2? Answer briefly."&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"max_tokens"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;256&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"stream"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;a href="https://github.com/api7/aisix/blob/248ed0045896050d8c94e8d5d6e3217ed558df05/schemas/resources/provider_key.schema.json" rel="noopener noreferrer"&gt;ProviderKey schema&lt;/a&gt; defines this configuration, and the &lt;a href="https://github.com/api7/aisix/blob/248ed0045896050d8c94e8d5d6e3217ed558df05/crates/aisix-provider-openai/src/bridge.rs" rel="noopener noreferrer"&gt;OpenAI adapter's send path&lt;/a&gt; applies it. In the alias-only test, AISIX resolved the alias to Qwen/Qwen3-0.6B and sent the configured sampling values and complete template object. Client scalar values overrode those defaults in the tested override request.&lt;/p&gt;

&lt;p&gt;Defaults belong to the ProviderKey, so aliases sharing one resource share its request defaults. Our low- and extra-high-effort profiles used separate ProviderKey resources pointing at the same local upstream. Account for that organization when managing credential rotation and budget scopes.&lt;/p&gt;

&lt;h2&gt;
  
  
  Verify the calling contract before cutover
&lt;/h2&gt;

&lt;p&gt;The local lab pinned LiteLLM v1.106.6 and AISIX v1.8.0. Gateways ran sequentially with host ports bound to loopback. The upstream returned SYNTHETIC FIXTURE and fixed usage; outbound requests, responses and logs were recorded. The LiteLLM starting configuration used single-target aliases. AISIX completed 21 migration cases and six additional feature cases.&lt;/p&gt;

&lt;p&gt;A separate Qwen3-0.6B attempt downloaded the pinned weights but hit its 4 GiB container limit during loading and was stopped without raising memory. No inference completed. The original discussion's Qwen3.8-27B template therefore remains a source reference, not a model whose reasoning behavior was tested here.&lt;/p&gt;

&lt;p&gt;The compatibility details fit into a short acceptance table:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Input or boundary&lt;/th&gt;
&lt;th&gt;LiteLLM observation&lt;/th&gt;
&lt;th&gt;AISIX observation&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Alias-only profile&lt;/td&gt;
&lt;td&gt;Configured sampling and template fields sent&lt;/td&gt;
&lt;td&gt;Configured sampling and template fields sent&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Explicit scalar values&lt;/td&gt;
&lt;td&gt;Client values sent&lt;/td&gt;
&lt;td&gt;Client values sent&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Partial &lt;code&gt;chat_template_kwargs&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;Client object replaces configured object&lt;/td&gt;
&lt;td&gt;Client object replaces configured object&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Top-level effort versus template effort&lt;/td&gt;
&lt;td&gt;Both values remain separate&lt;/td&gt;
&lt;td&gt;Both values remain separate&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;temperature: null&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Temperature omitted upstream&lt;/td&gt;
&lt;td&gt;Temperature 1.0 sent upstream&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Unknown alias&lt;/td&gt;
&lt;td&gt;400, no upstream chat request&lt;/td&gt;
&lt;td&gt;404, no upstream chat request&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The null row is a real difference in the captured requests; this setup does not preserve LiteLLM's omission behavior. Handle such inputs before cutover. The nested-object result also means these profiles do not recursively merge missing template members.&lt;/p&gt;

&lt;p&gt;Both gateways enforced the tested 1 RPM limit and performed controlled fallback. With AISIX, injected 503, 429, and an eight-second delayed primary each led to one primary and one backup attempt; the clean timeout case used a five-second model timeout. The backup retained the primary's complete outbound body. The accepted timeout result came from a clean rerun after a capture-tool file race invalidated the initial trial. These are acceptance checks for the selected profiles.&lt;/p&gt;

&lt;h2&gt;
  
  
  Centralize target-specific reasoning rules
&lt;/h2&gt;

&lt;p&gt;When client and target-model effort labels differ, keep their translation in the gateway's model configuration. AISIX's model-level &lt;code&gt;effort_mapping&lt;/code&gt; applies the rule after resolving the final target. Operators can maintain that target-specific policy in one place. The &lt;a href="https://github.com/api7/aisix/blob/248ed0045896050d8c94e8d5d6e3217ed558df05/schemas/resources/model.schema.json" rel="noopener noreferrer"&gt;model schema&lt;/a&gt; and &lt;a href="https://github.com/api7/aisix/blob/248ed0045896050d8c94e8d5d6e3217ed558df05/crates/aisix-proxy/src/effort_mapping.rs" rel="noopener noreferrer"&gt;request mapping code&lt;/a&gt; define missing-value, exact-match, wildcard, and removal behavior.&lt;/p&gt;

&lt;p&gt;We tested this separate model using a ProviderKey with no body defaults:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"models"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"display_name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"qwen-effort-mapped"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"provider"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"vllm"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"model_name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Qwen/Qwen3-0.6B"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"provider_key"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"local-raw"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"timeout"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;60000&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"retries"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"effort_mapping"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;""&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"low"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"high"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"xhigh"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"*"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"medium"&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Client effort&lt;/th&gt;
&lt;th&gt;Captured upstream effort&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Omitted&lt;/td&gt;
&lt;td&gt;&lt;code&gt;low&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;high&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;xhigh&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;xhigh&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;medium&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The wildcard in this example is an explicit operator policy: other non-empty string effort values become medium. Matching happens once, so the mapped result is not looked up again. It is useful when client vocabularies and target expectations differ; it is not transparent preservation of every caller's intent.&lt;/p&gt;

&lt;p&gt;For example, with thinking enabled the pinned &lt;a href="https://huggingface.co/Qwen/Qwen3.8-27B/blob/1d4bf0f2ff6012fd82039f2fa52739d0dd7c60c0/tokenizer_config.json" rel="noopener noreferrer"&gt;original Qwen template&lt;/a&gt; accepts low, medium, and xhigh, while rejecting high. A gateway mapping can express that vocabulary adjustment. Our test proves the outgoing value, not the template's execution or answer quality. Nested template effort remains a separate input and needs its own policy.&lt;/p&gt;

&lt;h2&gt;
  
  
  Review and reload model resources as one bundle
&lt;/h2&gt;

&lt;p&gt;Once model profiles are in the gateway, operators need a way to maintain them. AISIX's file mode puts model profiles and access resources in one reviewable bundle. The gateway validates that file and reloads it on &lt;code&gt;SIGHUP&lt;/code&gt;, giving teams a concrete configuration-change workflow for a small self-hosted deployment. The &lt;a href="https://github.com/api7/aisix/blob/248ed0045896050d8c94e8d5d6e3217ed558df05/README.md" rel="noopener noreferrer"&gt;fixed-version quickstart&lt;/a&gt; documents the file mode.&lt;/p&gt;

&lt;p&gt;The lab mounted the resource directory so host-side file replacement remained visible in the container. We added an allowed alias, reloaded the file, and received 200 from that alias. We then supplied malformed configuration and signaled another reload. AISIX logged rejection of the update, and the newly added alias still returned 200 using the last valid snapshot. The gateway process ID and container restart count remained unchanged.&lt;/p&gt;

&lt;p&gt;This gives operators a tested update path that retains a working snapshot after a malformed change. The serial checks are not a continuous-load zero-downtime measurement. Larger deployments can choose another configuration source; this experiment did not test their control plane, configuration propagation, or outage behavior.&lt;/p&gt;

&lt;h2&gt;
  
  
  Let one alias own the panel-and-judge workflow
&lt;/h2&gt;

&lt;p&gt;For applications that need multiple candidate answers and a synthesis step, AISIX's built-in ensemble model puts that calling sequence behind one model name. The application submits one request; gateway configuration describes the panel models and the judge. This moves the fan-out and synthesis handoff into the gateway. The &lt;a href="https://github.com/api7/aisix/blob/248ed0045896050d8c94e8d5d6e3217ed558df05/crates/aisix-proxy/src/ensemble.rs" rel="noopener noreferrer"&gt;executor&lt;/a&gt; includes per-member sampling overrides, a minimum successful response count, and deadlines.&lt;/p&gt;

&lt;p&gt;The tested ensemble excerpt was:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"models"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"display_name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"qwen-ensemble"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"ensemble"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"panel"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
          &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"model"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"panel-a"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"temperature"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mf"&gt;0.2&lt;/span&gt;&lt;span class="w"&gt;
          &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
          &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"model"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"panel-b"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"temperature"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mf"&gt;0.8&lt;/span&gt;&lt;span class="w"&gt;
          &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"judge"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
          &lt;/span&gt;&lt;span class="nl"&gt;"model"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"judge"&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"min_responses"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"timeout_ms"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;5000&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The three referenced direct models must exist first. In this non-streaming experiment they pointed at synthetic upstream IDs, not three real AI models. The test produced two panel calls with temperatures 0.2 and 0.8, followed by one judge call at 0.2. Its synthesis prompt included both panel responses. One client request therefore produced three upstream calls in this successful case.&lt;/p&gt;

&lt;p&gt;This workflow has its own parameter contract: the client's &lt;code&gt;max_tokens&lt;/code&gt; value of 64 reached both panels but was absent from the judge request. The pinned executor constructs the judge request separately and sets its temperature to 0.2. Verify a judge-specific output cap before deployment. The configured &lt;code&gt;timeout_ms&lt;/code&gt; is a per-subcall deadline in this implementation; 5000 does not cap the complete panel-plus-judge workflow at five seconds. The successful fixture case did not exercise that deadline.&lt;/p&gt;

&lt;p&gt;Each synthetic response carried 10 input Tokens and 2 output Tokens. AISIX returned aggregate usage of 30 input, 6 output, and 36 total Tokens for the ensemble. This checks orchestration and counter aggregation. It does not establish better answers, real Token accuracy, or lower cost; a real panel and judge add provider work that must be priced and evaluated.&lt;/p&gt;

&lt;p&gt;The application-facing gain is one alias for this configured workflow. Panel selection and the judge handoff can be maintained with the gateway models, while the application continues to make a single model request. Adopting the workflow still requires accepting its separate judge policy and evaluating the real models it will call.&lt;/p&gt;

&lt;h2&gt;
  
  
  Move the profile, then adopt the gateway work you need
&lt;/h2&gt;

&lt;p&gt;Use the migration to establish a stable application-facing profile first. Then adopt the gateway capabilities that match the work you want to centralize: target-specific effort rules, reviewable resource updates, or a panel-and-judge workflow. The examples above demonstrate those configuration and request paths under the stated lab conditions.&lt;/p&gt;

&lt;p&gt;Keep the cutover checklist short:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Confirm every alias's upstream model, defaults, and client-override rules, including the observed null difference.&lt;/li&gt;
&lt;li&gt;Verify authentication, quota rejection, and every fallback attempt's parameters.&lt;/li&gt;
&lt;li&gt;Reconcile requested aliases, served targets, and usage; finish pricing and persistence checks separately.&lt;/li&gt;
&lt;li&gt;Verify panel and judge parameter limits separately, then evaluate real-model quality and cost before enabling this workflow for production traffic.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Before cutover, replay these profiles against your own upstream. Keep the application alias stable, validate the effective parameters, and add the gateway-managed rules and orchestration that your application needs. That is the practical outcome to seek from this migration.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>devops</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Internal APIs Are Production Security Boundaries</title>
      <dc:creator>Yilia</dc:creator>
      <pubDate>Wed, 04 Nov 2026 01:48:23 +0000</pubDate>
      <link>https://dev.to/yilialinn/internal-apis-are-production-security-boundaries-pd</link>
      <guid>https://dev.to/yilialinn/internal-apis-are-production-security-boundaries-pd</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fh0vcz53fqfvrve8rjnrt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fh0vcz53fqfvrve8rjnrt.png" alt="Internal APIs Are Production Security Boundaries" width="800" height="420"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Originally published by Yilia Lin on &lt;a href="https://api7.ai/blog/internal-api-security-boundaries" rel="noopener noreferrer"&gt;API7.ai&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;This article was drafted with AI assistance.&lt;/p&gt;

&lt;p&gt;“Internal” describes where an application sits, not how much damage its APIs can cause. A sales tool may reach customer relationship records, support conversations, product-usage summaries, and account history. If that tool is exposed or compromised, its internal API permissions become part of the incident boundary.&lt;/p&gt;

&lt;p&gt;WorkOS supplied a timely example on November 2, 2026. Its &lt;a href="https://workos.com/security/bulletins/october-30th-2026-data-security-incident" rel="noopener noreferrer"&gt;official security bulletin&lt;/a&gt; reports unauthorized access to an internal application used by its sales team. WorkOS says the affected information included business contact details, account and relationship information, excerpts from customer communications, and operational metadata. It disabled external access to the application and began a broader review of internal-tool access controls.&lt;/p&gt;

&lt;p&gt;The bulletin does not establish a public root cause or a complete attack path, and this article does not infer one. The &lt;a href="https://news.ycombinator.com/item?id=50345712" rel="noopener noreferrer"&gt;Hacker News thread&lt;/a&gt; is the trend signal, not evidence that an API gateway would have prevented the incident. The useful engineering question is narrower: how should teams contain an internal business application when it becomes an unauthorized API client?&lt;/p&gt;

&lt;h2&gt;
  
  
  Key Takeaways
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Treat sensitive business tools as production workloads, even when they do not serve customer requests.&lt;/li&gt;
&lt;li&gt;Give each tool its own revocable workload identity; do not rely on network location or a shared credential.&lt;/li&gt;
&lt;li&gt;Authentication is not authorization. Restrict routes, methods, tenants, fields, and business objects separately.&lt;/li&gt;
&lt;li&gt;A gateway can enforce and observe API policy only on traffic that actually passes through it.&lt;/li&gt;
&lt;li&gt;Rate limits and validation reduce abuse paths but do not determine whether a legitimate-looking business action is appropriate.&lt;/li&gt;
&lt;li&gt;Test credential revocation, direct-path removal, log preservation, and temporary deny policy before an incident.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Model the Tool as an API Client
&lt;/h2&gt;

&lt;p&gt;Security diagrams often put employees and customers on one side, then place “internal systems” inside a trusted box. That hides the behavior that matters. A business tool is a software client with credentials, routes, data access, and automation.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fnmcw5zoa2huc8hdjxxgx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fnmcw5zoa2huc8hdjxxgx.png" alt="Internal business tool API access and decision-evidence flow" width="799" height="293"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The user session and the tool's workload identity are different actors. A valid employee login does not prove that every downstream call is authorized. A valid tool credential does not identify which employee initiated a request unless the application carries and validates that context. A correlation ID helps investigation but is not an identity if the caller can choose it.&lt;/p&gt;

&lt;p&gt;This is consistent with &lt;a href="https://csrc.nist.gov/pubs/sp/800/207/final" rel="noopener noreferrer"&gt;NIST SP 800-207&lt;/a&gt;: network location should not grant implicit trust. Private DNS, a VPN, or a corporate subnet can reduce exposure, but none replaces a policy decision about the caller, resource, and requested action.&lt;/p&gt;

&lt;h2&gt;
  
  
  Build Four Containment Boundaries
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. Inventory and force a managed path
&lt;/h3&gt;

&lt;p&gt;Record the API routes, data classes, owners, callers, and direct network paths for each internal tool. Sensitive backends should accept traffic only from the intended gateway or service identity when the architecture permits it. Otherwise, an application can bypass the very controls and audit trail you expect to contain it.&lt;/p&gt;

&lt;p&gt;The &lt;a href="https://owasp.org/API-Security/editions/2023/en/0x11-t10/" rel="noopener noreferrer"&gt;OWASP API Security Top 10 2023&lt;/a&gt; separates improper inventory management, broken authentication, broken object-level authorization, unrestricted resource consumption, and unsafe API consumption. That separation is useful: putting an endpoint in an inventory does not secure it, and authenticating a client does not constrain every object it can read.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Separate and shorten workload identity
&lt;/h3&gt;

&lt;p&gt;Issue a distinct credential to each application and environment. A sales tool, support exporter, analytics job, and CI task should not share one broad token. Prefer credentials that are short-lived or centrally revocable, and bind them to an expected audience where the identity system supports it.&lt;/p&gt;

&lt;p&gt;Separate the human and workload layers:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Layer&lt;/th&gt;
&lt;th&gt;Question&lt;/th&gt;
&lt;th&gt;Failure to avoid&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Human session&lt;/td&gt;
&lt;td&gt;Which employee approved this action?&lt;/td&gt;
&lt;td&gt;Treating a service token as the employee&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Workload identity&lt;/td&gt;
&lt;td&gt;Which deployed tool called the API?&lt;/td&gt;
&lt;td&gt;Reusing one credential across tools&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Gateway authorization&lt;/td&gt;
&lt;td&gt;Which route and method may it call?&lt;/td&gt;
&lt;td&gt;Letting authentication imply broad access&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Backend authorization&lt;/td&gt;
&lt;td&gt;Which account, tenant, or object may be read?&lt;/td&gt;
&lt;td&gt;Assuming the gateway knows domain ownership&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Revocation must be observable. A runbook should state how long an already issued token can remain valid, whether a gateway caches introspection or keys, and how to confirm that a revoked credential now fails. “Rotated” is not the success condition; a rejected test request and absence of an alternate path are.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Bound request shape and consumption
&lt;/h3&gt;

&lt;p&gt;An internal caller can be compromised, buggy, or simply misconfigured. Apply route-level method restrictions, schema checks, payload limits, timeouts, and quotas before requests reach expensive or sensitive backends.&lt;/p&gt;

&lt;p&gt;In Apache APISIX 3.19, these are separate mechanisms. The &lt;a href="https://apisix.apache.org/docs/apisix/3.19/plugins/openid-connect/" rel="noopener noreferrer"&gt;&lt;code&gt;openid-connect&lt;/code&gt; plugin&lt;/a&gt; can validate bearer-token paths using documented discovery, introspection, or public-key options depending on its mode. &lt;a href="https://apisix.apache.org/docs/apisix/3.19/plugins/request-validation/" rel="noopener noreferrer"&gt;&lt;code&gt;request-validation&lt;/code&gt;&lt;/a&gt; validates request headers or bodies against configured schemas. &lt;a href="https://apisix.apache.org/docs/apisix/3.19/plugins/limit-count/" rel="noopener noreferrer"&gt;&lt;code&gt;limit-count&lt;/code&gt;&lt;/a&gt; applies request-count quotas with a configured key and policy.&lt;/p&gt;

&lt;p&gt;The quota scope is material. If &lt;code&gt;policy&lt;/code&gt; is omitted or set to its &lt;code&gt;local&lt;/code&gt; default, each APISIX instance maintains its own counter, so the fleet's effective aggregate quota is approximately the configured quota multiplied by the number of instances receiving traffic. A quota intended to span instances needs a shared &lt;code&gt;redis&lt;/code&gt;, &lt;code&gt;redis-cluster&lt;/code&gt;, or &lt;code&gt;redis-sentinel&lt;/code&gt; policy and the corresponding dependency configuration. That shared dependency adds its own availability, latency, TLS, and recovery decisions; it is not a free global switch.&lt;/p&gt;

&lt;p&gt;None of those controls proves business intent. A compromised tool may present a valid token, a valid schema, and a request below quota. The backend still needs object- and function-level authorization, while the gateway should restrict the tool to the smallest route and method set it needs.&lt;/p&gt;

&lt;p&gt;Rate limits also need an incident interpretation. A limit of 1,000 requests per minute may protect availability but still allow rapid extraction of 1,000 sensitive records. Set quotas from acceptable business behavior and data exposure, not only backend capacity.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Preserve decision evidence without creating another leak
&lt;/h3&gt;

&lt;p&gt;An incident team needs to know which identity called which route, when policy allowed it, how the upstream responded, and which configuration revision was active. Apache APISIX 3.19's &lt;a href="https://apisix.apache.org/docs/apisix/3.19/plugins/http-logger/" rel="noopener noreferrer"&gt;&lt;code&gt;http-logger&lt;/code&gt; plugin&lt;/a&gt; can send request logs to an HTTP endpoint, but useful incident evidence requires deliberate fields, retention, access control, and failure monitoring.&lt;/p&gt;

&lt;p&gt;Do not log sensitive bodies by default. Contact details, support messages, tokens, and session cookies can turn an observability system into a second data store that expands the breach. Prefer identity, route, method, status, byte count, policy outcome, target service, and a gateway-generated request identifier. Add payload fields only after data classification and masking rules are explicit.&lt;/p&gt;

&lt;p&gt;API7's &lt;a href="https://api7.ai/blog/gateway-logging-best-practices" rel="noopener noreferrer"&gt;gateway logging practices&lt;/a&gt; provide a broader operational checklist. Keep gateway evidence alongside application audit events; the gateway sees traffic decisions, while the application knows the business object and employee action.&lt;/p&gt;

&lt;h2&gt;
  
  
  Know What the Gateway Cannot Contain
&lt;/h2&gt;

&lt;p&gt;A gateway is a policy enforcement point, not a universal breach detector.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;If the tool can reach the backend directly, gateway policy is bypassed.&lt;/li&gt;
&lt;li&gt;If the stolen credential is still valid, authentication can correctly accept an attacker.&lt;/li&gt;
&lt;li&gt;If authorization is broad, the gateway can faithfully enforce an unsafe policy.&lt;/li&gt;
&lt;li&gt;If the sensitive operation is indistinguishable from normal traffic, schema validation cannot infer intent.&lt;/li&gt;
&lt;li&gt;If the backend omits tenant or object checks, route-level authorization cannot reconstruct that business rule.&lt;/li&gt;
&lt;li&gt;If logs are incomplete, delayed, or attacker-accessible, the audit trail may not establish scope.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These limitations should sit next to the controls, not in fine print. They change the architecture: close direct paths, reduce credential lifetime, keep domain authorization in the service, and send evidence to a separately protected system.&lt;/p&gt;

&lt;p&gt;The distinction between browser SSO and API authorization is especially important for business tools. API7's guide to &lt;a href="https://api7.ai/blog/saml-api-gateway-authentication" rel="noopener noreferrer"&gt;SAML and API gateways&lt;/a&gt; explains why an employee's login session and a downstream API access token solve different problems.&lt;/p&gt;

&lt;h2&gt;
  
  
  Prepare an Internal-API Incident Runbook
&lt;/h2&gt;

&lt;p&gt;Use a tabletop exercise to answer these questions before the next alert:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Contain reachability.&lt;/strong&gt; Can you disable the tool's external path or isolate its deployment without removing evidence?&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Revoke identities.&lt;/strong&gt; Which human sessions, workload credentials, API keys, certificates, and refresh tokens must be invalidated?&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Apply a temporary deny policy.&lt;/strong&gt; Can the gateway block the affected client or sensitive routes while preserving unrelated traffic?&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Find bypasses.&lt;/strong&gt; Do direct load balancers, service addresses, legacy routes, exports, or scheduled jobs reach the same backend?&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Preserve evidence.&lt;/strong&gt; Are gateway, identity-provider, application, and data-system logs time-aligned and access-controlled?&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Bound the data set.&lt;/strong&gt; Which routes, tenants, fields, and records were reachable under the credential's effective permissions?&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Restore narrowly.&lt;/strong&gt; Can you re-enable one identity and route at a time with shorter credentials and new alerts?&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Test the negative paths. An absent token, expired token, revoked token, wrong audience, disallowed method, over-quota request, invalid body, and direct backend request should each produce an expected result. A successful happy-path login does not validate containment.&lt;/p&gt;

&lt;h2&gt;
  
  
  Treat Business Systems Like Production Systems
&lt;/h2&gt;

&lt;p&gt;Internal tools often move quickly because they are built to help a small group. Their data reach can be larger than their user count suggests. The right response is not to make every sales workflow cumbersome; it is to give those workflows production-grade identity, least privilege, traffic boundaries, and incident evidence.&lt;/p&gt;

&lt;p&gt;Start with one application that can read customer or operational data. Draw its human session, workload credential, gateway route, backend permissions, and logging path. Then revoke the credential and prove the application cannot use a direct alternative. That exercise reveals whether “internal” is a real containment boundary or merely a label.&lt;/p&gt;

&lt;p&gt;For a managed enforcement layer, review &lt;a href="https://api7.ai/enterprise" rel="noopener noreferrer"&gt;API7 Enterprise&lt;/a&gt; and the &lt;a href="https://docs.api7.ai/api7-gateway/getting-started/overview" rel="noopener noreferrer"&gt;API7 Gateway documentation&lt;/a&gt;, then validate every control against the exact release and deployment topology you operate.&lt;/p&gt;

</description>
      <category>security</category>
      <category>api</category>
    </item>
  </channel>
</rss>
