Docs

Point your Claude SDK or HTTP client at https://api.xmaxgate.com/v1. Paths below are relative to that base (for example /chat/completionshttps://api.xmaxgate.com/v1/chat/completions).

Authentication

Send your API key in the header: Authorization: Bearer xmg_...

GET /v1/models

List model ids available through the gateway (chat and embedding models).

Response shape follows standard list models format (object, data[] with id, object, owned_by).

curl https://api.xmaxgate.com/v1/models \
  -H "Authorization: Bearer xmg_xxx"

POST /v1/chat/completions

Chat completions with an OpenAI-compatible JSON body. Set model and a messages array (see messages).

curl https://api.xmaxgate.com/v1/chat/completions \
  -H "Authorization: Bearer xmg_xxx" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-4o-mini",
    "messages": [
      {"role":"system","content":"You are concise."},
      {"role":"user","content":"hello"}
    ]
  }'

messages (request body)

There is no separate HTTP path /messages. Conversation turns are sent as the messages field inside POST /v1/chat/completions, matching the standard Chat Completions schema.

  • role: typically system, user, or assistant.
  • content: string content for that turn (multi-modal shapes follow upstream when enabled).

Order matters: older turns first; the latest user message is usually last before the model reply.

POST /v1/embeddings

Create vector embeddings for semantic search, RAG, or classification. Use an embedding-capable model (for example one returned from GET /v1/models).

Request and response formats follow standard Embeddings API (model, input string or array; response includes data[].embedding).

curl https://api.xmaxgate.com/v1/embeddings \
  -H "Authorization: Bearer xmg_xxx" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "text-embedding-3-small",
    "input": "Semantic search example text."
  }'

Quick reference

Method Path Purpose
GET /v1/models List models
POST /v1/chat/completions Chat with messages[] body
POST /v1/embeddings Embedding vectors
messages is a JSON field on chat completions, not its own route.