---
title: "Switch to an OpenAI-compatible API - migration checklist"
description: "Changing base_url is the easy part. Model IDs, reasoning tokens, streaming usage, errors, rate limits and keys are what break. A checklist with code."
url: https://broadrouter.com/blog/openai-compatible-api-migration-checklist/
lang: en
updated: 2026-11-14
publisher: BroadRouter (a BroadNet site); API by BroadNet Inference, https://inference.broadnet.ai
---

# Switching to an OpenAI-compatible API: a migration checklist

By the BroadNet Inference team · 5 min read · Published 2026-11-14 · Updated 2026-11-16

To move to an OpenAI-compatible API, change three settings (base\_url, api\_key and model) and then check what differs: model IDs, how reasoning tokens count toward max\_tokens, how streaming reports usage, which errors to retry, rate limits and key security. For BroadNet Inference the base URL is https://inference.broadnet.ai/v1.

## Key takeaways

-   Three settings change: `base_url`, `api_key` and `model`.
-   Inventory every endpoint and field your app uses before you switch, then test each one.
-   Reasoning models count thinking toward `max_tokens`; small limits return empty answers.
-   Ask for usage in streams with `stream_options`, or your cost tracking goes blind.
-   Map error codes to retry or fix before you switch production traffic.
-   Run old and new providers side by side on real traffic for a day before cutting over.

**On this page**

1.  0\. What does your app use today?
2.  1\. Which three settings change?
3.  2\. What are the new model IDs?
4.  3\. Why do answers come back empty after switching?
5.  4\. Does streaming still report usage?
6.  5\. Which errors should you retry?
7.  6\. What are the new rate limits?
8.  7\. Will your prompts still fit?
9.  8\. What about keys and data retention?
10.  9\. How do you cut over safely?
11.  What are the common migration mistakes?
12.  Where BroadNet Inference fits

