Xenodia Docs
API ReferenceGenerated Reference

Create chat completion

Creates an OpenAI-compatible chat completion through Xenodia. Usage reports Xenodia billable token counts with the applicable token multiplier already applied. Do not apply it again. Input and output counts are rounded separately; total_tokens is their sum. With stream=true, the final verified usage is returned before the data: [DONE] event. Explicit zero usage incurs no token charge. Missing or invalid metering retains reserved credits for review, without an estimated token count or fixed fallback fee. An uncertain stream emits an error, not [DONE].

POST
/v1/chat/completions

Authorization

bearerAuth
AuthorizationBearer <token>

In: header

Header Parameters

Idempotency-Key?string

Reuse with the identical body to recover a saved verified JSON or SSE response without another model execution. Results whose stored JSON representation is at most 4 MiB are retained for seven days. In-progress, uncertain, oversized uncached requests and changed bodies return 409; expired saved bodies return 410. Execution claims remain after expiry.

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

curl -X POST "https://api.xenodia.xyz/v1/chat/completions" \  -H "Content-Type: application/json" \  -d '{    "model": "gpt-5.4",    "messages": [      {        "role": "user",        "content": "Reply with OK only."      }    ]  }'
{
  "id": "string",
  "object": "string",
  "model": "string",
  "created": 0,
  "choices": [
    {
      "index": 0,
      "finish_reason": "string",
      "message": {
        "role": "system",
        "content": "string"
      }
    }
  ],
  "usage": {
    "prompt_tokens": 0,
    "completion_tokens": 0,
    "total_tokens": 0,
    "prompt_tokens_details": {
      "cached_tokens": 0,
      "audio_tokens": 0,
      "reasoning_tokens": 0,
      "accepted_prediction_tokens": 0,
      "rejected_prediction_tokens": 0
    },
    "completion_tokens_details": {
      "cached_tokens": 0,
      "audio_tokens": 0,
      "reasoning_tokens": 0,
      "accepted_prediction_tokens": 0,
      "rejected_prediction_tokens": 0
    }
  }
}
{
  "error": "bad_request",
  "message": "string",
  "type": "string",
  "code": "string"
}
Empty
Empty
{
  "error": "bad_request",
  "message": "string",
  "type": "string",
  "code": "string"
}
Empty
Empty