The OpenAI-Compatible Schema as Lingua Franca

10 min read Module 2 of 10 Lesson 5 of 28

What you'll learn

  • Reproduce the exact OpenAI Chat Completions request and response shape from memory
  • Call four different backends, OpenAI, Groq, Ollama, and vLLM, with the literal same request body and see the same response shape
  • Explain why this convergence happened as an ecosystem effect rather than a formal standard
  • Identify the specific fields that still diverge across providers even when the base schema is shared
Building this at your company? For enterprise and company teams taking this to production: book a 30-minute session with our AI engineers for architecture guidance, code review, and a rollout plan for your use case.
Book a Team Session

By 2025-2026, the OpenAI Chat Completions request and response shape has become the closest thing the LLM industry has to a lingua franca. It was never ratified by a standards body, no IETF RFC, no W3C spec, it became a de facto standard the way HTTP status codes or the SMTP envelope did: enough of the ecosystem built against it early that everyone after had a strong incentive to speak it too. This lesson makes that concrete by calling four completely different backends with the exact same request body.

The Shape Itself

A request:

{
  "model": "gpt-4o",
  "messages": [
    {"role": "system", "content": "You are a concise support assistant."},
    {"role": "user", "content": "My order hasn't arrived in 10 days."}
  ],
  "temperature": 0.3,
  "max_tokens": 300
}

And the response shape every OpenAI-compatible backend returns:

{
  "id": "chatcmpl-abc123",
  "object": "chat.completion",
  "model": "gpt-4o",
  "choices": [
    {
      "index": 0,
      "message": {"role": "assistant", "content": "I'm sorry for the delay..."},
      "finish_reason": "stop"
    }
  ],
  "usage": {"prompt_tokens": 24, "completion_tokens": 41, "total_tokens": 65}
}

messages, choices[0].message.content, and usage are the three fields almost every client, framework, and gateway is written against. This is exactly what let the “change two constructor arguments” trick from Lesson 3 work.

The Same Request, Four Backends

OpenAI, the origin of the schema:

curl https://api.openai.com/v1/chat/completions \
  -H "Authorization: Bearer $OPENAI_API_KEY" -H "Content-Type: application/json" \
  -d '{"model":"gpt-4o","messages":[{"role":"user","content":"Say hi in five words."}]}'

Groq, serving open-weight models (Llama 3.3) at very low latency, exposes a byte-for-byte compatible endpoint at a different base URL:

curl https://api.groq.com/openai/v1/chat/completions \
  -H "Authorization: Bearer $GROQ_API_KEY" -H "Content-Type: application/json" \
  -d '{"model":"llama-3.3-70b-versatile","messages":[{"role":"user","content":"Say hi in five words."}]}'

Ollama, running an open-weight model entirely on your own machine, exposes the same endpoint on localhost with no real API key required:

curl http://localhost:11434/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '{"model":"llama3.2","messages":[{"role":"user","content":"Say hi in five words."}]}'

vLLM, the production-grade open-source inference server (set up fully in Lesson 8), serves the identical shape once launched with vllm serve meta-llama/Llama-3.1-8B-Instruct:

curl http://localhost:8000/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '{"model":"meta-llama/Llama-3.1-8B-Instruct","messages":[{"role":"user","content":"Say hi in five words."}]}'

Four completely different companies and codebases, Groq’s custom LPU inference stack, Ollama’s local runtime, vLLM’s PagedAttention-based server, and OpenAI’s own infrastructure, all accept this exact request body and return this exact response shape. This is precisely why a gateway’s adapter layer (Lesson 6) can be thin for OpenAI-compatible backends: for these four, the adapter mostly just swaps in the right base URL and the real credential, rather than rewriting the whole payload.

Where It Still Diverges

Compatibility is not total, and knowing where it breaks is what an adapter layer is actually for. Anthropic’s native Messages API uses a different shape entirely (content blocks instead of a flat string, max_tokens required rather than optional, system as a top-level field rather than a message role), which is why Anthropic calls need real translation rather than a pass-through, covered in Lesson 6. Even among OpenAI-compatible backends, optional parameters diverge: not every provider supports logprobs, seed, or every sampling parameter, and tool-calling response shapes have subtle differences in how arguments are streamed. A gateway earns its place precisely in this gap, absorbing the divergence so that application code, which only ever sees the canonical shape, never has to know it exists. Lesson 6 builds that adapter layer for both the easy case (OpenAI-compatible pass-through) and the hard case (a genuinely different schema like Anthropic’s).

Knowledge Check

3 questions to test your understanding

1 Why do Groq, Ollama, and vLLM all expose a /v1/chat/completions endpoint that accepts the same request body as OpenAI's API, even though none of them are OpenAI?

2 A gateway routes the same chat request to both OpenAI and a self-hosted vLLM server running an open-weight model, both via their /v1/chat/completions endpoints. What is guaranteed to be identical, and what commonly still differs?

3 What does a gateway's provider adapter layer do when a provider is already fully OpenAI-compatible, like Groq or a vLLM server?

Go further with expert guidance

Ready to build production AI?
Talk to our R&D team.

These courses give you the foundation. Our embedded AI teams take you from prototype to production in 30–90 days, with your team, your codebase, your goals. Book a free strategy call to see how we can accelerate your AI initiative.

30 minutes · No obligation · Expert AI engineers, not sales reps

AI Architecture Review

Audit your current stack and identify high-impact improvements

Project Review

Get expert feedback on your AI implementation and codebase

Team Mentoring

Upskill your engineers with hands-on AI coaching sessions

AI Strategy

Define your AI roadmap, prioritization, and implementation plan