Most LLM providers now speak the [OpenAI API format](https://broadrouter.com/glossary/openai-compatible-api/). That makes switching look like a one-line change, and to get a first answer, it is. To run production traffic, work through this list. Every item comes from a real way that migrations break.

## 0\. What does your app use today?

Before you change anything, write down what your app depends on. Search the code for every call to the SDK and list it. If you call OpenAI’s Whisper API, note that OpenAI lists `whisper-1` as shutting down on February 26, 2027; [Whisper API alternatives](https://broadrouter.com/blog/whisper-api-alternative/) covers the audio side.

| Feature | Where to look | Test after switching |
| --- | --- | --- |
| Chat completions | Every `chat.completions.create` | Same prompts, compare answers |
| Streaming | `stream=True` | Chunks arrive, ends with `[DONE]`, usage present |
| Tool calling | `tools=` | Tool calls parse and run |
| Structured output | `response_format=` | JSON validates against your schema |
| Images | Image parts in messages | Model accepts them |
| Audio transcription | `audio.transcriptions` | Text and language correct |
| Embeddings, files, batches | Other endpoints | Check the provider offers them at all |

The last row matters. “OpenAI-compatible” usually covers chat completions first. BroadNet Inference’s catalogue lists chat models on `/v1/chat/completions` and speech-to-text models on `/v1/audio/transcriptions`; if you use other endpoints, keep them on your current provider or find a replacement.

## 1\. Which three settings change?

```python
from openai import OpenAI
import os

client = OpenAI(
    base_url="https://inference.broadnet.ai/v1",
    api_key=os.environ["BROADNET_API_KEY"],
)
```

The name of the [base URL](https://broadrouter.com/glossary/base-url/) setting differs by library: `base_url` in the Python SDK and LangChain’s ChatOpenAI, `baseURL` in the Node.js SDK. The Python SDK also reads the `OPENAI_BASE_URL` environment variable, according to its [README](https://github.com/openai/openai-python). Check for a stale value in your environment, or requests can go to the old provider without an error.

Keep [API keys](https://broadrouter.com/glossary/api-key/) in environment variables or a secret manager, never in code. Setup for each SDK: [Python](https://broadrouter.com/guides/openai-python-sdk/), [Node.js](https://broadrouter.com/guides/openai-node-sdk/), [LangChain](https://broadrouter.com/guides/langchain-openai-base-url/). To build and test a first request by hand, use the [API request builder](https://broadrouter.com/tools/api-request-builder/). To apply the base URL, key and model edits to existing code, paste it into the [OpenAI to BroadNet migration helper](https://broadrouter.com/tools/openai-to-broadnet-migration/), which also lists what to check.

## 2\. What are the new model IDs?

Every provider names models its own way. On BroadNet Inference:

| Model | ID |
| --- | --- |
| DeepSeek V4.1 Flash | `broadnet/deepseek-v4.1-flash` |
| GLM 5.3 | `broadnet/glm-5.3` |
| Qwen3.8 27B | `broadnet/qwen3.8-27b` |
| Gemma 4 VL 26B | `broadnet/gemma-4-26b-a4b` |

Put the model ID in configuration, not code, so switching later is a deploy, not a rewrite. Each model’s limits and prices are on its page: [DeepSeek V4.1 Flash](https://broadrouter.com/models/deepseek-v4.1-flash/), [GLM 5.3](https://broadrouter.com/models/glm-5.3/), [Qwen3.8 27B](https://broadrouter.com/models/qwen3.8-27b/) and [Gemma 4 VL 26B](https://broadrouter.com/models/gemma-4-vl-26b/).

## 3\. Why do answers come back empty after switching?

This is the most common surprise. DeepSeek V4.1 Flash, GLM 5.3 and Qwen3.8 27B reason before they answer, and **the [reasoning tokens](https://broadrouter.com/glossary/reasoning-tokens/) count toward [`max_tokens`](https://broadrouter.com/glossary/max-tokens/)**. A limit of 256 that worked on a non-reasoning model can be spent entirely on thinking, so the answer comes back empty. Leave 1,000 tokens or more, or set `reasoning_effort` to `low` for simple tasks. [Full explanation](https://broadrouter.com/guides/reasoning-tokens-empty-response/).

## 4\. Does streaming still report usage?

[Streams](https://broadrouter.com/glossary/streaming/) use Server-Sent Events and end with `data: [DONE]`. Token usage arrives in the last chunk only if you ask:

```python
stream = client.chat.completions.create(
    model="broadnet/deepseek-v4.1-flash", messages=messages,
    stream=True, stream_options={"include_usage": True},
)
```

Without it, your cost dashboard reads zero. If a stream ends before `[DONE]`, treat it as incomplete. [Streaming guide](https://broadrouter.com/guides/streaming-chat-completions/).

## 5\. Which errors should you retry?

| Status | Meaning | Action |
| --- | --- | --- |
| 401 | Bad or revoked key, or exhausted pay-as-you-go allowance | Fix, don’t retry |
| 402 | Balance or budget | Top up, don’t retry |
| 403 | Refused by model, route or IP policy | Fix the mismatch |
| 413 | Request too large | Shrink, don’t retry |
| 429 | Rate, concurrency or spend limit | Back off and retry |
| 5xx | Server side | Retry with bounded backoff |

The official Python SDK already retries some errors: its README says connection errors, 408, 409, 429 and 5xx responses are retried twice by default with a short exponential backoff. Set `max_retries` explicitly so the behaviour is a decision, not a default. Log the request ID from every response so support can trace a problem. [All codes](https://broadrouter.com/guides/errors-and-retries/).

## 6\. What are the new rate limits?

Know the new limits before traffic arrives. A BroadNet pay-as-you-go key allows 30 requests a minute and 4 in flight. Unlimited plans run one request at a time per session. Size your worker pool to match, or you will see 429s on day one; the [rate limit calculator](https://broadrouter.com/tools/llm-rate-limit-calculator/) does the sizing. [Sizing for parallel agents](https://broadrouter.com/blog/run-parallel-coding-agents-flat-rate/).

## 7\. Will your prompts still fit?

Check context windows: 1,048,576 tokens on DeepSeek V4.1 Flash and GLM 5.3, 262,144 on Qwen3.8 27B, 32,768 on Gemma 4 VL 26B. A prompt that fit your old model may not fit a smaller window; check with the [context window calculator](https://broadrouter.com/tools/context-window-calculator/). Keep stable prompt content first to benefit from [cached input pricing](https://broadrouter.com/blog/cached-input-tokens-explained/).

## 8\. What about keys and data retention?

Lock production keys to your servers’ IPs with an [IP allow-list](https://broadrouter.com/guides/api-keys-ip-allow-lists/). Ask the new provider what it retains; see the [ZDR checklist](https://broadrouter.com/blog/zero-data-retention-llm-api-checklist/).

## 9\. How do you cut over safely?

1.  Send a copy of a day’s real requests to both providers.
2.  Compare answers on a sample, plus latency, errors and cost per request.
3.  Move 10% of traffic, watch for a day, then move the rest.
4.  Keep the old provider configured as a fallback for a week.

If you run many services, a proxy such as [LiteLLM](https://broadrouter.com/guides/litellm-proxy-custom-provider/) lets you switch providers in one place rather than in every app.

## What are the common migration mistakes?

-   **Missing `/v1` in the base URL.** Requests return 404. Use the full URL.
-   **Old model names in config.** The new provider doesn’t know them.
-   **Provider-specific fields left in requests.** Fields that only the old provider understood may be rejected or ignored. Remove them from generic clients.
-   **Testing only one prompt.** Run the inventory from step 0, feature by feature.
-   **Cutting over on a Friday.** Leave time to watch a full day of real traffic.

## Where BroadNet Inference fits

BroadNet Inference is a drop-in target for apps that use chat completions and audio transcription through the OpenAI SDKs: change three settings and work through the list above. Its catalogue lists chat and speech-to-text models only, so if you depend on other endpoints, such as embeddings or file storage, keep those with another provider. New accounts start with $5 of credit. Of the chat models, only Gemma 4 VL 26B runs on it (it also covers the two Transcribe models), so a shadow test on DeepSeek, GLM or Qwen needs a top-up.

Free tools for this

-   [OpenAI to BroadNet migration helper](https://broadrouter.com/tools/openai-to-broadnet-migration/) Paste OpenAI SDK code; get base URL, key and model edits, a diff and the checks that remain.
-   [max\_tokens calculator for reasoning models](https://broadrouter.com/tools/reasoning-token-budget/) Answer length + reasoning budget + margin = a max\_tokens that does not cut the answer off.
-   [JSON schema generator for LLM structured output](https://broadrouter.com/tools/json-schema-generator/) Sample JSON to strict schema, Pydantic, Zod and a ready request.
-   [LLM JSON output validator](https://broadrouter.com/tools/llm-json-output-validator/) Parse errors by line and column, safe repairs, cut-off detection and JSON Schema checks for model output.

[All free tools](https://broadrouter.com/tools/)

## Terms in this article

[Token](https://broadrouter.com/glossary/token/)

A token is the unit of text a language model reads and writes: a word, part of a word, a punctuation mark or a byte sequence produced by the model's tokenizer. LLM APIs count, limit and usually bill usage in tokens.

[Tool calling](https://broadrouter.com/glossary/tool-calling/)

Tool calling, also called function calling, is an LLM API feature in which the model returns a structured request to run a function the developer has defined, with JSON arguments. The application runs the function and sends the result back; the model never runs code itself.

[Pay-as-you-go](https://broadrouter.com/glossary/pay-as-you-go/)

Pay-as-you-go is a pricing model in which you pay only for what you use, metered per unit such as tokens, requests or audio minutes, with no subscription or minimum commitment. Most LLM APIs bill this way, from a prepaid balance or a periodic invoice.

[Speech-to-text](https://broadrouter.com/glossary/speech-to-text/)

Speech-to-text, also called automatic speech recognition (ASR), is technology that converts spoken audio into written text. A speech-to-text API accepts an audio file or stream and returns a transcript, usually priced per minute of audio. Accuracy is measured with word error rate and varies with accent, dialect and recording quality.

[Streaming](https://broadrouter.com/glossary/streaming/)

Streaming is a way of returning a language model response in small chunks while it is still being generated, instead of as one reply at the end. OpenAI-compatible APIs stream over server-sent events when the request sets stream to true.

[Base URL](https://broadrouter.com/glossary/base-url/)

A base URL is the fixed root address of an API, such as https://api.example.com/v1, that a client puts in front of every endpoint path, such as /chat/completions. In OpenAI-compatible SDKs, changing the base URL, together with the API key and model ID, points the same code at a different provider.

[Chat Completions API](https://broadrouter.com/glossary/chat-completions-api/)

The Chat Completions API is OpenAI's HTTP endpoint, POST /v1/chat/completions, that takes a model name and a list of role-tagged messages and returns the model's next message. Its request and response shape became the common format that OpenAI-compatible providers and SDKs reuse.

[Rate limit](https://broadrouter.com/glossary/rate-limit/)

A rate limit is a cap an API places on how much a client can use it in a time window, such as requests per minute or tokens per minute. Requests over the limit are refused, usually with HTTP 429 Too Many Requests, until usage falls back under it.

## Questions

### Do I need a different SDK?

No. The official OpenAI SDKs for Python and Node.js accept a custom base URL. Frameworks built on them, such as LangChain's ChatOpenAI, accept it too.

### How do I change the base URL in the OpenAI SDK?

Pass base\_url to the client in Python or baseURL in Node.js, or set the OPENAI\_BASE\_URL environment variable. For BroadNet Inference the value is https://inference.broadnet.ai/v1, and the key goes in api\_key.

### Why do I get an empty response after switching?

Reasoning models such as DeepSeek V4.1 Flash, GLM 5.3 and Qwen3.8 27B think before they answer, and the thinking counts toward max\_tokens. Raise max\_tokens to 1,000 or more, or set reasoning\_effort to low.

### Why do I get a 404 or model not found error after switching?

Usually the model ID is still the old provider's name, or the base URL is missing its /v1 path. Use the new provider's exact model ID and the full base URL.

### Which errors should I retry?

Retry 429 and 5xx with bounded exponential backoff. Fix 401, 402 and 413 before retrying. The errors guide on this site lists every code.

### Is OpenAI-compatible the same as identical?

No. The request and response shapes match, but model IDs, supported parameters, limits, usage fields and error details can differ. Test every feature your app uses.

## Keep reading

-   [OpenAI-compatible API base URLs: 14 providers, checked](https://broadrouter.com/blog/openai-compatible-api-base-urls/)
-   [OpenRouter vs a flat-rate plan for AI agents: which costs less?](https://broadrouter.com/blog/openrouter-alternative-flat-rate/)
-   [When a 1M-token context window is worth it (and when not)](https://broadrouter.com/blog/million-token-context-window-guide/)
-   [Zero data retention LLM API: a 10-question checklist](https://broadrouter.com/blog/zero-data-retention-llm-api-checklist/)
-   [A private endpoint starts with a clear workload](https://broadrouter.com/blog/private-endpoint-planning/)
-   [Before fine-tuning: define the problem to solve](https://broadrouter.com/blog/fine-tuning-readiness/)
-   [Guide: Use the OpenAI Python SDK with BroadNet Inference](https://broadrouter.com/guides/openai-python-sdk/)
-   [Guide: Use the OpenAI Node.js SDK with BroadNet Inference](https://broadrouter.com/guides/openai-node-sdk/)
-   [Guide: Use LangChain with BroadNet Inference](https://broadrouter.com/guides/langchain-openai-base-url/)
-   [Guide: BroadNet Inference error codes and when to retry](https://broadrouter.com/guides/errors-and-retries/)
-   [Guide: Stream chat completions and handle dropped connections](https://broadrouter.com/guides/streaming-chat-completions/)
-   [Guide: Why a reasoning model returns an empty answer](https://broadrouter.com/guides/reasoning-tokens-empty-response/)
-   [Guide: Route LiteLLM to BroadNet Inference (SDK and proxy)](https://broadrouter.com/guides/litellm-proxy-custom-provider/)

Try it on your real workload. New accounts start with $5 of credit for Gemma and transcription. DeepSeek, GLM and Qwen3.8 need a top-up.

[Get started](https://inference.broadnet.ai/account/?utm_source=broadrouter&utm_medium=referral&utm_campaign=blog-openai-compatible-api-migration-checklist&utm_content=page-cta) ·

**Sources**

-   [BroadNet Inference API reference](https://inference.broadnet.ai/docs?utm_source=broadrouter&utm_medium=referral&utm_campaign=blog-openai-compatible-api-migration-checklist&utm_content=sources)
-   [OpenAI Python SDK README (base\_url, OPENAI\_BASE\_URL, retries; checked 2026-11-14)](https://github.com/openai/openai-python)
