OpenAI compatibility is a spectrum
Every local engine claims OpenAI-compatible. They're all almost compatible. The divergences are predictable but not standardized:
- Streaming format. All emit SSE, but exact chunk shapes differ.
- Tool calling. Native Ollama gives parsed dict args; OpenAI emits JSON string args; some engines wrap differently.
- Structured output. Ollama uses
formatfield with JSON Schema. OpenAI usesresponse_format. vLLM usesguided_json. Same idea, different keys. - Token counting. Slightly different (or missing) token usage fields.
How to test compatibility
Don't trust the label. Run a small test suite that exercises the features you use. The list below is the canonical local-AI compatibility test:
- Non-streaming chat with a simple message.
- Streaming chat with the same message.
- Multi-turn conversation (system + user + assistant).
- Tool definition + multi-turn tool loop.
- Structured output (JSON Schema).
- Token usage in the response.
If all six pass on your engine, you can swap engines without app changes. If items 4 or 5 fail, expect to write engine-specific shims.