API reference
OpenAI-compatible API reference
Send Responses, Chat Completions and Anthropic-compatible Messages requests with Python and JavaScript SDKs.
Authentication
#Send your XEDOC key as Authorization: Bearer <key>. Messages clients may instead send x-api-key: <key>. If both headers are present, the Authorization header takes precedence.
Authorization: Bearer sk-xedoc-YOUR_KEY
Content-Type: application/jsonCustomer keys only
Choose an endpoint
#| Method | Endpoint | Use |
|---|---|---|
| GET | /v1/models | List currently enabled models |
| GET | /v1/usage | Charged tokens for this key |
| GET | /v1/usage/{id} | Charged tokens for one request |
| POST | /v1/responses | OpenAI-compatible Responses |
| POST | /v1/chat/completions | OpenAI-compatible Chat Completions |
| POST | /v1/messages | Anthropic-compatible Messages |
| GET | /healthz | Lightweight gateway process status |
Supported fields and model behavior depend on the selected model and protocol. Check the model catalog and protocols before choosing an endpoint. For incremental output, follow the SSE streaming guide. Files, Assistants, embeddings, realtime sessions and arbitrary OpenAI API routes are not implemented by this gateway.
Python · Responses
#pip install openaiimport os
from openai import OpenAI
client = OpenAI(
api_key=os.environ["XEDOC_API_KEY"],
base_url="https://api.xedoc.top/v1",
)
response = client.responses.create(
model="gpt-5.6-terra",
input="Explain what an API gateway does in one sentence.",
)
print(response.output_text)JavaScript · Responses
#npm install openaiimport OpenAI from "openai";
const client = new OpenAI({
apiKey: process.env.XEDOC_API_KEY,
baseURL: "https://api.xedoc.top/v1",
});
const response = await client.responses.create({
model: "gpt-5.6-terra",
input: "Explain what an API gateway does in one sentence.",
});
console.log(response.output_text);Chat Completions
#response = client.chat.completions.create(
model="gpt-5.6-terra",
messages=[{"role": "user", "content": "Hello from XEDOC."}],
)
print(response.choices[0].message.content)Anthropic-compatible Messages
#pip install anthropicimport os
from anthropic import Anthropic
client = Anthropic(
api_key=os.environ["XEDOC_API_KEY"],
base_url="https://api.xedoc.top",
)
message = client.messages.create(
model="claude-sonnet-5",
max_tokens=256,
messages=[{"role": "user", "content": "Hello from XEDOC."}],
)
for block in message.content:
if block.type == "text":
print(block.text)For a direct HTTP request, include anthropic-version: 2023-06-01. Anthropic version and beta headers are passed through to the model service.
Images and vision
#Models whose catalog entry includes the image input modality can accept image input in a supported request format. Image input is different from generating an image.
Image generation is not currently available
/v1/images/generations route does not provide a usable generation model. Do not use upstream image-generation instructions with XEDOC until a supported model is announced.