"OpenAI-compatible" gets used loosely. When a relay claims it, only three things have to be true — and knowing which three saves you from debugging the wrong layer.
The client appends its own path to whatever base you give it:
POST {base}/chat/completions
GET {base}/models
So if the SDK expects base_url = "https://host/v1", the relay must serve /v1/chat/completions. If the SDK expects the base without /v1, the relay must serve /chat/completions. Both conventions exist in the wild; the relay has to match the client, not the other way around.
Authorization: Bearer sk-...
That is the whole contract. A relay that also accepts x-api-key is being generous, not compliant. If your client sends Bearer and gets 401, the key is wrong — not the header name.
The non-streaming response must have choices[0].message.content and usage.prompt_tokens / completion_tokens. Streaming must emit data: {json} lines terminated by data: [DONE].
Most "compatible" servers get this right for chat but drift on streaming — especially the terminator. A client that hangs waiting for [DONE] is not a client bug.
curl -s https://your-relay.example/v1/models -H "Authorization: Bearer $KEY" | head -c 200
curl -s https://your-relay.example/v1/chat/completions \
-H "Authorization: Bearer $KEY" -H "content-type: application/json" \
-d '{"model":"<model>","messages":[{"role":"user","content":"hi"}],"max_tokens":8}'
Two 200s with sane bodies means compatibility is fine and any remaining problem is client config or concurrency.
*Setup reference: kuku-momo.github.io/ai-relay/setup*