Chat Completions

OpenAI-compatible chat completions endpoint.

Endpoint

POST /api/v1/chat/completions

Request

{
  "model": "openai/gpt-5",
  "messages": [
    { "role": "user", "content": "Write a haiku about APIs." }
  ]
}

curl

curl https://your-domain.com/api/v1/chat/completions \
  -H "Authorization: Bearer $YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "openai/gpt-5",
    "messages": [
      { "role": "user", "content": "Write a haiku about APIs." }
    ]
  }'

Notes

  • Only models returned by /api/v1/models can be used.
  • Credits are deducted only after the upstream request succeeds.
  • The request is rejected before execution if the API key scope or rate limit fails.