cocodot
← Back to guides
Local card declined for overseas AI? cocodot: one card + one key
AI APIUpdated 2026-08

AI Gateway vs Direct API: Which Route Fits Your Workload?

Choose an AI API route by client compatibility, data requirements and operational ownership. Use a workload checklist before switching.

TL;DR: Choose an AI gateway when you can name a routing or operational requirement it will satisfy, and verify that requirement with your actual client. Keep direct access as a candidate when one provider already covers the workload and your team can manage its client configuration. Whether a gateway is worth adding depends on how much you value centralized controls. A gateway is an architectural choice, rather than a quality ranking between model vendors. Start with the application you need to run: a coding assistant, an evaluation harness or a customer-facing service. Write down its required API format, features, approved data destinations and support owner. Then test a representative task against each proposed route. The decision table below is a suggested evaluation order, not a claim that every gateway implements the same controls. Keep payment convenience separate from feature compatibility, and ask for current contractual terms rather than assuming either route includes a service commitment. If you keep both routes, document which workloads may use each one. Your deliverable should be a reproducible acceptance record that another developer can run, with no credentials or customer data embedded in it.

1. Define the requirement before choosing the route

Begin with a sentence that can be checked: “This application needs a centrally managed route that our administrators can change without editing each developer’s machine.” That is more useful than “we need the best API.” Weigh that against the maintenance and performance work a gateway adds; for current official guidance on the tradeoffs, read Microsoft's gateway architecture guide at https://learn.microsoft.com/en-us/azure/architecture/ai-ml/guide/generative-ai-gateway-multiple-models. Use that tradeoff to write your own selection criteria. For a personal script, ask whether another component solves a problem you actually have. For a shared service, list who can change destinations and who approves changes. Treat “direct relationship required” as a procurement condition to confirm with your organization, rather than a universal property of production software. Ask the contract owner to identify the applicable document and clause before excluding a route.

2. Turn the decision table into a workload record

Create a short record for each application rather than choosing one route for every experiment and service. Suggested fields are: workload name, responsible developer, client version, required API format, requested model identifier, required features, approved data category, proposed endpoint hostname and review date. Add a separate field for unresolved questions. A missing answer should become a question for the operator, not an assumption in your architecture. For example, an evaluation script might need plain text output while an assistant needs streaming and tool calls. Give those workloads separate records even if they initially use the same model. Write the acceptance conditions before trying a provider so that the test does not drift toward whichever output looks impressive. Keep private credentials outside the record; reference the approved secret location by name without copying its contents.

3. Match the client format and test the required features

Do not approve a route on the strength of a familiar configuration field alone. Claude Code’s official gateway guide says a gateway must expose a supported API format and warns that features can break when a gateway does not forward the capabilities Claude Code uses. It also notes that Anthropic does not audit third-party gateways. Read https://code.claude.com/docs/en/llm-gateway and follow the linked compatibility guide for the current requirements. For your own acceptance test, list the features your application actually exercises: ordinary text, streamed output, structured results, tool arguments or image input as applicable. Run a sanitized example for each required feature. Record the client version and endpoint configuration with the result. A passing text response should only satisfy your text-response test. Leave every untested feature marked untested rather than treating the provider name as evidence of compatibility.

No overseas card needed: cocodot's OpenAI-compatible API — switch your base_url to call the models on sale.

Top up via Alipay / WeChat Pay (RMB), USDT / USDC · billed per token · switch your base_url to connect

4. Give model comparisons a reproducible acceptance sheet

For model selection, use the same sanitized source material and the same grading rules on every candidate route. Define an accepted result in terms of your task: required fields extracted correctly, cited material present or a proposed code change passing your existing checks. Record what you requested separately from what the response reported. Preserve task IDs and redacted request references so an operator can investigate a disputed result, but do not treat a response label or the model’s self-description as independent proof of model identity. Here is a useful review format: “task ID | route label | client version | requested model | required feature | accepted result | observed charge | unresolved question.” This is a suggested local worksheet, not a platform feature. Include unsuccessful attempts in your notes. Compare complete task outcomes instead of selecting the nicest individual answer, and have a colleague rerun an example before making the route the team default.

5. Assign ownership for credentials, data and incidents

Ask who issues the application credential, who can revoke it and who receives an incident report. Anthropic’s gateway documentation describes keeping provider keys server-side while developers use gateway credentials, and attributes the operation of that gateway infrastructure to the organization running it. Do not assume that this design is implemented by every service using the word gateway. Ask each candidate operator to document its own credential boundary. Then ask your security reviewer which data categories may be sent through the proposed route and where to find the current data handling terms. Use synthetic content while that review is incomplete. Write a support handoff template containing the time with timezone, application version, endpoint hostname, task reference, redacted error and expected behavior. Exclude credentials and sensitive prompts. A named owner and a repeatable handoff are practical acceptance criteria you can verify without guessing the origin of a failure.

6. Review payment and spending separately from compatibility

