Migrating from OpenAI
Switch the OpenAI SDK to this platform — two lines of code, and 90+ models become available
Already using the OpenAI SDK? Switching takes two lines, and then you can call 90+ models — not just GPT.
No
sk-gpushare-*key yet? Create one at dianqi.zsopc.com/dashboard/keys. Sign-up includes $0.30 of trial credit, enough for every example here.
What changes (Python)#
from openai import OpenAI
# straight to OpenAI, before
client = OpenAI(
- api_key="sk-...",
+ api_key="sk-gpushare-xxx",
+ base_url="https://dianqi.zsopc.com/v1",
)
That's both changes. Everything after client.chat.completions.create(...) stays exactly as it is.
What changes (TypeScript)#
import OpenAI from "openai";
const client = new OpenAI({
- apiKey: process.env.OPENAI_API_KEY,
+ apiKey: process.env.PLATFORM_API_KEY,
+ baseURL: "https://dianqi.zsopc.com/v1",
});
What changes (curl)#
- curl https://api.openai.com/v1/chat/completions \
+ curl https://dianqi.zsopc.com/v1/chat/completions \
- -H "Authorization: Bearer sk-..." \
+ -H "Authorization: Bearer sk-gpushare-xxx" \
-H "Content-Type: application/json" \
-d '{"model":"gpt-5.4","messages":[{"role":"user","content":"Hello"}]}'
What you gain#
Once the base URL is switched, your code can call more than GPT:
# same client, same code, different model
client.chat.completions.create(model="gpt-5.4", ...) # still works
client.chat.completions.create(model="claude-sonnet-4-6", ...) # new!
client.chat.completions.create(model="gemini-2.5-pro", ...) # new!
client.chat.completions.create(model="glm-5.1", ...) # new!
client.chat.completions.create(model="grok-4-fast-reasoning", ...) # new!
Full model IDs: Models.
Transparent pricing#
Pricing is public (see the model plaza), and the GPT line costs the same as going direct (as of June 2026):
| Model | Direct from OpenAI ($/1M in/out) | Here ($/1M in/out) |
|---|---|---|
gpt-5.4 | $2.50 / $15.00 | $2.50 / $15.00 |
gpt-5.5 | $5.00 / $30.00 | $5.00 / $30.00 |
Every call is itemised at dianqi.zsopc.com/dashboard/usage, matching what you'd see from the vendor; keys are managed at dianqi.zsopc.com/dashboard/keys.
Billing is a prepaid account wallet: all keys share one balance, and when it runs out every key stops working at once (HTTP 402). Top up at dflop.top/dashboard/billing (Stripe, $1 minimum, same account and shared balance as dianqi.zsopc.com).
Read this after switching#
1. Tool behaviour differs slightly#
functiontools are fully compatible and behave exactly as they do against OpenAI- The
web_searchtool works withgpt-5.4/gpt-5.5and some Claude and Gemini models (full list in the compatibility matrix and the capability columns of Models), and requiresstream=true - The
image_generationtool is the same —stream=truerequired - Careful when mixing: as soon as
web_searchorimage_generationappears intools, the request takes a different translation path, and in multi-turn history thetool_callsfield on assistant messages is not replayed (the gateway keeps only the assistant text;tool_call_idontool-role messages still passes through). Purefunctiontools are unaffected — if you rely heavily on multi-turn function calls, avoid mixing in the built-in tools - Details: Tool calling
2. Streaming is identical to OpenAI#
stream=true and the same SSE protocol. Your client parsing code doesn't change. See Streaming.
3. Error format is identical#
Errors from /v1/chat/completions keep the OpenAI shape:
{"error": {"message": "...", "type": "...", "code": "..."}}
4. Which OpenAI endpoints are supported#
| Endpoint | Status |
|---|---|
POST /v1/chat/completions | ✅ fully supported |
POST /v1/completions (legacy) | ❌ not supported |
POST /v1/embeddings | ❌ the platform retired its embedding SKUs in July 2026, so there's no available model (calls return 404 model_not_found) |
POST /v1/audio/transcriptions (Whisper) | ❌ not supported |
POST /v1/audio/speech (TTS) | ✅ supported with the voice-tts-pro model (billed per character, and it returns a durable URL rather than a stream of audio bytes — a different response shape from OpenAI's). Voice cloning is also available via POST /v1/audio/voices. See Image / video / music APIs |
POST /v1/images/generations | ✅ supported, limited to doubao-seedream-* / grok-imagine-* (billed per image, URLs expire after 24h). DALL·E and gpt-image-* ids aren't available — for GPT-style image generation use chat.completions with tools=[{"type":"image_generation"}]. See Image / video / music APIs |
POST /v1/responses | ✅ GPT-5.x, Claude and most third-party models — with built-in web_search / image_generation. There's no previous_response_id (the gateway holds no server-side session state), so resend the full input for multi-turn; the gateway strips reasoning items from the history for you |
GET /v1/models | ✅ returns the platform catalog (note: this endpoint only accepts Authorization: Bearer or x-api-key header auth, not ?key=) |
If your app depends on TTS transcription, that part still needs the original vendor.
The platform also offers endpoints OpenAI doesn't: async video generation (billed per second — see Image / video / music APIs) and knowledge-base search over REST and MCP (see Knowledge base API & MCP).
Full before/after#
Straight to OpenAI#
import os
from openai import OpenAI
client = OpenAI(api_key=os.environ["OPENAI_API_KEY"])
resp = client.chat.completions.create(
model="gpt-5.4",
messages=[{"role": "user", "content": "Write a haiku"}],
)
print(resp.choices[0].message.content)
Through this platform#
import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ["PLATFORM_API_KEY"],
base_url="https://dianqi.zsopc.com/v1",
)
# still GPT
resp = client.chat.completions.create(
model="gpt-5.4",
messages=[{"role": "user", "content": "Write a haiku"}],
)
# and now Claude too
resp_claude = client.chat.completions.create(
model="claude-sonnet-4-6",
messages=[{"role": "user", "content": "Write a haiku"}],
)
FAQ#
Should I delete my OPENAI_API_KEY env var?#
No need — keep both around:
export OPENAI_API_KEY=sk-... # straight to OpenAI
export PLATFORM_API_KEY=sk-gpushare-...
And pick explicitly in code:
# fall back to the vendor when it matters
client = OpenAI(
api_key=os.environ.get("PLATFORM_API_KEY") or os.environ["OPENAI_API_KEY"],
base_url=os.environ.get("OPENAI_BASE_URL", "https://api.openai.com/v1"),
)
Are the rate limits the same as OpenAI's?#
No. There's no enforced QPS ceiling here (occasional 429s are upstream rate limits passed through), and billing is a prepaid account wallet: all keys share one balance, and when it's exhausted every key returns HTTP 402 (type insufficient_quota, code quota_exceeded). A new key brings no new credit — topping up does (dflop.top/dashboard/billing). See Authentication and Error codes.
Do I need to change my retry logic?#
No. The OpenAI SDK's built-in exponential backoff works here too, and status-code semantics are consistent across services (Error codes).
Do function-tool tool_call_ids change between calls?#
On the pure function tool path the gateway passes upstream IDs through without rewriting, so your multi-turn tool-result code needs no changes. But if the same request mixes in the web_search or image_generation built-ins, assistant tool_calls in history aren't replayed — see Tool behaviour differs slightly above.
Next steps#
- Which model gives the best value? See Models § picking by job
- Anthropic SDK or OpenAI SDK for Claude? Personal preference — both work, use the one you know
- Client integrations: Cursor / Cline / Continue