AI Gateways
An office building has one front desk. Every visitor signs in there, gets a badge, and goes to the right floor. An AI gateway is the front desk for model calls: every app sends its requests to it, and the gateway decides who may pass, where the request goes, and what to write in the log.
8 min read8 মিনিটে পড়া যায় · 7 sections7টি সেকশন · 8 sources8টি সোর্স · updated Oct 2026আপডেট: Oct 2026
One gate in front of every modelসব মডেলের সামনে একটাই গেট
Send a request through auth, limits, routing, fallback and logging, then break the first provider, then the gateway.একটা অনুরোধ auth, সীমা, routing, fallback আর log-এর ভেতর দিয়ে পাঠান, তারপর প্রথম provider ভাঙুন, তারপর gateway-ই ভাঙুন।
You’ll learnআপনি শিখবেন
- The five checks inside a gatewaygateway-এর ভেতরের পাঁচটা ধাপ
- Why the provider key stays on the serverprovider key কেন সার্ভারে থাকে
- How a fallback hides a provider outagefallback কীভাবে provider-এর বিভ্রাট লুকায়
- Why a gateway outage hits every appgateway বন্ধ হলে কেন সব অ্যাপ আটকায়
In plain words
An AI gateway (also called an LLM gateway) is a proxy that sits between your apps and the model providers. The apps do not call each provider directly. They call one gateway endpoint, and the gateway forwards the request.
The Claude Code docs say that a gateway gives an organization one place to manage credentials, usage tracking, cost controls, audit logging, and provider switching Source 1সোর্স 1. In detail Source 1সোর্স 1:
- Credentials: the provider key stays on the server. Developers hold gateway credentials instead.
- Cost controls: budgets and rate limits live in one place.
- Audit logging: the gateway logs every model request.
- Provider switching: you change the provider in the gateway configuration, not on each developer machine.
Many products do this job. Cloudflare AI Gateway gives visibility and control over AI apps Source 3সোর্স 3. LiteLLM is a self-hosted server with one endpoint for more than 100 LLM providers, MCP tools, and A2A agents Source 5সোর্স 5. Kong AI Gateway connects to major LLM providers through one consistent API Source 8সোর্স 8. Azure API Management has AI gateway features to govern models, agents, and tools Source 7সোর্স 7. This page shows no product as the best one. They share the same idea.
The upstream side can be a hosted model API, a self-hosted model, or a remote MCP server Source 7সোর্স 7. So a gateway can be one control point for model calls and tool calls.
সহজ English
An AI gateway (also called an LLM gateway) is a middle stop between your apps and the model companies. Your apps do not talk to each company. They talk to the gateway, and the gateway passes the request on.
The Claude Code docs say that a gateway gives a company one place to manage keys, usage, cost limits, logs, and the choice of provider Source 1সোর্স 1. The real provider key stays on the server. Each developer gets a gateway key instead. Budgets and rate limits are set in one place. The gateway logs every model request. To change the provider, you change the gateway, not every laptop Source 1সোর্স 1.
Many products do this job. Cloudflare AI Gateway gives you a view of your AI apps and control over them Source 3সোর্স 3. LiteLLM is a server that you run yourself. It gives one endpoint for more than 100 providers, MCP tools, and A2A agents Source 5সোর্স 5. Kong AI Gateway gives one API for the major providers Source 8সোর্স 8. Azure API Management can govern models, agents, and tools Source 7সোর্স 7. No product here is "the best". They share one idea.
Behind the gateway there can be a hosted model, a model that you run yourself, or a remote MCP server Source 7সোর্স 7. So one gateway can control calls to models and calls to tools.
বাংলা ব্যাখ্যা
AI gateway (একে LLM gateway-ও বলে) হলো আপনার অ্যাপ আর মডেল প্রোভাইডারদের মাঝখানে বসা একটা proxy। অ্যাপগুলো সরাসরি প্রতিটা প্রোভাইডারকে কল করে না। তারা একটাই gateway endpoint-কে কল করে, আর gateway রিকোয়েস্টটা সামনে পাঠিয়ে দেয়।
Claude Code-এর ডকস বলে, gateway একটা প্রতিষ্ঠানকে credential, usage tracking, খরচের নিয়ন্ত্রণ, audit log আর provider বদলানো, সব এক জায়গা থেকে চালানোর সুযোগ দেয় Source 1সোর্স 1। আসল provider key সার্ভারেই থাকে। ডেভেলপাররা তার বদলে gateway credential পান। বাজেট আর rate limit এক জায়গায় সেট হয়। gateway প্রতিটা মডেল রিকোয়েস্ট log করে। provider বদলাতে চাইলে আপনি gateway-এর কনফিগারেশন বদলান, প্রতিটা ডেভেলপারের মেশিন নয় Source 1সোর্স 1।
অনেক প্রোডাক্ট এই কাজ করে। Cloudflare AI Gateway আপনার AI অ্যাপের ওপর নজর আর নিয়ন্ত্রণ দেয় Source 3সোর্স 3। LiteLLM একটা self-hosted সার্ভার, যেটা ১০০-র বেশি LLM provider, MCP tool আর A2A agent-এর জন্য একটাই endpoint দেয় Source 5সোর্স 5। Kong AI Gateway বড় LLM provider-গুলোর সাথে একটাই API দিয়ে যুক্ত হয় Source 8সোর্স 8। Azure API Management মডেল, agent আর tool নিয়ন্ত্রণ করতে পারে Source 7সোর্স 7। এখানে কোনো প্রোডাক্টকে "সেরা" বলা হচ্ছে না। সবার মূল ধারণা একই।
gateway-এর পেছনে থাকতে পারে একটা hosted মডেল API, একটা self-hosted মডেল, বা একটা remote MCP server Source 7সোর্স 7। তাই একটা gateway মডেল কল আর tool কল, দুটোরই এক নিয়ন্ত্রণ-বিন্দু হতে পারে।
How it works
Here is the path of one request:
App A ─┐ ┌───────────────────────────┐ ┌─> OpenAI
App B ─┼─ gateway key ─>│ AI gateway │──────┼─> Anthropic
App C ─┘ │ 1 auth 2 limits/budget │ prov.├─> Gemini
│ 3 route 4 fallback │ key ├─> self-hosted model
│ 5 log, metrics, cost │ └─> MCP server
└───────────────────────────┘- Auth. The app sends a gateway credential, not the provider key. LiteLLM gives each user, team, and project a virtual key Source 5সোর্স 5. Azure API Management can use managed identities, so it needs no API key to reach Azure AI services Source 7সোর্স 7.
- Limits and budgets. Each LiteLLM key has its models, budgets, and rate limits Source 5সোর্স 5. Azure can set a tokens-per-minute (TPM) limit or a token quota per consumer Source 7সোর্স 7. Cloudflare can limit the number of requests Source 3সোর্স 3.
- Routing. The gateway picks the upstream model. Some gateways also answer from a cache instead of the provider Source 3সোর্স 3.
- Fallback. If the first model fails, the gateway tries the next one. In Cloudflare, an error triggers the fallback by default, and a configured timeout can too Source 4সোর্স 4. The response header
cf-aig-steptells which step served the request:0is the first model Source 4সোর্স 4. LiteLLM tries fallbacks in order, with retries and cooldowns, and has special fallbacks for context-window and content-policy errors Source 6সোর্স 6. Azure can stop sending requests to a backend that does not respond (a circuit breaker) Source 7সোর্স 7. - Logs and cost. Cloudflare shows requests, tokens, and cost Source 3সোর্স 3. LiteLLM records the cost of each request and can send logs and metrics to OpenTelemetry, Prometheus, and other tools Source 5সোর্স 5. Azure can log prompts and completions Source 7সোর্স 7. Some gateways also clean the prompt: Kong can redact PII before it reaches the provider Source 8সোর্স 8.
To send Claude Code through a gateway, set ANTHROPIC_BASE_URL to the gateway address Source 2সোর্স 2. Put the gateway credential in ANTHROPIC_AUTH_TOKEN (sent as Authorization: Bearer) or ANTHROPIC_API_KEY (sent as x-api-key) Source 2সোর্স 2:
export ANTHROPIC_BASE_URL=https://llm-gateway.example.com
export ANTHROPIC_AUTH_TOKEN=sk-gateway-keyThen run /status. The Anthropic base URL line shows only when a gateway address is set Source 2সোর্স 2.
সহজ English
A request goes through five steps in the gateway:
- Auth. The app shows a gateway key, not the real provider key. LiteLLM gives each user, team, and project its own virtual key Source 5সোর্স 5. Azure API Management can use managed identities, so it needs no API key to reach Azure AI services Source 7সোর্স 7.
- Limits and budgets. Each LiteLLM key has its own models, budget, and rate limits Source 5সোর্স 5. Azure can set a limit of tokens per minute (TPM) or a token quota for each user of the API Source 7সোর্স 7. Cloudflare can limit the number of requests Source 3সোর্স 3.
- Routing. The gateway picks the model that gets the request. Some gateways can also answer from a cache, so the provider gets no call Source 3সোর্স 3.
- Fallback. If the first model fails, the gateway tries the next one. In Cloudflare, an error starts the fallback, and a set timeout can too Source 4সোর্স 4. The response header
cf-aig-steptells which step answered.0means the first model Source 4সোর্স 4. LiteLLM tries the fallbacks in order. It also retries, pauses a failing model for a time, and has special fallbacks for "prompt too long" and content-policy errors Source 6সোর্স 6. Azure can stop sending requests to a backend that does not answer Source 7সোর্স 7. - Logs and cost. Cloudflare shows requests, tokens, and cost Source 3সোর্স 3. LiteLLM records the cost of each request and can send logs and metrics to tools such as OpenTelemetry and Prometheus Source 5সোর্স 5. Azure can log the prompts and the answers Source 7সোর্স 7. Kong can remove personal data (PII) from a prompt before the provider sees it Source 8সোর্স 8.
To send Claude Code through a gateway, set ANTHROPIC_BASE_URL to the gateway address. Put the gateway key in ANTHROPIC_AUTH_TOKEN (sent as Authorization: Bearer) or in ANTHROPIC_API_KEY (sent as x-api-key) Source 2সোর্স 2. Then run /status. The Anthropic base URL line shows only when a gateway address is set Source 2সোর্স 2.
বাংলা ব্যাখ্যা
gateway-এর ভেতরে একটা রিকোয়েস্ট পাঁচটা ধাপ পার হয়:
- Auth। অ্যাপ আসল provider key দেখায় না, দেখায় gateway key। LiteLLM প্রতিটা user, team আর project-কে আলাদা virtual key দেয় Source 5সোর্স 5। Azure API Management managed identity ব্যবহার করতে পারে, ফলে Azure-এর AI সার্ভিসে পৌঁছাতে তার API key লাগে না Source 7সোর্স 7।
- Limit আর বাজেট। LiteLLM-এর প্রতিটা key-এর নিজের মডেল, বাজেট আর rate limit থাকে Source 5সোর্স 5। Azure প্রতিটা ব্যবহারকারীর জন্য প্রতি মিনিটে token-এর সীমা (TPM) বা একটা token quota সেট করতে পারে Source 7সোর্স 7। Cloudflare রিকোয়েস্টের সংখ্যা সীমিত করতে পারে Source 3সোর্স 3।
- Routing। কোন মডেল রিকোয়েস্টটা পাবে, gateway তা ঠিক করে। কিছু gateway provider-কে কল না করে cache থেকেও উত্তর দিতে পারে Source 3সোর্স 3।
- Fallback। প্রথম মডেল ব্যর্থ হলে gateway পরেরটা চেষ্টা করে। Cloudflare-এ একটা error হলে fallback শুরু হয়, আর সেট করা timeout-এও হতে পারে Source 4সোর্স 4। response header
cf-aig-stepবলে দেয় কোন ধাপ উত্তর দিল।0মানে প্রথম মডেল Source 4সোর্স 4। LiteLLM ক্রম অনুযায়ী fallback চেষ্টা করে। সে retry করে, ব্যর্থ মডেলকে কিছু সময় বিরতি দেয়, আর context-window ও content-policy error-এর জন্য আলাদা fallback রাখে Source 6সোর্স 6। কোনো backend সাড়া না দিলে Azure সেখানে রিকোয়েস্ট পাঠানো বন্ধ করতে পারে Source 7সোর্স 7। - Log আর খরচ। Cloudflare রিকোয়েস্ট, token আর খরচ দেখায় Source 3সোর্স 3। LiteLLM প্রতিটা রিকোয়েস্টের খরচ রেকর্ড করে, আর OpenTelemetry, Prometheus-এর মতো টুলে log ও metric পাঠাতে পারে Source 5সোর্স 5। Azure prompt আর উত্তর log করতে পারে Source 7সোর্স 7। Kong provider-এর কাছে পৌঁছানোর আগে prompt থেকে ব্যক্তিগত তথ্য (PII) মুছে দিতে পারে Source 8সোর্স 8।
Claude Code-কে gateway দিয়ে চালাতে ANTHROPIC_BASE_URL-এ gateway-এর ঠিকানা দিন। gateway key রাখুন ANTHROPIC_AUTH_TOKEN-এ (যায় Authorization: Bearer হিসেবে) বা ANTHROPIC_API_KEY-এ (যায় x-api-key হিসেবে) Source 2সোর্স 2। তারপর /status চালান। gateway-এর ঠিকানা সেট থাকলেই কেবল Anthropic base URL লাইনটা দেখা যায় Source 2সোর্স 2।
Trade-offs
A gateway is not free. The Claude Code docs name the main cost: the gateway becomes infrastructure that your organization operates Source 1সোর্স 1. Claude Code adds features with each release, and a gateway that does not forward them breaks those features, so you must keep the gateway product up to date Source 1সোর্স 1.
The next point is the tutorial's own reasoning, not a quote from a source. A gateway also adds one hop to every call, and it is a shared point of failure. If the gateway is down, every app behind it loses its models, even when all providers are up.
A gateway does not make every model work with every client. For example, Anthropic does not support routing Claude Code to non-Claude models through any gateway Source 1সোর্স 1.
সহজ English
A gateway has a cost. The Claude Code docs say that the gateway becomes one more system that your company must run Source 1সোর্স 1. Claude Code gets new features with each release. If the gateway does not pass them on, those features break. So you must keep the gateway up to date Source 1সোর্স 1.
The next point is the tutorial's own reasoning, not a quote from a source. A gateway also adds one more stop to every call, and all apps share it. If the gateway is down, every app behind it loses its models, even when all providers work.
A gateway does not make every model work with every client. For example, Anthropic does not support sending Claude Code to non-Claude models through any gateway Source 1সোর্স 1.
বাংলা ব্যাখ্যা
gateway-এর একটা খরচ আছে। Claude Code-এর ডকস বলে, gateway আপনার প্রতিষ্ঠানের চালানো আরেকটা infrastructure হয়ে যায় Source 1সোর্স 1। Claude Code প্রতিটা release-এ নতুন feature যোগ করে। gateway সেগুলো সামনে না পাঠালে সেই feature-গুলো ভেঙে যায়, তাই gateway প্রোডাক্টটাকে আপডেট রাখতে হয় Source 1সোর্স 1।
পরের কথাটা টিউটোরিয়ালের নিজের যুক্তি, কোনো সোর্সের উদ্ধৃতি নয়। gateway প্রতিটা কলে আরেকটা ধাপ যোগ করে, আর সব অ্যাপ এটা ভাগ করে ব্যবহার করে। gateway বন্ধ হলে তার পেছনের সব অ্যাপ মডেল হারায়, সব provider ঠিকঠাক চললেও।
gateway থাকলেই যেকোনো client যেকোনো মডেলের সাথে চলবে, এমন নয়। যেমন, Anthropic কোনো gateway দিয়েই Claude Code-কে non-Claude মডেলে পাঠানো সাপোর্ট করে না Source 1সোর্স 1।
A real-life example
This is an invented example. A QA team runs three AI tools: a test-case generator, a bug-report summarizer, and a Claude Code agent that fixes flaky tests in CI. Before the gateway, each tool had its own provider key in its own config file. Nobody knew the total cost, and one leaked key meant a hunt through three repos.
The team puts a gateway in front of all three tools:
- Each tool gets its own gateway key, so usage is attributed to it, and a revoked key affects only one tool Source 1সোর্স 1.
- The provider keys stay only in the gateway Source 1সোর্স 1.
- The CI agent gets a small budget and a rate limit, so a loop in the agent cannot burn the month's spend Source 5সোর্স 5.
- The summarizer has a fallback model. When the first provider returns errors, the gateway sends the request to the second one Source 4সোর্স 4.
- The CI job sets
ANTHROPIC_BASE_URLto the gateway and takes the gateway key from a CI secret Source 2সোর্স 2.
Now one dashboard shows the requests, tokens, and cost of all three tools Source 3সোর্স 3.
সহজ English
This is an invented example. A QA team uses three AI tools. One writes test cases. One sums up bug reports. One is a Claude Code agent that fixes flaky tests in CI. Before the gateway, each tool kept its own provider key in its own config file. Nobody knew the total cost. If one key leaked, the team had to search three repos.
The team puts a gateway in front of all three tools:
- Each tool gets its own gateway key. So the team sees the usage of each tool, and a revoked key stops only one tool Source 1সোর্স 1.
- The provider keys stay only in the gateway Source 1সোর্স 1.
- The CI agent gets a small budget and a rate limit. So an agent stuck in a loop cannot use up the money for the month Source 5সোর্স 5.
- The summarizer has a second model. When the first provider returns errors, the gateway sends the request to the second one Source 4সোর্স 4.
- The CI job sets
ANTHROPIC_BASE_URLto the gateway and reads the gateway key from a CI secret Source 2সোর্স 2.
Now one dashboard shows the requests, tokens, and cost of all three tools Source 3সোর্স 3.
বাংলা ব্যাখ্যা
এটা একটা বানানো উদাহরণ। একটা QA টিম তিনটা AI টুল চালায়: একটা test case লেখে, একটা bug report-এর সারাংশ বানায়, আর একটা Claude Code agent CI-তে flaky test ঠিক করে। gateway-এর আগে প্রতিটা টুলের নিজের config ফাইলে নিজের provider key ছিল। মোট খরচ কেউ জানত না, আর একটা key ফাঁস হলে তিনটা repo খুঁজতে হতো।
টিম তিনটা টুলের সামনেই একটা gateway বসায়:
- প্রতিটা টুল নিজের gateway key পায়। তাই প্রতিটা টুলের usage আলাদা দেখা যায়, আর একটা key বাতিল করলে শুধু একটা টুল থামে Source 1সোর্স 1।
- provider key শুধু gateway-তেই থাকে Source 1সোর্স 1।
- CI agent পায় একটা ছোট বাজেট আর একটা rate limit। ফলে agent একটা loop-এ আটকে গেলেও পুরো মাসের টাকা শেষ করতে পারে না Source 5সোর্স 5।
- summarizer-এর একটা fallback মডেল আছে। প্রথম provider error দিলে gateway রিকোয়েস্টটা দ্বিতীয়টায় পাঠায় Source 4সোর্স 4।
- CI job
ANTHROPIC_BASE_URL-এ gateway সেট করে, আর gateway key নেয় একটা CI secret থেকে Source 2সোর্স 2।
এখন একটা dashboard-এ তিনটা টুলের রিকোয়েস্ট, token আর খরচ দেখা যায় Source 3সোর্স 3।
Common mistakes
- The provider key is still in the app. The point of the gateway is that the provider key stays on the server and clients hold only gateway credentials Source 1সোর্স 1. If an app still has the real key, it can skip the gateway.
- A side door stays open. A gateway controls only the traffic that goes through it. Claude Code can be locked to the gateway: with
allowedProvidersset to["customEndpoint"]in managed settings, it refuses a session pointed anywhere else Source 1সোর্স 1. - The gateway key is committed. The Claude Code docs warn not to put the credential in a project's
.claude/settings.json, because that file is committed and shared Source 2সোর্স 2. - One shared key for everyone. Give each developer a credential, so usage is attributed and offboarding revokes one credential Source 1সোর্স 1.
- The fallback is never tested. A fallback that has never fired is a guess. LiteLLM's docs say to test it with a real provider error in a non-production environment Source 6সোর্স 6.
- The logs hold secrets. A gateway can log prompts and completions Source 7সোর্স 7. If a prompt has personal data, the log has it too, unless the gateway redacts it first Source 8সোর্স 8.
- The gateway falls behind the client. A gateway that does not forward new Claude Code features breaks them Source 1সোর্স 1.
সহজ English
- The real key is still in the app. The gateway is there so that the real key stays on the server and apps hold only gateway keys Source 1সোর্স 1. If an app still has the real key, it can go around the gateway.
- A side door stays open. A gateway controls only the calls that go through it. You can lock Claude Code to the gateway. With
allowedProvidersset to["customEndpoint"]in managed settings, it refuses any other address Source 1সোর্স 1. - The gateway key is in git. The Claude Code docs say: do not put the key in a project's
.claude/settings.json, because that file is committed and shared Source 2সোর্স 2. - One key for everyone. Give each developer a key. Then you see who used what, and when a person leaves, you remove one key Source 1সোর্স 1.
- Nobody tested the fallback. A fallback that never ran is only a hope. The LiteLLM docs say to test it with a real provider error, outside production Source 6সোর্স 6.
- The logs hold secrets. A gateway can log the prompts and the answers Source 7সোর্স 7. If a prompt has personal data, the log has it too, unless the gateway removes it first Source 8সোর্স 8.
- The gateway is older than the client. If the gateway does not pass on new Claude Code features, those features break Source 1সোর্স 1.
বাংলা ব্যাখ্যা
- আসল key এখনো অ্যাপে আছে। gateway-এর উদ্দেশ্যই হলো provider key সার্ভারে রাখা, আর client-এর হাতে শুধু gateway credential দেওয়া Source 1সোর্স 1। কোনো অ্যাপে আসল key থেকে গেলে সে gateway এড়িয়ে যেতে পারে।
- পাশের দরজা খোলা থাকে। gateway শুধু তার ভেতর দিয়ে যাওয়া traffic-ই নিয়ন্ত্রণ করে। Claude Code-কে gateway-তে আটকে রাখা যায়: managed settings-এ
allowedProviders-কে["customEndpoint"]দিলে সে অন্য কোনো ঠিকানার session চালাতে রাজি হয় না Source 1সোর্স 1। - gateway key git-এ commit হয়ে যায়। Claude Code-এর ডকস সতর্ক করে: project-এর
.claude/settings.json-এ credential রাখবেন না, কারণ ফাইলটা commit হয় আর সবার সাথে শেয়ার হয় Source 2সোর্স 2। - সবার জন্য একটাই key। প্রতিটা ডেভেলপারকে আলাদা credential দিন। তাহলে কে কতটা ব্যবহার করল তা বোঝা যায়, আর কেউ চলে গেলে একটা credential বাতিল করলেই হয় Source 1সোর্স 1।
- fallback কখনো টেস্ট হয়নি। যে fallback কখনো চলেনি, সেটা শুধু একটা অনুমান। LiteLLM-এর ডকস বলে, production-এর বাইরে একটা আসল provider error দিয়ে এটা টেস্ট করতে Source 6সোর্স 6।
- log-এ গোপন তথ্য থাকে। gateway prompt আর উত্তর log করতে পারে Source 7সোর্স 7। prompt-এ ব্যক্তিগত তথ্য থাকলে log-এও সেটা থাকে, যদি না gateway আগে তা মুছে দেয় Source 8সোর্স 8।
- gateway client-এর থেকে পিছিয়ে পড়ে। gateway নতুন Claude Code feature সামনে না পাঠালে সেগুলো ভেঙে যায় Source 1সোর্স 1।
What a tester can check
Tutorial advice
This list is the tutorial's own advice, not a quote from a source.
- Fallback: in a test environment, block or break the primary provider. Check that the call still succeeds, that the response shows which model served it, and that the app's behavior is still correct with the second model.
- Total outage: break all providers. Check that the app shows a clear error and does not hang or retry forever.
- Rate limit: send requests faster than the limit. Check the status code, the error body, and that the app backs off.
- Budget: give a test key a tiny budget and use it up. Check that the gateway blocks the next call and that the cost in the dashboard matches your count.
- Keys: search the app bundle, the repo, the CI logs, and the browser traffic for the provider key. It must not be there. Check that a revoked gateway key gets
401at once. - Bypass: from an app machine, try to call the provider directly. Check that policy or the network blocks it.
- Log redaction: send a prompt with fake personal data (a fake email, a fake card number). Check that the gateway log does not show it in clear text.
- Routing rules: for each rule (by team, by model name, by header), send one request and check that the right upstream got it.
- Gateway down: stop the gateway. Check what each app does.
সহজ English
Tutorial advice
This list is the tutorial's own advice, not a quote from a source.
- Fallback: in a test environment, block or break the first provider. Check that the call still works, that the answer shows which model gave it, and that the app still works right with the second model.
- All providers down: break every provider. Check that the app shows a clear error and does not hang or retry forever.
- Rate limit: send requests faster than the limit. Check the status code and the error text, and check that the app waits before it tries again.
- Budget: give a test key a very small budget and use it all. Check that the gateway stops the next call and that the cost on the dashboard matches your own count.
- Keys: look for the real provider key in the app files, the repo, the CI logs, and the browser traffic. It must not be there. Check that a removed gateway key gets
401at once. - Side door: from an app machine, try to call the provider directly. Check that a rule or the network stops it.
- Log cleaning: send a prompt with fake personal data, such as a fake email or a fake card number. Check that the gateway log does not show it as plain text.
- Routing rules: for each rule (by team, by model name, by header), send one request and check that the right model got it.
- Gateway down: stop the gateway. Check what each app does.
বাংলা ব্যাখ্যা
Tutorial advice
এই তালিকা টিউটোরিয়ালের নিজের পরামর্শ, কোনো সোর্সের উদ্ধৃতি নয়।
- Fallback: টেস্ট এনভায়রনমেন্টে প্রথম provider-কে block করুন বা ভেঙে দিন। দেখুন কলটা তবুও সফল হয় কি না, response-এ কোন মডেল উত্তর দিল তা দেখা যায় কি না, আর দ্বিতীয় মডেলেও অ্যাপ ঠিকমতো চলে কি না।
- সব provider বন্ধ: সব provider ভেঙে দিন। দেখুন অ্যাপ একটা পরিষ্কার error দেখায় কি না, আর আটকে থাকে বা অনন্তকাল retry করে কি না।
- Rate limit: limit-এর চেয়ে দ্রুত রিকোয়েস্ট পাঠান। status code আর error body দেখুন, আর দেখুন অ্যাপ আবার চেষ্টার আগে অপেক্ষা করে কি না।
- বাজেট: একটা test key-কে খুব ছোট বাজেট দিন আর সেটা শেষ করুন। দেখুন gateway পরের কল আটকায় কি না, আর dashboard-এর খরচ আপনার নিজের হিসাবের সাথে মেলে কি না।
- Key: অ্যাপের ফাইল, repo, CI log আর ব্রাউজার traffic-এ আসল provider key খুঁজুন। সেটা থাকা চলবে না। দেখুন বাতিল করা gateway key সাথে সাথে
401পায় কি না। - পাশের দরজা: অ্যাপের মেশিন থেকে সরাসরি provider-কে কল করার চেষ্টা করুন। দেখুন কোনো policy বা নেটওয়ার্ক সেটা আটকায় কি না।
- Log redaction: নকল ব্যক্তিগত তথ্য (নকল email, নকল card নম্বর) দিয়ে একটা prompt পাঠান। দেখুন gateway log-এ সেটা সাধারণ লেখা হিসেবে দেখা যায় কি না।
- Routing rule: প্রতিটা rule-এর (team, মডেলের নাম বা header অনুযায়ী) জন্য একটা রিকোয়েস্ট পাঠান, আর দেখুন সঠিক upstream সেটা পেল কি না।
- gateway বন্ধ: gateway থামিয়ে দিন। দেখুন প্রতিটা অ্যাপ কী করে।
Key words
| Term | Meaning |
|---|---|
| AI gateway / LLM gateway | A proxy between apps and model providers that handles credentials, limits, routing, and logs in one place. |
| Upstream | The model provider, self-hosted model, or MCP server behind the gateway. |
| Gateway credential / virtual key | The key an app or person uses to call the gateway. It is not the provider key. |
| Provider key | The real key of the model provider. It stays in the gateway. |
| Fallback | A second model or provider that the gateway tries when the first one fails. |
| Circuit breaker | A rule that stops sending requests to a backend that does not respond. |
| Rate limit | A cap on requests or tokens per time unit. |
| Budget / quota | A cap on spend or tokens for a key, team, or app over a period. |
| TPM | Tokens per minute. |
| PII redaction | Removing personal data from a prompt or a log. |
ANTHROPIC_BASE_URL | The variable that points Claude Code at a gateway. |