API beginner Q&A — Why check Accept instead of replacing your key after a 406?
Separate what you send from what you expect back, then change one header at a time to narrow down a 406 at the client, gateway, or upstream service.
After an HTTP 406, check what the endpoint can return and what Accept headers your client actually sent. In standard HTTP usage, a 406 means the server could not produce a response matching the client's preferences and chose not to send a default. It does not by itself mean the API key has expired, the model is unavailable, or the request body is malformed. A particular service may also use 406 for its own rules, so read the error body before drawing a conclusion. 1
What is the difference between Accept and Content-Type?
On a request, Content-Type: application/json means “the body I sent is JSON.” Accept: application/json means “I want JSON back.” On a response, Content-Type tells you what the server actually sent. In standard HTTP usage, 406 points to negotiation over the response; with 415, start by checking whether the server accepts the body format or encoding you sent. Changing the wrong header introduces another variable without answering the original question.
A regular JSON lookup and an event-stream endpoint should not blindly share the same global response preference. If a global Accept header allows only text/event-stream and reaches a JSON-only lookup, a strict server may reject it. Another server may ignore the preference and return its default. Conversely, adding an event-stream Accept header to a regular request does not necessarily turn streaming on. Follow the endpoint documentation and check what actually comes back. 1
Why check Accept if I never set it?
Your application code is not the final request on the wire. SDK defaults, a shared HTTP client, middleware, and the gateway can all add or rewrite headers. In diagnostic records you are authorized to view, check the method, path, Accept, Accept-Encoding, and Accept-Language, along with the returned status, response media type, and request ID. Redact credentials and omit the full body. If the response is HTML, first check whether it is a proxy error page instead of letting a JSON parser hide the original failure. 1
How do I change one variable at a time?
- In a test environment, pick a read-only endpoint documented to return JSON. Keep the URL, method, test credentials, and client version fixed. Start with a baseline using the documented headers.
- On the same endpoint, change only
Accept. Compare the value your application sent with the endpoint's supported value. If behavior changes, record the status, response media type, and request ID. Do not simultaneously change the credential, host, or model.
- If that does not explain it, check whether encoding and language preferences were inadvertently restricted, one at a time. Record the headers actually sent, not just what a config file says. If the 406 body lists available formats, use it to adjust the request; no list does not mean no formats are supported. 1
- If the minimal call works but the application still fails, restore shared-client and middleware settings in turn to find where the header changes. For a documented request that still fails, give gateway support the request ID, time, path, and redacted headers, and ask whether it returned the error or forwarded it from upstream.
Is a 200 enough to call it fixed?
No. A server may ignore the preference and return a default. Verify the actual Content-Type and confirm your parser produced the result the application needs. For JSON, read the expected fields. For a stream, decode the documented events and verify normal completion, not just the arrival of the first chunk. If a broader Accept made diagnosis easier, do not leave it as a global workaround. Set the expected response and parser per endpoint, then retest both regular and streaming calls. The test passes when the client can actually use the result. 1
Sources & attribution
This article references the public materials listed below. Analysis and wording are SalpX's own; quoted material remains the property of its original authors and publishers.
- 406 Not Acceptable — MDN Web Docs (Mozilla) · accessed 2026-12-02Note:Explains 406, proactive content negotiation headers, and why a server may return a default response instead.
One key for Claude, GPT and 50+ models
The SalpX gateway is OpenAI-SDK compatible. Point base_url at https://www.salpx.com/v1 and you are done.