FAQ: running an OpenAI-compatible gateway with 51 upstream API sellers

Published 2026-11-21 · LONG AI

Most questions we get are not about models. They are about what happens when a request fails halfway, when an upstream changes its schema overnight, or when the price list disagrees with the bill. These answers come from running that gateway with live traffic.

Is an OpenAI-compatible endpoint really a drop-in?

The surface is: base_url, api_key, and the same request body. The differences hide in details — how tool_calls fragments arrive, whether usage exists on stream chunks, how errors are typed. A compatible endpoint that returns OpenAI-shaped errors and OpenAI-shaped streams is drop-in; one that only returns HTTP 200 is not. Keep a small regression script and run it against any new base URL before switching production traffic.

What should the client do when an upstream fails?

Nothing, ideally. Failover belongs on the gateway: detect the failure, drop the channel out of the primary lane, retry on the next seller, and return one coherent response. If the client has to implement retries per provider, the abstraction is not doing its job. The client-side rule we recommend is simple — one retry with backoff, then surface the error as it came.

Why do balances drop without an answer?

Because hold and settlement were ordered wrong. Hold an upper-bound estimate on arrival, settle against the real usage the upstream returns, and refund fully on failure — including the awkward case where the upstream charged but produced no content. If those three steps are not separate, users will notice the gap before you do.

How do you price 103 models without a spreadsheet per model?

You keep the ratio list as data, not as code: per-model input and output ratios, updated from the upstream price sheet, with the settlement engine reading the same table. The list is public and refreshed continuously — ai.dijinlong.com shows 103 models live with the current discount per model.

Do more upstreams mean more uptime?

Only if you can rank them. Adding a channel without capability flags and a stability score just adds noise: the cheap channel will dominate the primary lane and the timeout rate goes up. We rank stability above price, which is why a channel discounted below 20% of list price rarely becomes the default.

Verify it yourself

Point the OpenAI SDK at LONG AI, send one request, and compare latency and price against your current provider. 51 upstreams, 103 models, automatic failover, and a public status board on the same domain.

More notes

103 models, 51 upstream sellers, one endpoint — routing, billing order and protocol checks in detail.

Six checks before you switch to another API reseller — a short list you can run in an afternoon.

Exposing 103 models as an MCP server — why the catalogue is data rather than a hundred tool names.