BroadRouter

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.

Free, no sign-up, runs in your browser: nothing you type is sent anywhere.

Code and target

Diff
Converted code

Accounts and keys are managed on inference.broadnet.ai. BroadRouter is BroadNet's own site.

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

  1. Paste Python, Node.js or cURL code that calls the OpenAI API. The language is detected; you can also pick it.
  2. Choose the BroadNet chat model and, for transcription code, the speech-to-text model. Set the environment variable name for the key.
  3. Read the diff: base URL, key from the environment, model IDs, and language=ar when you transcribe Arabic.
  4. 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:

  1. Endpoint: https://inference.broadnet.ai/v1.
  2. Key: a BroadNet inference key, read from an environment variable and sent as Authorization: Bearer.
  3. 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

FeatureOn BroadNet (per its API reference)What to check
StreamingDocumented for chat completionsRead until data: [DONE]; treat an early end as incomplete; verify per model
Tool callingGLM 5.3 and Qwen3.8 27BTool schemas, tool_choice, parallel calls
Structured outputGLM 5.3 and Qwen3.8 27BValidate returned JSON against your schema
ReasoningDeepSeek V4.1 Flash, GLM 5.3, Qwen3.8 27Bmax_tokens of 1,000 or more, or reasoning_effort low
Image inputDeepSeek V4.1 Flash, Qwen3.8 27B, BroadNet Gemma 4 VL 26BData URL in the content list; billed as input tokens on pay-as-you-go
TranscriptionWAV or MP3, up to 26,214,400 bytesAlways send language; convert .ogg and .m4a first
Limits30 requests a minute, 4 in flight per pay-as-you-go keyClient concurrency, backoff on 429
Responses API, embeddings, images, TTS, batchNot in the API referenceKeep 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.

Go deeper

Read as MarkdownAsk ChatGPTAsk ClaudeAsk Perplexity