DocumentationAPI reference

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.

Headershttp
Authorization: Bearer sk-xedoc-YOUR_KEY
Content-Type: application/json

Customer keys only

Create a key in your dashboard. The full key is only displayed at creation; revoke a lost or exposed key and create another. Revocation applies to new API requests.

Choose an endpoint

#
MethodEndpointUse
GET/v1/modelsList currently enabled models
GET/v1/usageCharged tokens for this key
GET/v1/usage/{id}Charged tokens for one request
POST/v1/responsesOpenAI-compatible Responses
POST/v1/chat/completionsOpenAI-compatible Chat Completions
POST/v1/messagesAnthropic-compatible Messages
GET/healthzLightweight 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

#
Install the SDKshell
pip install openai
main.pypython
import 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

#
Install the SDKshell
npm install openai
main.mjsjavascript
import 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

#
Pythonpython
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

#
Install the SDKshell
pip install anthropic
main.pypython
import 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

No image-generation model is enabled in the current XEDOC catalog. The reserved /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.