Running a quote API in production: error codes, retries, and rate limits without keys
BlazePhoenix Engineering · updated 2026-07-18 · 6 min · written from the deployed bytecode
Abstract in 15 languages · resumo · resumen · 摘要 · 要旨 · ملخص
English — Stable machine codes (bad_*, no_route, rpc_unreachable + retry-after), coalescing that absorbs poll storms, and no API keys because the cost model made them unnecessary — the operational contract, documented like one.
Português — Códigos de máquina estáveis (bad_*, no_route, rpc_unreachable + retry-after), coalescing que absorve tempestades de polling, e sem chaves de API porque o modelo de custos as tornou desnecessárias — o contrato operacional, documentado como tal.
Español — Códigos de máquina estables (bad_*, no_route, rpc_unreachable + retry-after), coalescencia que absorbe tormentas de polling, y sin claves de API porque el modelo de costos las hizo innecesarias — el contrato operativo, documentado como tal.
Français — Des codes machine stables (bad_*, no_route, rpc_unreachable + retry-after), une coalescence qui absorbe les rafales de polling, et pas de clés d'API car le modèle de coûts les rend inutiles — le contrat opérationnel, documenté comme tel.
Deutsch — Stabile Maschinencodes (bad_*, no_route, rpc_unreachable + retry-after), Coalescing, das Poll-Stürme absorbiert, und keine API-Keys, weil das Kostenmodell sie überflüssig macht — der Betriebsvertrag, als solcher dokumentiert.
Русский — Стабильные машинные коды (bad_*, no_route, rpc_unreachable + retry-after), коалесцирование, поглощающее штормы опроса, и никаких API-ключей — модель затрат сделала их ненужными. Операционный контракт, задокументированный как контракт.
Türkçe — Kararlı makine kodları (bad_*, no_route, rpc_unreachable + retry-after), anket fırtınalarını emen birleştirme ve maliyet modeli gereksiz kıldığı için API anahtarı yok — operasyonel sözleşme, sözleşme gibi belgelenmiş.
العربية — رموز آلية ثابتة (bad_* وno_route وrpc_unreachable مع retry-after)، ودمج يمتص عواصف الاستطلاع، وبلا مفاتيح API لأن نموذج التكلفة جعلها غير ضرورية — العقد التشغيلي موثقاً كعقد.
हिन्दी — स्थिर मशीन कोड (bad_*, no_route, rpc_unreachable + retry-after), कोलेसिंग जो पोलिंग तूफान सोख लेती है, और API कुंजियाँ नहीं क्योंकि लागत मॉडल ने उन्हें अनावश्यक बना दिया — परिचालन अनुबंध, अनुबंध की तरह प्रलेखित।
日本語 — 安定したマシンコード(bad_*、no_route、rpc_unreachable+retry-after)、ポーリングの嵐を吸収するコアレッシング、そしてコストモデルが不要にしたAPIキーの不在。運用契約を、契約書のように文書化しました。
中文 — 稳定的机器码(bad_*、no_route、rpc_unreachable + retry-after)、吸收轮询风暴的合并机制,以及因成本模型而无需 API 密钥——这份运维契约,以契约的方式写成文档。
한국어 — 안정적인 머신 코드(bad_*, no_route, rpc_unreachable + retry-after), 폴링 폭풍을 흡수하는 병합, 그리고 비용 모델이 불필요하게 만든 API 키 없음 — 운영 계약을 계약답게 문서화했습니다.
Bahasa Indonesia — Kode mesin stabil (bad_*, no_route, rpc_unreachable + retry-after), penggabungan yang menyerap badai polling, dan tanpa kunci API karena model biayanya membuatnya tak perlu — kontrak operasional, didokumentasikan selayaknya kontrak.
বাংলা — স্থিতিশীল মেশিন কোড (bad_*, no_route, rpc_unreachable + retry-after), কোয়ালেসিং যা পোলিং ঝড় শুষে নেয়, এবং কোনো API কী নেই কারণ খরচের মডেল সেগুলো অপ্রয়োজনীয় করেছে — অপারেশনাল চুক্তি, চুক্তির মতোই নথিভুক্ত।
Filipino — Matatag na machine codes (bad_*, no_route, rpc_unreachable + retry-after), coalescing na sumisipsip ng poll storms, at walang API keys dahil ginawa itong hindi kailangan ng cost model — ang operational contract, dokumentado bilang kontrata.
Production integrations do not fail on the happy path; they fail on the edges. The API's edge behaviour is a contract: every error carries a STABLE machine code — bad_* (400) means your parameter, and the message names which; no_route (422) means the Quoter genuinely found no executable plan for that pair and size (not an outage — treat it as an answer); rpc_unreachable (502) means upstream chains were unreachable and carries retry-after: 3. Branch on the code, never on message text.
Retry discipline: 502 → honor retry-after, then exponential backoff; 422 → do NOT retry the same request (the answer will not change within a block — change size or pair instead); 400 → fix the request, retrying is a bug. The SDK bakes this in; raw HTTP integrators should copy it.
switch (res.status) {
case 200: return body; // body.meta.cache tells you how it was served
case 422: return null; // no_route IS the answer — do not hammer
case 502: await sleep((+res.headers.get('retry-after') || 3) * 1000); return retry();
case 400: throw new Error(body.error); // your parameter — fix, don't retry
}Why there are no API keys — and what replaces rate limits
Keys exist to meter costs. This API's cost model makes them unnecessary: identical concurrent requests are coalesced into ONE on-chain call (singleflight), and previews are edge-cached for about one block. A thousand bots polling the same pair cost roughly the same as one bot — so polling is not punished, it is absorbed. meta.cache discloses what happened to every response (miss | coalesced | hit): your monitoring can measure exactly how much of your traffic was served from shared work.
Two practical consequences: poll as fast as you like on preview quotes (the edge does the dedup), and never TTL-cache responses that carry recipient calldata or exact=1 — those are computed fresh by design, because anything you might SIGN must never be stale.
Do not trust this page — reproduce it
Every claim above is checkable against the chain. Start here:
curl -i "https://blazephoenix.xyz/api/quote?chain=base&in=WETH&out=USDC&amountIn=1" — read the error envelope and headers yourselfContracts are verified on every chain we deploy to — addresses in the protocol manifest. Deeper formal treatment: the whitepaper (PDF).
Share this article · join the discussion