What "LaoZhang on INFRO" means
INFRO is a control plane that sits between your application and providers you already pay. LaoZhang API is one of the account types you can connect. INFRO's connect page puts the arrangement plainly: you keep your LaoZhang API contract and your key, and INFRO adds routing, budgets, failover and an audit trail around each request.1
Three facts about money and custody matter before anything else:
- The key stays yours. You create it in your LaoZhang account, paste it into INFRO, and it is sealed when saved and never shown again.1 Your applications carry an INFRO gateway key instead, so the provider key is not in your app's environment.
- LaoZhang bills you directly. The bill for model usage stays with LaoZhang, under your own agreement and at your own rates. INFRO bills a separate software subscription with 0% markup on model spend.1
- INFRO's cost figures are estimates. The request log is operational evidence, not an invoice.2 Reconcile against what LaoZhang bills you.
This guide is neutral about LaoZhang. It makes no price comparison and no claim about the service beyond what INFRO's own pages state. The work here is the part you control: how the key is held, what happens when a call fails, how much a key can spend, and where you look afterwards.
Connect the key
INFRO's connect page lists three steps.1
- Create an INFRO workspace. It starts as a 14-day trial.
- Connect your LaoZhang API key. Setup opens on LaoZhang API. You paste a key you created in your LaoZhang account.
- Point your app at INFRO. Swap in your INFRO gateway key and base URL, and name the model the way INFRO does, for example
openai/gpt-6-astra.
The provider docs add the mechanics. You open Providers in the console and choose the provider kind, which decides the wire protocol, which models it can serve and what configuration it needs beyond a key. You paste the key, test it, then name and save it. The test calls the provider with the key and the connection's real base URL and auth, and shows what came back before anything is saved, so a typo is caught there and not by your first production request.3
Until something is connected, INFRO returns 503 with code: "no_provider_connected", naming the provider to connect. The docs call that the expected first response, not a fault.3
The application change is the one the connect page shows, using the OpenAI SDK:
import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ["INFRO_API_KEY"], # an INFRO gateway key, not the LaoZhang key
base_url="https://api.infro.io/v1",
)
resp = client.chat.completions.create(
model="openai/gpt-6-astra", # the id as INFRO names it
messages=[{"role": "user", "content": "Hello"}],
)Model ids come from INFRO's catalog, not from whatever string you sent LaoZhang before. Each catalog model page gives the id to send, the vendor's list rate and the other providers that serve it.1 That last item is what makes the next section possible.
Add the vendor's own API as a second connection
A single connection means a single point of failure: the docs say that with one connection there is nothing to fail over to.4 The fix is a second connection, on a different account, that serves the same model.
For a model such as openai/gpt-6-astra, that second connection can be your own OpenAI account, if you hold one. You connect it exactly as above. INFRO's connection failover is same-model: when you name a model directly, it tries every enabled, healthy connection in your organization that serves that model's vendor and matches the key's environment, in the order you connected the providers.4
If you want the order to be a decision and not an accident of connection history, use a route. A route is a stable name your application sends as model, resolved to an ordered list of your own connections and the model each should serve.5 The strategies:
| Strategy | Behaviour | Use it for |
|---|---|---|
| priority | Walks enabled targets in order, uses the first that answers | A primary with a fallback |
| weighted | Picks the first target at random in proportion to weight, then falls through the rest | A canary or a gradual migration |
A target with weight 0 on a weighted route is a standby that never takes a first attempt, and a weighted route still fails over if its pick fails.5 Your application then calls the route name:
curl https://api.infro.io/v1/chat/completions \
-H "Authorization: Bearer $INFRO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "support-agent",
"messages": [{"role": "user", "content": "Where is my order?"}]
}'support-agent is the docs' own example name.5 Put LaoZhang first and the vendor's API second, or the reverse; INFRO does not decide that for you.
What triggers a move, and what does not
Every upstream failure before the first token moves to the next connection: a provider 5xx, a timeout, a 429, a rejected credential (401 or 403), a 404, and even a 400 or 422, because providers differ on which optional parameters they accept. Your client sees only a slightly higher time to first token.4 Everything is strictly before the first token; once a response has started, the docs' guarantee does not extend to switching providers mid-stream.4
INFRO's own refusals do not fail over. An invalid body, a bad INFRO key (401), a budget or subscription refusal (402), an allowlist refusal (403) and an unknown model (404) are decided before any provider is called and return immediately.4 That matters for budgets, covered next: a budget stop is not retried onto the second connection.
If the whole model is down on every connection, INFRO also supports ordered cross-model fallbacks: a fallbacks array of up to five catalog model ids, tried once every connection for the primary has failed. They apply only when model names a model, not a route.4 Cross-model fallbacks change the answer's source, so test them before relying on them; see is your fallback model good enough.
Budgets and per-key limits on that traffic
INFRO budgets control estimated spend on your own provider accounts. They are not a balance you load, and your providers still bill you directly.6 The scopes:
- Organization: a monthly target that only alerts, and a hard cap that alerts or blocks. Only the owner sets the hard cap.
- Project: a separate budget for an application or environment.
- Member: a budget tied to a member's activity.
- Key: a limit that resets daily, weekly or monthly, or a lifetime ceiling. Key limits always block.6
Every applicable blocking limit must allow the request.6 For LaoZhang traffic, a practical layout:
- Give each application or environment its own gateway key, so a runaway job cannot spend another service's headroom.
- Put a daily limit on each key, sized to a bad day rather than a normal one.
- Set a project budget in alert mode first, with thresholds at fractions you choose, and switch it to block once you trust the numbers.
- Leave the organization hard cap to the owner as the backstop.
Two mechanics are worth knowing. First, a blocking budget admits a request only if its worst-case estimated cost fits the room left, counting recorded spend and reservations for requests in flight. Close to a limit, a request can be refused briefly for room that is reserved but not yet spent.6 Second, the worst case assumes the most expensive model and provider the request could fall back to.6 So adding a second connection or a fallbacks list can raise the reservation a request needs, even if it never fails over. That is a reason to size limits with headroom.
A refused request returns 402 before the provider sees it.7 Handle that code in your application as a budget stop, not a transient error. For more on layering these controls, see LLM spend controls.
Where each request's provider, cost and attempts show
The request log records the model, the selected provider connection, the outcome, timings, usage and estimated provider cost.2 The response itself also names the model, provider and connection that served the request, plus the estimated cost.4 When you call a route, the trace additionally names the route and the connection that served it.5 The request traces documentation describes the log as covering fallback attempts too.2
To read them from code:
curl "https://api.infro.io/v1/requests?limit=25&status=error" \
-H "Authorization: Bearer $INFRO_API_KEY"limit runs from 1 to 100, and sort can be newest, slowest or costliest. Unpriced requests come last under costliest, never shown as $0.2 Use GET /v1/requests/{id} for one request's detail.
Access is per key. A gateway key that can call models cannot automatically read every application's history. Its history access is scoped by default (its own project), organization (granted only by an owner or admin) or none. Prompt and response bodies need separate payload access, and content is never returned after its retention deadline.2
A short checklist to confirm the setup works before real load:
- A request through INFRO appears in the log naming your LaoZhang connection.
- Turning that connection off (or testing with a bad key on a copy) sends the same request to the second connection, and the log shows both attempts.
- A key with a deliberately tiny limit is refused with 402, and no provider call appears for the refused request.
- The estimated cost on a known request matches your own arithmetic from the rates you entered.
- The history key your dashboards use has the narrowest access that works.
What INFRO does not change
INFRO is an independent service and says that using it does not change your agreement with LaoZhang API.1 It does not sell inference or hold the provider account for you; the account, the contract and the invoice stay with you and LaoZhang. If LaoZhang itself has an outage or changes terms, INFRO's role is to route around it using the second connection you configured. Whether that is enough depends on how closely the two providers serve the same model, which you should test rather than assume.
