OpenAI API alternative that keeps your SDK code

Keep the OpenAI SDK, change the base URL: what else differs, one key for GPT, Claude, Gemini and Grok, code in Python and TypeScript, and a migration checklist.

Checked 2026-11-22

·Home·Models

Point the OpenAI SDK at https://api.uplinkswitch.com/v1 with an UplinkSwitch key and your existing calls keep working, with GPT, Claude, Gemini and Grok on that same key. Each model in the chat catalog speaks the OpenAI Chat Completions format, so moving between families is a one-string change. GPT models are priced under OpenAI's list: gpt-6.1-sol costs $0.582 / $2.91 per million tokens here, against $2.00 / $10.00.

What changes besides the base URL

BeforeAfter
Base URLOpenAI'shttps://api.uplinkswitch.com/v1
KeyYour OpenAI keysk-uplink-live-… (or sk-uplink-test-… for a test environment)
Auth headerAuthorization: BearerAuthorization: Bearer or x-api-key; a key in the URL is refused
Model namesOpenAI's listCatalog ids. GET /v1/models with your key lists exactly what that key can call
Usage on streamsOnly if you set stream_options.include_usageAdded for you, so streamed calls are always metered
Cost per callUsage dashboardx-uplink-charge, x-uplink-list-cost and x-uplink-saved headers on non-streamed responses
Out of moneyAccount-level billing errors402 with a code: insufficient_balance (account) or monthly_limit_reached (that key)

Agent tools that send a Responses-API-shaped body to the Chat Completions path, as Cursor's Agent mode does for GPT models, are read correctly and answered in Chat Completions format, at the normal price.

One key, four model families (Python)

python
import os
from openai import OpenAI

client = OpenAI(base_url="https://api.uplinkswitch.com/v1",
                api_key=os.environ["UPLINKSWITCH_API_KEY"])

for model in ["gpt-6.1-sol", "claude-sonnet-5-5", "gemini-4-argon", "grok-4.7"]:
    r = client.chat.completions.create(
        model=model,
        messages=[{"role": "user", "content": "Explain a race condition to a junior developer in two sentences."}],
    )
    print(f"--- {model}\n{r.choices[0].message.content}\n")

Price a prompt on every candidate before you switch (TypeScript)

POST /v1/estimate prices a request on several models without sending it to any of them. It's public, or uses your own prices and price lock when you add a key:

ts
const res = await fetch("https://api.uplinkswitch.com/v1/estimate", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    messages: [{ role: "user", content: "Summarise this support ticket and suggest a reply: ..." }],
    output_tokens: 400,
    models: ["gpt-6.1-sol", "claude-sonnet-5-5", "gemini-4-argon", "grok-4.7"],
  }),
});
console.log(JSON.stringify(await res.json(), null, 2));

Input is estimated at about four characters per token unless you pass input_tokens, and the response says when it estimated.

Which OpenAI endpoints have an equivalent

You callOn this key
Chat CompletionsEvery chat model, any family
Responses API (/v1/responses)Its own route, streaming included
Responses-shaped bodies at Chat CompletionsAccepted for GPT models
Batch (/v1/files + /v1/batches)JSONL upload, every line run within 24 hours at the catalog price less a 50% batch discount
Moderations, speech, image edits/v1/moderations, /v1/audio/speech, /v1/images/edits
Embeddings (/v1/embeddings)8 embedding models in the catalog
Image generation (/v1/images/generations)Image models, with size and quality mapped per model
Audio transcription (/v1/audio/transcriptions)A Whisper model in the catalog
Model list (/v1/models)Yes, filtered to what your key may call, with your aliases
Realtime, Assistants (threads), fine-tuningNo equivalent route; the OpenAPI document at api.uplinkswitch.com/openapi.json lists every route there is. Keep those calls on OpenAI

Controls you get with the switch

  • Prepaid balance, no subscription, topped up from $10 with no fee.
  • A monthly spend limit per key, plus per-key request-rate and concurrency limits (429 with retry-after).
  • Paying only for valid JSON: a request that asks for JSON or a schema pays only for an answer that matches; a miss is retried once and isn't billed.

The prepaid LLM API page (/prepaid-llm-api) walks through balances, per-key caps and each 402 code in detail.

Migration checklist

  1. List every model string in code and config, and map each to a catalog id (GET /v1/catalog needs no key).
  2. Create one key per service and set each one's monthly limit before the first deploy.
  3. Swap the base URL and key through environment variables, so a rollback is a config change.
  4. Run your real requests (tools, JSON mode, streaming) on the exact models you'll use, and check the cost headers.
  5. Handle the two 402 codes separately in your error path, and back off on 429 using retry-after.
  6. Leave fine-tunes, Assistants threads and Realtime sessions on OpenAI; move batch jobs over, where they run at half the catalog price.

What GPT, Claude, Gemini and Grok cost on this key

Model idPrice per 1M (in / out)Developer list
gpt-6.1-sol$0.582 / $2.91$2.00 / $10.00
claude-sonnet-5-5$1.164 / $2.91$2.00 / $10.00
gemini-4-argon$0.582 / $2.91$2.00 / $10.00
grok-4.7$0.60 / $1.80$2.00 / $6.00

The full list, as JSON and CSV too, is on the pricing index (/pricing-index).

Decide which calls move together

Part of the integrationMigration decision
Supported chat callKeep the SDK interface, then validate its request and response
Model selectionMap the configured name to a current catalog entry
Tools, JSON and streamingTest each behavior on the chosen model
Realtime, Assistants or fine-tuningRetain a separate original-provider client for those workflows
Images or speechConsult media discovery independently of the chat shortlist

Compatibility describes a supported interface. It does not make every provider feature or model option interchangeable; the OpenAI-compatible API page lists what each route accepts.

Roll out one application path at a time

Preserve the old client configuration before introducing a second configuration with the UplinkSwitch base, https://api.uplinkswitch.com/v1. Move a small, representative path first. Compare the response fields, stream handling, tool outcomes and billing record that your application relies on, then increase traffic only after those checks pass.

Keep rollback as an explicit configuration choice. Avoid changing model selection and application behavior in the same experiment, because that makes a regression harder to attribute. Fund the second configuration from a prepaid balance with its own key cap, and read the LLM gateway page for what sits between that key and the model routes.

For route errors, distinguish a last-route server failure, HTTP 502 with upstream_error, from exhausted routing, HTTP 503 with upstream_unavailable. Respect the returned retry guidance instead of assuming both are a model-name error.

Questions and answers

For Chat Completions, the Responses API, batches, embeddings, images and audio, yes: same SDK, same request shapes, a new base URL and key. Realtime, Assistants and fine-tuning have no route here, so those calls stay with OpenAI.

Only to catalog ids. If you'd rather keep your own names, create an alias such as prod-chat pinned to a model; the request runs on the pinned model, and changing the pin needs no deploy.

They stay in your OpenAI account and keep running there. Route those calls to OpenAI and everything else here; the OpenAI SDK lets you keep two clients side by side.

Yes. POST /v1/estimate prices a prompt on any list of models without running it, and every non-streamed response reports its exact charge in headers.

It establishes only the path and behavior you exercised. Test the other operations your application needs before moving their traffic.

Keep it for workflows you are retaining there and for a controlled rollback. Separate configuration makes that boundary easier to inspect.
Join on Telegram
Help