If payment is the obstacle, confirm current options with the provider before changing your application architecture. A compatible response format does not answer your purchasing question, so keep a separate payment checklist: account owner, displayed currency, current terms, permitted payment method and person responsible for reviewing charges. Ask your card issuer and the merchant to confirm the reason for the decline. A missing entry in your bank app does not show where the request was stopped, and a decline at another merchant does not by itself identify the cause. Do not assume a budget alert stops charges. Whether the platform offers a spending cap that stops usage, and which services it covers, is set out in its official documentation. For an initial trial, select a bounded task set and review the resulting statement before expanding it. Keep the integration result and the payment result as separate entries in your acceptance record.

7. Specify what keeping both routes would mean

If you retain direct and gateway access, write a routing policy before enabling either as a fallback. Specify the allowed workloads, approved destinations, required model or capability, decision owner and conditions for pausing the experiment. Consider starting with a manual route selection in a non-production test rather than immediately automating it. For tasks that can trigger external actions, review what a repeated attempt would do before testing a retry policy. These are design questions to resolve in your application; this guide does not claim a particular provider prevents duplicate work. Keep the comparison inputs and acceptance criteria under version control in your own project, without committing secrets. Re-run the relevant checks after changing a client, model configuration or route. Decide explicitly whether a failed task should stop for review or be attempted elsewhere, and make that behavior visible to the person responsible for the result.

8. Evaluate cocodot against the same checklist

cocodot provides an OpenAI-compatible API relay. Evaluate it using the same workload record and feature tests you would apply to another candidate. Consult the current pricing page at https://cocodot.co/pricing and confirm that the model and integration path you need are offered before planning a migration. For a broader operator review, see /hub/how-to-choose-api-relay-vendor; for planning application exposure, see /hub/api-relay-runaway-risk. Keep the decision local to your requirements: payment convenience, an approved data path, the features your client needs and a support process your team can use. If a direct vendor relationship is a written requirement, ask procurement whether the proposed arrangement meets it. Finish with a brief decision record naming the chosen route, the evidence that passed, open questions and a review trigger. That gives the next developer a concrete basis for revisiting the choice when the workload changes.

Suggested evaluation order by workload; validate each candidate separately

Your workloadStart by evaluatingEvidence to collect
One application using one providerDirect access, then a gateway if a requirement remains unmetRequired features, configuration ownership and a passing task
Several clients needing centrally managed routingA gateway alongside the existing routeExplicit route rules and a named operator
Comparing models for a product decisionA controlled evaluation harnessIdentical inputs, acceptance criteria and recorded configuration
A coding assistant with a custom endpointThe client’s official gateway documentationSupported format and tested tools and streaming
A service with contractual requirementsThe route approved by procurement and securityCurrent signed terms and data handling review
Payment prevents a proposed route from being usedSeparate payment review from integration testingSupported payment options and a successful bounded trial

FAQ

What is the difference between an AI gateway and a direct API?

For this decision, compare the actual request path and who operates it. A gateway is an extra routing layer between your application and the model back ends. Direct access and gateway access should each be checked against your application requirements. Do not infer identical features or contractual terms from the route label.

When should I use an LLM gateway?

Start an evaluation when you have a specific requirement such as centrally managed routing across clients. Write an acceptance test for that requirement and name its operational owner. Keep direct access in the comparison if it already meets your needs.

Can I set a custom base URL in Claude Code?

Use Claude Code’s official gateway documentation and its linked connection and compatibility guides for current setup requirements: https://code.claude.com/docs/en/llm-gateway. Verify your proposed endpoint format and required features before rollout. Keep credentials in your approved secret tooling, and avoid pasting them into tickets or shared test records.

Can I use a direct API and a gateway together?

You can design a test with separate route configurations, but approve each route independently. Write down which tasks may use each configuration, what data may be sent and who authorizes changes. Before adding automated fallback, review repeated attempts and external side effects in your application. Record actual test results rather than assuming interchangeable behavior.

Does a gateway automatically solve a declined payment?

Treat payment as a separate check. Ask your card issuer and the merchant to confirm the reason for the decline. A missing entry in your bank app does not show where the request was stopped, and a decline at another merchant does not by itself identify the cause. Confirm the candidate service’s current payment options before a bounded trial.

About cocodot

cocodot is a payment and AI access service for developers and cross-border teams in mainland China. It provides US-BIN virtual cards issued by a licensed institution — used to pay for overseas subscriptions and ad accounts — and an OpenAI-compatible AI API gateway for calling Claude, GPT and Gemini from within mainland China. Both share one wallet, funded by Alipay / WeChat Pay (RMB), USDT / USDC and accounted in USD. Card: $9.9 to open, 3% to load, $1 per active card per month; spending: $0.60 settlement fee on purchases under $20; a corresponding fee applies when the issuer charges one.

Service scope, pricing and limits →
OpenAI-compatible API, pay in RMBGet API access