Debugging 500s and odd failures with third-party compatible APIs

APIFreeKeyOpenAI · Updated 2026-11-24 · 8 min read

Two plug adapters next to a wall socket, one half inserted
Compatible does not always mean every plug fits every socket.

A familiar situation: a coding assistant extension has worked for months with keys from several providers, then one specific model on one specific gateway starts returning Internal Server Error on every request, while every other model is fine. Or a chat front end stops responding after you change the key, and clearing the cache and refreshing the page changes nothing.

OpenAI-compatible means the request and response shapes follow a common format. It does not mean every server implements every field, every model accepts every parameter, or every error is reported cleanly. This article is for developers and power users who connect tools to such endpoints and need a methodical way to find out what is actually wrong.

Examples use the keyless endpoint of this site as a known-good reference you can compare against. This site is not affiliated with OpenAI, and the model behind it, free-ai, is an independent open-weight model, not GPT.

Frequently asked questions

What does OpenAI-compatible actually guarantee?

Only that the server accepts requests and returns responses in roughly the same JSON shapes as OpenAI's API, usually for chat completions and model listing. Support for newer or optional fields, tool calls, reasoning options or streaming details varies by server and by model.

How does a 500 differ from a 400?

A 400 means the server understood your request and rejected it, usually because of a bad parameter, and the body often says which. A 500 means something broke on the server side. Compatible gateways sometimes turn upstream 400s into generic 500s, which hides the real cause.

Why does one model fail while others work on the same gateway?

Different upstream models accept different parameters. A tool may send a field that one model does not support, such as a particular reasoning setting or a tool definition style. The gateway forwards it, the upstream rejects it, and you see a vague error.

Which is the quickest way to isolate the problem?

Reproduce the request outside the tool with curl, using the smallest possible body. If the minimal request works, add the tool's parameters back one at a time until it fails. That pinpoints the offending field in minutes.

Why do some error bodies look like Rust debug output?

Servers built in various languages occasionally leak internal debug formatting into error messages, for example a serialized JSON value printed with debug formatting. It is ugly but harmless. Read it for the field names it mentions.

Does changing the API key fix compatibility errors?

Only if the problem was authentication, which usually shows as 401 or 403, not 500. If a new key changes nothing, the issue lies in the base URL, the model name or the request body, or the front end is still using a cached configuration.

Why does the free endpoint here return 403?

It rejects clients without a normal User-Agent header. Python's built-in urllib sends a default that is blocked. Use curl, requests or the openai SDK, or set a User-Agent explicitly.

What does 503 mean on the free endpoint?

The server is busy. Wait two to five seconds and retry. It is different from a 500, which signals a bug or a rejected request rather than load.

Start by reading the full response

Tools often show only a short message, such as Internal Server Error, and discard the response body. The body is where the useful detail lives: an error type, a parameter name, sometimes an upstream message. Your first job is to see it.

Many extensions have a debug or verbose logging option. Turn it on and look for the raw HTTP exchange. If the tool hides everything, reproduce the call with curl so you control what is printed.

Use -i to see headers

Status line and headers reveal a lot: a Retry-After header means rate limiting, an HTML content type means you hit a proxy or a wrong URL rather than the API itself.

curl -sS -i https://api.apifreekeyopenai.com/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '{"model":"free-ai","messages":[{"role":"user","content":"ping"}],"max_tokens":5}'

The usual suspects

Most compatibility failures fall into a short list. Check them in order before digging deeper, because each takes a minute and together they explain the majority of cases.

Pay special attention to base URLs. Some tools append /v1 automatically and some expect you to include it. A doubled /v1/v1 or a missing one produces 404s or HTML error pages that some clients misreport.

Check the model list

Call GET /v1/models on the server. It tells you exactly which model IDs are valid. On this site the list contains free-ai only.

Watch the context budget

If your tool sends a large codebase as context, the prompt may exceed the window. The free endpoint accepts up to 32,000 tokens of context and up to 16,000 tokens of output; other servers differ.

Look at the error type, not only the code

Many compatible servers include an error object with a type and a message, even when the status code is generic. A type such as invalid_request_error points at your request, while server_error points at their side. Logging these fields alongside the status gives you a searchable history, so the next time the same failure appears you recognize it in seconds instead of starting the investigation again from scratch.

  • Wrong base URL: missing or doubled /v1, trailing slash issues, http instead of https.
  • Wrong model name: the server only knows its own model IDs.
  • Unsupported parameter: a field this model or server does not accept.
  • Context too long: prompt plus max_tokens over the model's window.
  • Streaming mismatch: client expects a stream format the server does not send.
  • Authentication: missing, wrong or unnecessary key handling.
Bolts and nuts sorted beside an engine part on a bench
Check the usual suspects one by one.

Bisecting a failing request

