Skip to content
OpenKey

API reference

API reference

Endpoints, parameters, streaming, tools, and structured outputs — the full OpenAI-compatible surface.

Base URL: https://api.openkey.ai/v1. Authentication: Authorization: Bearer <key>.

Endpoints

Endpoint Purpose
POST /chat/completions Chat completions, streaming and non-streaming
GET /models The full catalog with live pricing, as JSON
GET /models/{id}/endpoints Providers serving a model, with per-provider price/latency
GET /key Current key’s usage and limits

Chat completions

All standard OpenAI parameters are accepted; parameters a model doesn’t support are rejected with 400 invalid_request naming the parameter (not silently dropped). Each model page lists its supported parameters.

{
  "model": "anthropic/claude-sonnet-4.5",
  "messages": [{ "role": "user", "content": "..." }],
  "stream": true,
  "max_tokens": 1024,
  "temperature": 0.7,
  "tools": [],
  "response_format": { "type": "json_object" }
}
  • Streamingstream: true returns server-sent events, OpenAI chunk format, [DONE] terminated.
  • Tool calling — OpenAI tools schema. Models without tool support reject with 400.
  • Structured outputsresponse_format: json_schema on models that support it (listed per model page).
  • Vision / files — content parts (image_url, file) on multimodal models.
  • Reasoningreasoning: { "effort": "low" | "medium" | "high" } on reasoning models; reasoning tokens are billed as output tokens at the model’s output price.

Usage & billing in responses

Every response includes a usage object with token counts and the exact USD cost charged, fee included:

"usage": { "prompt_tokens": 412, "completion_tokens": 180, "cost_usd": 0.004120 }

What you’re charged is always provider_price × 1.03, per the pricing math.