LEAPERone Docs

Chat Completions

POST /v1/chat/completions

Create a chat completion. This endpoint is OpenAI-compatible and supports streaming, tool calling, and JSON mode.

Endpoint

POST https://api.leaper.one/v1/chat/completions

Parameters

ParameterTypeRequiredDescription
modelstringYesModel ID. Supported: "auto", "gpt-5-nano"
messagesarrayYesArray of message objects with "role" (system/user/assistant) and "content"
streambooleanNoIf true, partial message deltas sent as SSE. Default: false
temperaturenumberNoSampling temperature 0-2. Default: 0.7
top_pnumberNoNucleus sampling. Default: 1
max_tokensintegerNoMaximum tokens to generate
stopstring | arrayNoUp to 4 stop sequences
toolsarrayNoList of tool definitions the model may call
tool_choicestring | objectNo"none", "auto", or specify a function
response_formatobjectNo{ "type": "json_object" } for JSON mode

Request

curl -X POST https://api.leaper.one/v1/chat/completions \
  -H "Authorization: Bearer sk-your-api-key" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "auto",
    "messages": [
      { "role": "system", "content": "You are a helpful assistant." },
      { "role": "user", "content": "What is LEAPERone?" }
    ],
    "temperature": 0.7,
    "max_tokens": 256
  }'

Response

{
  "id": "chatcmpl-abc123",
  "object": "chat.completion",
  "created": 1700000000,
  "model": "gpt-5-nano",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "LEAPERone is a unified AI API gateway that gives you access to multiple AI models through a single API key."
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 25,
    "completion_tokens": 22,
    "total_tokens": 47
  }
}

Notes

  • "auto" routes to gpt-5-nano by default.
  • When stream is true, partial deltas are sent as Server-Sent Events (SSE). The stream terminates with a [DONE] message.
  • Billing is calculated per token based on the resolved model.