When a tool sends a large, complicated request, the fastest diagnosis is bisection. Capture the full body the tool sends, confirm it fails with curl, then remove fields until it succeeds. The last field you removed is the culprit, or at least the trigger.

Typical offenders are tool or function definitions with features a server does not support, parameters introduced recently in one provider's API, unusual values for penalties or sampling, and message roles other than system, user and assistant.

Replace the model for the test

When bisecting against a reference server, set the model to one that server knows. You are testing the shape of the request, not the model.

import json, copy, requests

URL = "https://api.apifreekeyopenai.com/v1/chat/completions"
body = json.load(open("failing_request.json"))  # body captured from the tool

def ok(b):
    r = requests.post(URL, json=b, timeout=60, headers={"User-Agent": "bisect-script/1.0"})
    return r.status_code == 200, r.status_code, r.text[:200]

print("full:", ok(body))
for key in [k for k in body if k not in ("model", "messages")]:
    trimmed = copy.deepcopy(body)
    trimmed.pop(key)
    print(f"without {key}:", ok(trimmed))

Gateways that hide upstream errors

Routing services that put many providers behind one URL add a layer where errors can be translated or lost. An upstream may answer with a precise 400 explaining which parameter is invalid, and the gateway may pass back a generic 500. From the client side the two look the same.

If one model fails on a gateway while others work, check the gateway's documentation or status page for that model, and look for notes on supported parameters. Try the same request against the model's own provider if you have access, to see the unfiltered error. For more on the trade-offs of these services, see gateway vs direct API.

Compare with a second route

Sending the same minimal request to two different servers tells you quickly whether the problem is your request or one server's handling of it.

Scissors cutting a paper chain in half
Bisect the request until the failing field stands out.

Streaming-specific failures

Streaming responses arrive as server-sent events, each line starting with data: and the stream ending with data: [DONE]. Clients that expect exactly this format break when a server sends keep-alive comments, different line endings, or finishes without the done marker.

If a tool fails only with streaming turned on, try the same request without streaming. If that works, the issue is in how the stream is produced or parsed. Proxies and some hosting platforms buffer streams, which makes the client wait and then time out.

Timeouts that look like errors

Long generations, especially with reasoning enabled, can take a while. A client with a short read timeout reports a failure even though the server was still working. Increase the timeout before blaming the server.

Reasoning output

On the free endpoint, setting "reasoning": true produces extra thinking before the answer, so give it a max_tokens of 2000 or more or the visible answer may be cut short.

Proxies that buffer streams

Reverse proxies and some hosting platforms collect a streamed response before passing it on, which turns a smooth stream into a long silence followed by everything at once. If your tool works locally but stalls behind a proxy, check the proxy settings for response buffering and disable it for the API route. Many setups only need one directive to pass events through immediately.

Front ends that cache configuration

Web-based chat front ends, especially those for roleplay or character chat, often store connection settings in local storage or on their own server. Changing the key in one field may not update the stored profile, and clearing the browser cache may not touch it either.

Look for a connection or API settings page with an explicit save or test button, and check whether the app has multiple profiles. If the front end offers a test connection feature, use it; it usually shows the real error from the endpoint.

Check the endpoint type

Some front ends distinguish between a native provider integration and a generic compatible connection. Using the provider option with a third-party URL, or the reverse, causes confusing failures.

A garden hose leaking at a connector
Streams break most often at the joints.

A known-good reference to compare against

When you are unsure whether your tool or the server is at fault, it helps to have an endpoint whose behavior is simple and documented. The keyless endpoint here accepts standard chat and text completion requests at https://api.apifreekeyopenai.com/v1, needs no key, and lists one model.

Point your tool at it temporarily. If the tool works here but not on the original server, the problem lies with that server or model. If it fails here too, look at your tool's configuration. Remember the reference has its own limits, roughly one request per second per IP with bursts of three, and that it is text only.

Use the plain-text endpoint for quick checks

A request to /ask?q=hello returns plain text and is the simplest possible test that the network path works.

Endpoint choice matters

Some tools send requests to the older text completions endpoint instead of chat completions. Both exist here; elsewhere one may be missing. See chat vs text completions for the difference.

When to stop debugging and report

If a minimal, well-formed request fails consistently on one server and works elsewhere, you have done your part. Report it to the server operator or the tool maintainer with the minimal request, the full response including headers, the time and the model name. That is exactly what they need to act.

Do not include your API key in the report. Replace it with a placeholder and confirm the logs you attach do not contain it either; our guide on keeping secrets out of prompts has a redaction snippet you can reuse.

Include versions

Note the tool version, extension version and any provider SDK version. Many compatibility bugs appear right after an update on one side.

A balance scale with reference weights on a lab bench
A known-good reference makes the fault obvious.
Try the free API

Send a prompt to the keyless free-ai endpoint from the home page and see a reply in seconds, no sign-up needed.

Read also