How to read an OpenAI-compatible endpoint's response header A developer who set out to verify an endpoint's OpenAI compatibility by inspecting its response headers found that headers only prove transport-level facts, not billing accuracy, and documented a method for checking compatibility by comparing the usage block's prompt and completion token counts across endpoints. The writeup recommends logging three fields per call — the x-request-id, prompt and completion token counts, and the status code with attempt number — because daily aggregates hide retry patterns that drive invoice surprises. I once spent an afternoon proving an endpoint was OpenAI-compatible by reading its headers, and then realised I had proved almost nothing. The headers were correct and the token counts were wrong. The first post in this series checked the rate before a request is sent; this one checks the response that comes back. An OpenAI-compatible endpoint means a service that accepts the same request shape and returns the same response shape as the OpenAI API — status codes, error object and usage block included — so existing client code runs unchanged when only the base URL moves. This article covers: ① what headers can and cannot prove, ② where token counts actually live, ③ the three fields worth logging on every call. 🔑 Key takeaways content-type says nothing about price. usage , not in the headers. More than nothing, less than you want. Headers are the transport layer's account of what happened, and they are honest about transport. | Header | What it proves | What it does not prove | |---|---|---| | content-type: application/json | The body is JSON, not an HTML error page | That the JSON contains a completion | | x-request-id | A unique identifier exists for this call | That the ID appears on your invoice | | x-ratelimit-remaining- | The supplier counts your requests or tokens against a limit | Your concurrency ceiling under real load | | date | The response was generated at a stated time | Where it was generated | | transfer-encoding: chunked | The response is streamed | That every chunk is billed the same way | The x-ratelimit- family deserves a note. If a supplier implements it, you get a live budget you can pace against instead of discovering the ceiling in production. If it is absent, that absence is a finding: you cannot plan concurrency you cannot see. What no header will tell you is the price. Not because suppliers are hiding it, but because price is not a property of a request — it is a property of a contract. A 200 and a 429 can cost the same thing if one of them starts inference and the other does not. In the body, under usage , and this is the field that matters for reconciliation. AIO Keys runs an OpenAI-compatible endpoint, so the client below works against it without a compatibility shim. python from openai import OpenAI client = OpenAI api key="your-key", base url="