What an OpenAI-compatible endpoint accepts
An OpenAI-compatible API is an endpoint that speaks the same wire format as OpenAI’s: the same paths, the same JSON bodies, the same bearer-token auth and the same streaming events. Point any OpenAI client at it by changing the base URL, and your existing code works unchanged.
What compatible actually means
OpenAI’s API became the format the industry copied, so "OpenAI-compatible" now describes most LLM hosts, gateways and local servers. Compatibility is a promise about the shape of the conversation, not about the model:
- The paths. POST /v1/chat/completions for a reply, GET /v1/models for the list of model ids.
- The request. A JSON body with model and messages, plus optional stream, max_tokens, temperature, tools and the rest.
- The auth. An Authorization: Bearer <key> header.
- The response. A choices array with a message, a usage block, and for streams, server-sent events carrying delta chunks and a final data: [DONE].
Get those four right and the official SDKs, LangChain, LlamaIndex, the Vercel AI SDK and almost every coding agent work against the endpoint with nothing but a base URL change.
The base URL is the whole switch
Every OpenAI SDK takes a base URL and appends the path itself. For Wild West API that base URL is https://wildwestapi.com/v1, and the key is a Wild West API key. The model id is the one thing that changes in the request body: use an id from https://wildwestapi.com/v1/models, such as outlaw-1-xploded.
curl
curl https://wildwestapi.com/v1/chat/completions \ -H "Authorization: Bearer sk-ww-..." \ -H "Content-Type: application/json" \ -d '{ "model": "outlaw-1-xploded", "messages": [{"role": "user", "content": "Hello"}] }'
Python
# pip install openai from openai import OpenAI client = OpenAI( base_url="https://wildwestapi.com/v1", api_key="sk-ww-...", ) resp = client.chat.completions.create( model="outlaw-1-xploded", messages=[{"role": "user", "content": "Hello"}], ) print(resp.choices[0].message.content)
Node and TypeScript
// npm install openai import OpenAI from "openai"; const client = new OpenAI({ baseURL: "https://wildwestapi.com/v1", apiKey: "sk-ww-...", }); const resp = await client.chat.completions.create({ model: "outlaw-1-xploded", messages: [{ role: "user", content: "Hello" }], }); console.log(resp.choices[0].message.content);
Streaming
Set stream to true and the reply arrives as server-sent events, one delta at a time, exactly as from OpenAI. -N stops curl buffering them.
curl -N https://wildwestapi.com/v1/chat/completions \ -H "Authorization: Bearer sk-ww-..." \ -H "Content-Type: application/json" \ -d '{ "model": "outlaw-1-xploded", "stream": true, "messages": [{"role": "user", "content": "Write one line about lava."}] }'
# Python: iterate the stream stream = client.chat.completions.create( model="outlaw-1-xploded", messages=[{"role": "user", "content": "Write one line about lava."}], stream=True, ) for chunk in stream: if chunk.choices and chunk.choices[0].delta.content: print(chunk.choices[0].delta.content, end="")
The models on Wild West API reason before they answer, and the reasoning arrives in delta.reasoning ahead of any delta.content. A client that renders only content shows nothing for a moment and then the answer; that pause is the model thinking, not a stall.
Tool calling
Tools use the OpenAI shape too: a tools array of functions with JSON Schema parameters, a reply with finish_reason: "tool_calls", and a role: "tool" message to answer it. Whether a call comes back is up to the model, not the format; every model Wild West API sells supports it. The full request and reply are in the tool calling docs.
Listing the models
The catalogue is an ordinary GET, and it is the source of truth for model ids: a client that offers a model picker fills it from here.
curl https://wildwestapi.com/v1/models
Each entry carries its id, context_length, pricing per token, and whether it supports tools and reasoning.
What it does not cover
Compatible is a property of each route, not of the whole API. Wild West API serves:
| Route | Served | Used by |
|---|---|---|
| POST /v1/chat/completions | Yes, streaming or not | The OpenAI SDKs and nearly every client |
| POST /v1/responses | Yes | Codex CLI and newer OpenAI SDK code |
| GET /v1/models | Yes | Model pickers |
| POST /v1/messages | Yes, the Anthropic format | Claude Code and the Anthropic SDKs |
| POST /v1/completions | No, legacy text completions | Old integrations |
| POST /v1/embeddings | No | Retrieval pipelines |
What the gateway adds on the way through
Two things differ from calling OpenAI, both deliberate. max_tokens may be lowered to what the key's remaining cap can pay for, which is how a spend cap holds on a stream (clamping explained).
Common mistakes
- Doubling the path. The SDKs append /chat/completions themselves. The base URL ends at /v1; if a field asks for the full endpoint instead, it is https://wildwestapi.com/v1/chat/completions.
- Dropping /v1. The OpenAI base needs it. The Anthropic base is the opposite: https://wildwestapi.com with no path, because the Anthropic SDK appends /v1/messages.
- Guessing the model id. Ids are exact strings. Copy one from /v1/models; an unknown id is a 404 that names it.
- A tight max_tokens on a reasoning model. Reasoning counts as output, so a small cap can be spent on thinking and return an empty message with finish_reason: "length".
Tools that take an OpenAI-compatible base URL
Anything with a "custom OpenAI endpoint", "OpenAI-compatible provider" or "base URL" setting. Step-by-step setups: Python SDK, TypeScript SDK, curl, OpenCode, Cline, Roo Code, Kilo Code, Continue, Aider, Zed, Cursor, LiteLLM, LangChain, LlamaIndex, Vercel AI SDK, Open WebUI and n8n. Roleplay front ends such as SillyTavern and RisuAI take the same two values.
FAQ
What is an OpenAI-compatible API?
An API that accepts the same requests and returns the same responses as OpenAI’s, at the same paths, so any OpenAI SDK or tool can use it by changing only the base URL and the key.
What is the Wild West API OpenAI-compatible base URL?
https://wildwestapi.com/v1. Use it as the base URL in any OpenAI client, with a Wild West API key as the API key.
Do I need the OpenAI SDK?
No. The SDK is a convenience; any HTTP client that can send a JSON POST with a bearer header works, as the curl example shows.
Does an OpenAI-compatible API support function calling?
The format does. Whether a call comes back depends on the model; check the model’s tool support in /v1/models before building an agent on it.
Is OpenAI-compatible the same as Anthropic-compatible?
No. Anthropic’s Messages API is a different format with a top-level system field and content blocks. Claude Code speaks Messages, so it needs an Anthropic-compatible endpoint; Wild West API serves both.