“OpenAI-compatible” is a marketing phrase, not a specification. Two endpoints can both accept POST /v1/chat/completions and behave nothing alike the moment anything real happens.
Before you point production at a new provider, four requests will tell you most of what you need. They cost cents and take a minute.
1. List the catalog
curl -s $BASE/v1/models -H "Authorization: Bearer $KEY" Look at three things, not one: does it return a list at all, does it include the model you intend to call, and does it include models it would refuse to serve? A catalog that advertises more than it can answer is a catalog you cannot automate against.
2. A non-streaming call that asks for usage
curl -s $BASE/v1/chat/completions -H "Authorization: Bearer $KEY" \ -H "Content-Type: application/json" \ -d '{"model":"MODEL","messages":[{"role":"user","content":"say ok"}],"max_tokens":16}' Check the shape: choices[0].message.content present, finish_reason populated, and usage.prompt_tokens / usage.completion_tokens actually returned. Plenty of compatible-looking proxies drop usage, and then your cost accounting silently becomes guesswork.
3. The same call with stream: true
Streaming is where compatibility quietly stops being compatible. You are checking for:
- SSE frames that parse as
data: {...}and terminate withdata: [DONE] - deltas arriving in
choices[0].delta.content, not a bespoke field - no buffering that holds the whole answer and flushes it at the end
The last one is the nastiest. HTTP 200, correct final text, and a user staring at a blank screen for nine seconds. Time to first byte is the only thing that reveals it.
import time, json, urllib.request req = urllib.request.Request( f"{BASE}/v1/chat/completions", data=json.dumps({"model": MODEL, "stream": True, "messages": [{"role": "user", "content": "count to five"}]}).encode(), headers={"Authorization": f"Bearer {KEY}", "Content-Type": "application/json"}, ) t0 = time.time() with urllib.request.urlopen(req) as r: for line in r: if line.startswith(b"data:") and b"[DONE]" not in line: print(f"{time.time() - t0:.2f}s", json.loads(line[6:])["choices"][0]["delta"].get("content")) 4. Deliberately fail
Send an unknown model, and then send a request with a malformed body. You are looking at the error envelope: does it use {"error": {"message": ..., "type": ...}}, with a sensible HTTP status, or does it return HTML, or a 200 with an empty body? Errors are what your retry logic keys off. An endpoint with creative error shapes will make your client retry things that should never be retried.
Why bother
Because all four failures are invisible in a demo. A demo shows text appearing. It does not show missing usage, eight seconds of buffering, or an error that your code treats as a transient 500 forever.
We built a one-shot checker for exactly this and wrote up what each of the four probes means on the integration docs. It runs against any OpenAI-compatible base URL, including not ours - which is the point.
I maintain LONG AI, a 109-model gateway. The checker described here is the check_compatibility tool in our MCP server.

