An AI API gateway, also called an LLM API aggregator or API relay, gives you one base URL and one API key for models from OpenAI, Anthropic, Google and others. It forwards each request to an upstream provider and bills you for what you actually use. Many gateways run on open-source software such as New API. When you choose one, check seven things: models and routes, pricing, billing records, balance and quota controls, reliability, data and key security, and payment and invoicing. You can verify every one of them during a trial.
Gateways usually cost less than the official price. Some get there through volume pricing. Others trade away reliability, model quality or the safety of your prepaid balance. The section on why some gateways are so cheap shows how to tell these apart and how to work out your real discount.
If you run Claude Code or Codex, the section on coding agents covers how a gateway differs from the official plans, what gets accounts banned, and monthly plans versus pay-as-you-go. If you resell API access, there is a section on choosing an upstream supplier. To try Brioi, ask sales for a trial and run your own workload on it for a while.
Based on the New API README on GitHub, Anthropic’s and OpenAI’s official terms and pricing pages, OpenRouter’s pricing page and Brioi’s API docs (checked 2026-11).
What an AI API gateway does
A gateway does three jobs.
It gives you one interface. Each vendor has its own API format: OpenAI uses Chat Completions and Responses, Anthropic uses Messages, and Gemini has its own native format. A gateway exposes endpoints compatible with these formats, so a client usually only changes base_url and the key. Brioi’s endpoints:
| Format | Path |
|---|---|
| OpenAI-compatible | /v1/chat/completions, /v1/responses |
| Anthropic | /v1/messages |
| Gemini native | /v1beta/models/{model}:generateContent |
| Model list | GET /v1/models |
It runs several upstream routes. Behind one model, a gateway can connect several upstreams, such as the vendor’s own API or the same model on a cloud platform (Azure OpenAI in Microsoft Foundry, Amazon Bedrock, Google Cloud). The gateway spreads requests by priority and weight, and retries or switches routes when one fails.
It bills per use. Each request records the model and the input and output tokens, and the cost comes out of your balance at the listed rate. Image and video models are usually billed per image or per second.
A request travels like this:
Your app ──(one base_url + one key)──> Gateway
├─> Upstream route A (e.g. the vendor's own API)
├─> Upstream route B (e.g. a cloud platform)
└─> Log usage, charge the balance, write the request log
A gateway also helps where official services aren’t offered. The OpenAI API and Anthropic’s Claude aren’t offered in Russia, Belarus, Iran, mainland China, Hong Kong, Macau, Syria, Cuba, Venezuela or North Korea, and official billing often declines cards issued in some other countries. Brioi works in regions where the official APIs aren’t offered and takes USDT or an international card. Setup guides for specific tools: Claude Code, Codex, Cursor.
What New API is
New API is an open-source AI gateway on GitHub. The official repository is QuantumNous/new-api. It builds on One API (MIT license) and is released under AGPLv3. The README describes it as a self-hosted LLM gateway with OpenAI-, Claude- and Gemini-compatible APIs.
Its main features, per the README:
| Area | What it does |
|---|---|
| Model access | OpenAI Chat Completions and Responses, Anthropic Messages, Gemini; streaming, tool calls and multimodal input where the upstream supports them |
| Routing | Model mapping, channel priority and weight, retries, multiple upstream keys |
| Usage and cost | Quotas, usage logs, cache accounting, tiered pricing |
| Access control | Users, groups, granular permissions, API key limits |
| Async tasks | Status and result retrieval for image, video and other tasks |
You can start a local instance with Docker. This is the README’s quick start, with the time zone set to UTC (use your own):
mkdir -p data
docker run --name new-api -d --restart unless-stopped \
-p 127.0.0.1:3000:3000 \
-e TZ=UTC \
-v "$(pwd)/data:/data" \
calciumion/new-api:latest
Open http://localhost:3000 and follow the wizard to create the admin account. Then add a channel, enter an upstream API key, set model prices and create an API key. Clients use http://localhost:3000/v1 as the base URL.
The README also sets limits on use. You must obtain upstream API keys, accounts and permissions lawfully and follow each upstream’s terms. If you offer generative AI or API resale to the public, you handle the regulatory side yourself: content safety, identity checks, log retention, taxes and upstream authorization.
Many public gateways and resellers run on New API or similar software. The software being open source says nothing about any one site’s routes, prices or service quality, so each still needs the checks below.
Types of AI API gateway
Companies usually pick from three kinds:
| Type | What it is | Good for | Watch out for |
|---|---|---|---|
| Self-hosted open-source gateway | New API, One API or LiteLLM on your own servers | Teams that already have upstream accounts and want to manage internal usage in one place | You obtain upstream accounts yourself and handle operations, reconciliation and outages; open-source license obligations apply |
| Cloud model platforms | Azure OpenAI in Microsoft Foundry, Amazon Bedrock, Google Cloud’s Gemini Enterprise Agent Platform (formerly Vertex AI) | Companies already on that cloud | You need a cloud account in a supported region and model access; each platform has its own API format and model catalog |
| Hosted aggregators and API resellers | The provider runs the gateway and upstream routes; you get one key | Individuals and companies that want to start calling models without managing upstream accounts | Quality varies widely; run the 7 checks below |
OpenRouter is a widely used hosted aggregator. Its pricing page says inference is billed at the provider’s list price, plus a 5.5% fee when you buy credits on the Standard plan (8% on Business). Its terms say that models whose providers don’t serve your country or region aren’t available to you through OpenRouter (source: OpenRouter pricing, OpenRouter terms, checked 2026-11).
Brioi is the third type. One API key covers video, image and language models, and one balance pays for Seedance, GPT, Claude, Gemini and the rest. Enterprise pricing is about 10–50% of the official price, it works in regions the official APIs don’t serve, and you top up with USDT or an international card.
Why some AI API gateways are so cheap
Gateway prices are below list price, but the savings come from different places. Some are normal business. Others come out of reliability, model quality or your prepaid balance:
| Where the discount comes from | How it works | What to worry about |
|---|---|---|
| Volume and channel pricing | The provider buys at volume rates and channel discounts from vendors or clouds, then resells by usage | Low risk. Ask which upstream it is and how long the price will hold |
| Pricing units | Prices shown as “credits”, “multipliers” or top-up bonuses look cheap but may not be cheaper per million tokens | Convert to price per million tokens yourself before comparing |
| Resold subscriptions | Claude or ChatGPT subscription accounts are wired up as an API and resold. A flat monthly fee spread over many tokens is very cheap | Breaks the vendor’s terms, so the upstream account can be banned at any time; capacity is capped by the plan’s 5-hour and weekly limits |
| Watered-down models | A cheaper model is served under an expensive model’s name, or the context is cut short or reasoning effort lowered | Worse results while you pay for the expensive model |
| Accounts and keys of unknown origin | Mass-registered accounts using new-user credits, or leaked and stolen keys | Can stop working at any moment; no data protection |
| Low prices to pull in prepayment | Cheap rates to attract large top-ups or monthly plans | If the service stops, prepaid money is hard to recover |
How to work out your real discount
Ignore the listed price and look at what one real request actually cost:
- Send a fixed request with the model you use most. Note the
usageit returns: input, output and cache-read tokens. - Price that request at the vendor’s official rates in USD. For Claude, see how much Claude Code costs.
- Find the charge for that request in the gateway’s dashboard. If it bills in another currency, convert it to USD.
- Actual charge ÷ official price is your real discount.
For example, Claude Sonnet 5.5 lists at $2 per million input tokens and $10 per million output tokens (Anthropic pricing page, checked 2026-11). A request with 10,000 input tokens and 2,000 output tokens costs $0.02 + $0.02 = $0.04 at list price. If a gateway charged $0.012 for it, you paid 30% of list.
A low number on its own doesn’t settle it. Combine it with the route-source, model-check and long-task tests in the checklist below to tell a real discount from one with a hidden cost.
Brioi: enterprise pricing is about 10–50% of the official price, billed by actual usage, with one balance for Seedance, GPT, Claude, Gemini and every other model. Ask sales for a trial and run your own requests through it.
How to choose an AI API gateway: 7 checks
Run these seven checks during a trial. Each has a concrete test. Use your own real requests, not the marketing page. To test Brioi, ask sales for a trial.
1. Models and routes cover what you need
What to look for: every model you need is there; you know how many routes each model has and where they come from; the API formats you use (OpenAI, Anthropic, Gemini, image, video) all work.
How to test:
- Call the model list with a test key and confirm the model names you need are there:
curl https://vip.brioi.com/v1/models \
-H "Authorization: Bearer YOUR_API_KEY"
- Send one real request to each model, in the format you will actually use. A model that is listed but errors on every call doesn’t count.
- Ask where each route comes from, for example the vendor’s own API or a cloud platform.
- If you use tool calls, streaming, long context or image input, test each one.
Brioi: when you create a key you pick a group, and the group name tells you the route, for example GPT | Official (OpenAI official route), GPT | Azure (Azure GPT text route) or Gemini | Vertex (Gemini Vertex text route). Every model and group is listed publicly on the pricing page.
2. Prices are public and checkable
What to look for: a public price for every model and route; how input, output and cache tokens are each charged; how per-image or per-second models are charged; how it compares with the official price.
How to test:
- The pricing page loads without signing in and maps to specific models and routes.
- Send a fixed request, note the returned
usage(input and output tokens), work out what it should cost from the pricing page, and compare with the charge in the dashboard. - Compare each model’s rate with the vendor’s official pricing page. For Claude’s official prices and usage estimates, see how much Claude Code costs.
- Ask whether price changes are announced in advance.
Brioi: every model and group price is public on the pricing page. Enterprise pricing is about 10–50% of the official price.
3. Billing records and reconciliation
What to look for: a traceable record for every request, with model, token counts, cost and time; an export your finance team can use.
How to test:
- Run the trial script below and look up each request ID it prints in the dashboard. Amounts and token counts should match.
- Ask whether failed requests are charged, then test one.
- Have finance look at an export and confirm it can be summed by month and by project.
Brioi: billed by actual usage. Every response carries an X-Oneapi-Request-Id header, which ties a charge or an error back to one request.
4. Balance and quota controls
What to look for: what happens when the balance runs out; whether usage can be split by project or team member; whether there are balance alerts.
How to test:
- Drain a small test balance and see which error code comes back. Your code should recognize it and alert someone.
- Create one key for each of two projects and confirm the dashboard shows their usage separately.
- Ask about balance alerts and per-key spending caps.
Brioi: when the balance or quota is used up, the API returns 403; error codes are in the API docs. You can create a key per project and give each its own group.
5. Reliability and incident handling
What to look for: clear error codes; failure rate and latency at peak hours; who tells you about an outage and how fast; whether a model has a backup route.
How to test:
- Check that the docs explain every error code. You should be able to write 401, 403, 429 and 503 straight into your retry logic.
- Run your real request volume for at least 30 minutes and record the failure rate and latency, ideally during weekday peak hours in your market.
- For async image and video tasks, run the full flow once: create, poll, fetch the result, handle a failure. Ask whether you can keep polling with the same task ID after a query times out.
- Ask how outages are announced and who your contact is.
Brioi: automatic best-route selection, with automatic failover when a route has problems and 24/7 route monitoring. Error codes, async polling and recommended intervals are in the API docs (in Chinese). For example, 503 model_not_found means the key’s group has no available route for that model.
6. Data and key security
What to look for: whether the provider logs prompts and responses and for how long; whether keys can be disabled and rotated at any time; a written data-handling statement.
How to test:
- Ask for a written answer: which fields are logged, whether request and response bodies are stored, for how long, and which upstreams requests go to.
- Disable a key and confirm calls fail right away.
- Check your own side: keys only on the server, never in front-end code, URLs or public logs; one key per project, so a leak means disabling one key.
- If you handle personal data or sensitive code, have security and legal review the data-handling statement first.
Brioi: keys can be disabled and regenerated at any time on the API keys page. The API docs say keys must not go into URLs, request bodies, front-end code or public logs. A data-handling statement can be provided for enterprise customers.
7. Payment, invoices and contracts
What to look for: payment methods that work for your company and country; invoices with the right legal entity; contracts if your procurement needs one.
How to test:
- Before the trial, ask which payment methods are accepted, what invoices look like and which entity issues them.
- Check that the contracting party, the payee and the invoice issuer are the same entity.
- If procurement needs a framework agreement, prepayment or monthly billing, confirm it is possible before you commit.
Brioi: top up on the main site with USDT or an international card. Invoices, contracts and payment terms can be arranged to fit enterprise procurement.
Trial script
This script sends 20 requests to one model, prints the request ID, token counts and latency for each, then sums up failures and median latency. Take the printed request IDs to the dashboard and match the charges, and you have covered part of checks 3 and 5.
Set the environment variables first:
export GATEWAY_BASE_URL="https://vip.brioi.com/v1"
export GATEWAY_API_KEY="YOUR_API_KEY"
export GATEWAY_MODEL="gpt-5.6-sol"
Replace GATEWAY_MODEL with a model from the model list that you want to test. Install the SDK and run:
pip install openai
python gateway_check.py
gateway_check.py:
import os
import statistics
import time
from openai import OpenAI
client = OpenAI(
base_url=os.environ["GATEWAY_BASE_URL"],
api_key=os.environ["GATEWAY_API_KEY"],
)
model = os.environ["GATEWAY_MODEL"]
latencies = []
failures = 0
for i in range(20):
start = time.time()
try:
raw = client.chat.completions.with_raw_response.create(
model=model,
messages=[{"role": "user", "content": "Reply with OK only."}],
)
resp = raw.parse()
elapsed = time.time() - start
latencies.append(elapsed)
usage = resp.usage
print(
i,
"request_id:", raw.headers.get("X-Oneapi-Request-Id"),
"input:", usage.prompt_tokens if usage else None,
"output:", usage.completion_tokens if usage else None,
"latency:", round(elapsed, 2), "s",
)
except Exception as e:
failures += 1
print(i, "failed:", type(e).__name__, e)
print("succeeded", len(latencies), "failed", failures)
if latencies:
print("median latency", round(statistics.median(latencies), 2), "s")
X-Oneapi-Request-Id is the header Brioi uses for the request ID. When testing another provider, use the field its docs name. The script uses a small amount of balance. For a real evaluation, replace the prompt with your actual workload and set the request count and concurrency to match production.
Choosing an upstream supplier as an API reseller
If you resell API access, you are choosing a gateway for your customers as well as yourself. On top of the 7 checks, look at these:
- Margin. Your sell price has to sit between the upstream’s price and the official list price. Work out the real discount with the method above for the models your customers use most, not just the headline rate.
- Model breadth from one account. Customers ask for new models soon after launch. One upstream that covers video, image and language models saves you from holding a balance with each vendor.
- One key per customer. You need separate keys, usage and spending caps per customer so you can bill them and cut one off without touching the others.
- Request IDs for support. When a customer reports an error, you need to trace it upstream. Ask whether every response carries a request ID and whether the upstream’s support will look it up.
- Async tasks. Image and video jobs are created, polled and fetched. Test that task IDs stay valid long enough and that failed tasks report a reason you can pass on.
- Payment that fits your business. Check that you can top up in a way that works from your country and at your volume.
- Your own obligations. As the New API README points out, if you offer AI services to the public, the regulatory work in your market is yours: content safety, identity checks, log retention and taxes.
Resellers and distributors already use Brioi as their upstream. One balance covers Seedance, GPT, Claude, Gemini and other models, enterprise pricing is about 10–50% of the official price, every response has a request ID, and you can create a key per customer. Ask sales for a trial and test it against your customers’ real traffic.
Claude Code and Codex through a gateway
Claude Code and Codex subscriptions aren’t offered in every region, and many teams would rather pay per token than work within 5-hour and weekly caps. Coding agents are different from chat. One task sends dozens or hundreds of requests in a row, each carrying the code and conversation history, with tool calls in between. So beyond the 7 checks, look at the points below.
How a gateway differs from the official plans
| Official plan (subscription account) | Through a gateway (API key) | |
|---|---|---|
| Sign-in | Claude or ChatGPT account | Claude Code needs no official account; you enter the gateway URL and key. Codex Desktop still needs your own ChatGPT sign-in, while model requests use the gateway key |
| Billing | Monthly subscription with 5-hour and weekly limits | Per token, or a monthly plan set by the gateway |
| When you run out | Wait for the reset, upgrade, or buy extra usage | Top up the balance; no official 5-hour or weekly cap |
| Models | Models included in the plan | Models in the gateway group, with the same names as the official API |
| Features | Everything | Local coding in the terminal and IDE works; features tied to the official cloud account may not |
| Data path | Straight to the vendor | Through the gateway, then to the upstream |
OpenAI’s Codex pricing page spells out the Codex side. With an API key you can use Codex in the CLI, SDK and IDE extension, billed at API rates, and model availability follows the API models available to your key. Cloud features such as GitHub code review and Slack aren’t available. Codex usage in a ChatGPT plan and API token prices are separate, so one can’t be used to estimate the other.
For how Claude Code subscriptions compare with API pricing, see how much Claude Code costs. Setup guides: Claude Code and Codex.
Using Codex through a third-party provider
Any OpenAI-compatible provider can sit between Codex and the model. Codex sends model requests to the provider, the provider forwards them upstream and bills you by usage. The provider earns the gap between its upstream cost and its sell price, so compare its rates with OpenAI’s API token prices, not with a ChatGPT subscription.
Before you point Codex at a provider, confirm three things:
- It supports the Responses API. A custom provider in Codex’s
config.tomluseswire_api = "responses", so the provider must support/v1/responses. A provider with only Chat Completions won’t work. - The model is in your key’s group.
GET /v1/modelsshows which models your key can use right now. Themodelinconfig.tomlmust be in that list, or you get 503model_not_found. - Long tasks and tool calls hold up. Codex runs commands and edits files through tool calls, so one task sends many requests in a row. Run a real task for half an hour and watch for interruptions and errors.
Codex Desktop still needs you signed in to your own ChatGPT account; model requests then go through the provider’s key. Full Desktop and CLI setup is in the Codex setup guide.
Brioi supports the OpenAI Responses API (/v1/responses), bills by actual usage, and one balance covers GPT, Claude, Gemini, Seedance and every other model.
Will Claude Code get banned through a gateway?
It depends on whose account is at risk:
- Shared subscription accounts. Some services split one Claude or ChatGPT subscription among many users. Anthropic’s Consumer Terms say you may not share your account login or make your account available to anyone else, that access can be suspended or terminated for a breach, and that a subscription ended for a breach is not refunded. OpenAI’s Terms of Use also say you may not share your account credentials or make your account available to anyone else. When the upstream account is banned, everyone on that route stops working at once.
- Your own official account. Lend your subscription to others or split it with a group, and it is your account that gets banned.
- API-key access. Model requests use the gateway’s API key, not someone else’s subscription. Claude Code needs no official sign-in, and Codex Desktop uses your own ChatGPT account, which you haven’t shared. Whether it stays up depends on whether the gateway’s upstream routes are proper API or cloud-platform routes.
So whether a route keeps working comes down to where it comes from.
How to tell whether a provider is stable
Run Claude Code or Codex on a real, long task for at least 30 minutes and watch these:
- Ask where the routes come from. Is each group backed by the vendor’s API, a cloud platform (such as Amazon Bedrock or Google Cloud), or a pool of subscription accounts? Be careful with vague answers.
- Watch whether long tasks break. Frequent 429s, 503s and timeouts, or a sudden demand to sign in again, mean the route lacks capacity or the upstream is unstable.
- Check that caching works. In Claude Code, run
/usage. Recent versions show aPrompt cache (main)line with the share of input tokens served from cache. On coding tasks most input should hit the cache. Without caching, every request pays full input price and the bill can be several times higher. - Check the model is the one you asked for. Compare the
modelandusagefields in the response with your request, and check the token counts match your input. Test tool calls, long context and image input separately. - Check that errors can be traced. Every request should have an ID that you can look up in the dashboard, and someone should answer when you ask.
- Ask what happens when a route fails. Does the model have a backup route, and does failover happen automatically or do you switch groups by hand?
- Check keys can be managed separately. A team needs one key per person, each one possible to disable on its own, with usage shown separately.
Brioi: Claude Code uses the Claude Code | CCMAX | 满血版 group (the Chinese part means “full version”). All groups and prices are public on the pricing page. Brioi picks the best route automatically, fails over when a route has problems, and monitors routes 24/7. You can create a key per person or per project and disable it at any time.
Monthly plans vs pay-as-you-go for Codex and Claude Code
Some providers sell monthly plans: a fixed fee for a set amount of usage or time. Pay-as-you-go charges for the tokens you use.
| Monthly plan | Pay-as-you-go | |
|---|---|---|
| Cost | Fixed; unused allowance is usually not refunded | Pay for what you use |
| Allowance | Set by the provider, often capped per day, per 5 hours or per request | Limited only by balance and rate limits |
| Transparency | Hard to compare with official prices | Token counts and cost for every request can be reconciled |
| Risk | Your prepayment depends on the service continuing | Top up as needed, little prepaid |
| Good for | Individuals with steady daily use who can live with the caps | Individuals with uneven use, and teams that need to reconcile costs |
Before buying a monthly plan, ask four things: how the allowance is counted, what happens when it runs out, which routes are behind it, and what happens to prepaid money if the service stops. For teams that file expenses or split costs by project, pay-as-you-go is easier to reconcile.
Brioi bills by actual usage with no subscription, at about 10–50% of the official price. One balance covers Seedance, GPT, Claude, Gemini and every other model, so Claude Code and Codex don’t need separate top-ups. To try it first, use “Contact sales” at the bottom of this page and ask for a trial.
Is an API gateway legitimate to use?
This article doesn’t give legal advice; the answer depends on your business, your contracts and the data involved. Points to check:
- The provider’s legal entity. Look up the company and confirm it is the same entity that signs the contract, receives payment and issues invoices.
- Terms of service and privacy policy. Read the scope of service, liability, data handling and what happens if the service ends.
- A data-handling statement. Ask in writing what is logged, for how long, and which upstreams requests go to.
- Your own use. If you build a public AI product on these models, the regulatory obligations in your market are yours.
For personal data, cross-border data transfers or public-facing services, ask your lawyer.
FAQ
Which AI API gateway is best?
There is no single answer. It depends on the models you need, your request volume and your reconciliation needs. Shortlist two or three, run the 7 checks on each for one to two weeks, and compare failure rate, latency and billing records on real requests. You can ask Brioi’s sales team for a trial.
How is Brioi different from OpenRouter?
OpenRouter bills inference at the provider’s list price and adds a fee when you buy credits (5.5% on its Standard plan, per its pricing page, checked 2026-11). Brioi’s enterprise pricing is about 10–50% of the official price. Brioi also works in regions where the official OpenAI and Anthropic APIs aren’t offered, takes USDT or an international card, and one balance covers video models such as Seedance and Veo along with GPT, Claude and Gemini.
Will Claude Code get banned if I use a gateway?
With API-key access you don’t sign in to an official subscription, so there is no official account of yours to ban. The risk is a gateway that runs on shared subscription accounts: when the upstream account is banned, the route goes down. Ask where the routes come from and test stability with a long task.
How is Codex through a gateway different from the official version?
With an API key, Codex works in the CLI, SDK and IDE extension, billed at API rates, and the models available depend on your key. Cloud features such as GitHub code review and Slack aren’t available. The provider must support the Responses API, and Codex Desktop still needs your own ChatGPT sign-in. Setup is in the Codex setup guide.
Should we self-host a gateway or buy a service?
If you already have upstream accounts obtained lawfully and someone to run servers and reconcile bills, a self-hosted gateway like New API or LiteLLM can manage internal usage in one place. If you don’t have upstream accounts or don’t want to run it yourself, a hosted service is simpler. To try one first, ask sales for a trial.
How is a gateway different from calling the official API directly?
The API format is almost the same; code usually only changes base_url and the key. What changes is who bills you, which upstream routes serve the request, and the data path: requests go to the gateway first, then upstream. That is why the data-handling statement in check 6 matters.
Can the gateway see my requests?
Requests pass through the gateway, so technically it can process their content. Whether it stores them, and for how long, depends on the provider’s logging policy. Get it in writing before you sign, and mask sensitive data first.
