OpenAI to BroadNet migration helper
Updated
In short: Moving OpenAI SDK code to BroadNet Inference takes three edits: base URL https://inference.broadnet.ai/v1, a BroadNet key read from an environment variable, and a BroadNet model ID. Then check what differs: tools and structured output are documented only for GLM 5.3 and Qwen3.8 27B, and there are no embeddings or Responses API. Paste code for the edits and the checks.
A pattern-based helper, not a compiler: it edits common SDK patterns and flags the rest. Review the diff, run your tests and send one real request before you switch traffic. Capabilities are those in BroadNet's API reference, checked 2026-11-15.
Report a wrong price or number (email to info@broadnet.ai, with this page's link and your inputs filled in).
How it works
- Paste Python, Node.js or cURL code that calls the OpenAI API. The language is detected; you can also pick it.
- Choose the BroadNet chat model and, for transcription code, the speech-to-text model. Set the environment variable name for the key.
- Read the diff: base URL, key from the environment, model IDs, and language=ar when you transcribe Arabic.
- Work through the findings: anything not supported on BroadNet, then the checks (streaming, tools, structured output, max_tokens, limits). Copy the converted code and test one real request.
What changes when you move from OpenAI to BroadNet?
Three settings, then a check of the features your code uses:
- Endpoint:
https://inference.broadnet.ai/v1. - Key: a BroadNet inference key, read from an environment variable and sent as
Authorization: Bearer. - Model ID: one of
broadnet/deepseek-v4.1-flash,broadnet/glm-5.3,broadnet/qwen3.8-27b,broadnet/gemma-4-26b-a4b,broadnet/cohere-transcribe-arabic,broadnet/cohere-transcribe.
from openai import OpenAI
import os
client = OpenAI(
base_url="https://inference.broadnet.ai/v1",
api_key=os.environ["BROADNET_API_KEY"],
)Checklist after the edit
| Feature | On BroadNet (per its API reference) | What to check |
|---|---|---|
| Streaming | Documented for chat completions | Read until data: [DONE]; treat an early end as incomplete; verify per model |
| Tool calling | GLM 5.3 and Qwen3.8 27B | Tool schemas, tool_choice, parallel calls |
| Structured output | GLM 5.3 and Qwen3.8 27B | Validate returned JSON against your schema |
| Reasoning | DeepSeek V4.1 Flash, GLM 5.3, Qwen3.8 27B | max_tokens of 1,000 or more, or reasoning_effort low |
| Image input | DeepSeek V4.1 Flash, Qwen3.8 27B, BroadNet Gemma 4 VL 26B | Data URL in the content list; billed as input tokens on pay-as-you-go |
| Transcription | WAV or MP3, up to 26,214,400 bytes | Always send language; convert .ogg and .m4a first |
| Limits | 30 requests a minute, 4 in flight per pay-as-you-go key | Client concurrency, backoff on 429 |
| Responses API, embeddings, images, TTS, batch | Not in the API reference | Keep another provider for these, or rewrite |
The full reasoning behind each item is in the migration checklist. For errors and retries see error codes and when to retry.
Questions
Is BroadNet Inference a drop-in replacement for the OpenAI API?
It uses the same chat completions and audio transcriptions request shapes, so the OpenAI SDKs work with a different base URL, key and model ID. It is not identical: BroadNet's docs list no batch, files or embeddings endpoint, document tools and structured output only on GLM 5.3 and Qwen3.8 27B, and set their own limits. Expect to check a few parameters, not to change nothing.
What base URL do I use?
https://inference.broadnet.ai/v1. In Python pass base_url to OpenAI(); in Node pass baseURL to new OpenAI(); with cURL replace https://api.openai.com/v1.
Which OpenAI endpoints are not available?
BroadNet's API reference documents POST /v1/chat/completions and POST /v1/audio/transcriptions. The Responses API, embeddings, image generation, text to speech, assistants, batches, files, fine-tuning and realtime are not in it, and the tool flags each one. Keep a separate client for anything you still need from another provider.
Does tool calling work after migrating?
BroadNet documents tool calling and structured output for GLM 5.3 and Qwen3.8 27B. On other models, remove tools or switch model. Test your schemas: support for every JSON Schema keyword can differ between providers.
Why is my reply empty after switching models?
DeepSeek V4.1 Flash, GLM 5.3 and Qwen3.8 27B reason before answering, and the reasoning counts toward max_tokens. A small limit that worked on a non-reasoning model can leave no room for the answer. Allow 1,000 tokens or more, or set reasoning_effort to low. max_tokens calculator.
Is my code sent anywhere?
No. The conversion runs in your browser with string rules; nothing is uploaded, logged or stored. Do not paste real keys anyway: the tool replaces hard-coded keys with an environment variable, and a key that has been in source code should be revoked.