Overview
How the API is organised: the base URL, the two API styles, the other endpoints and the conventions they share.
Base URL
Every endpoint is served over HTTPS under your API base URL: API_BASE_URL. The examples read it from a variable:
shell
export KEYDAN_API_KEY="YOUR_API_KEY"
export KEYDAN_API_BASE="API_BASE_URL"Two API styles
Use whichever format your code already speaks. Both reach the same models with the same keys, limits and prices.
| Style | Endpoint | Use it when |
|---|---|---|
| Messages API | POST /v1/messages | your client uses the Messages format: content blocks, system as a field, max_tokens required |
| Chat Completions API | POST /v1/chat/completions | your client uses the Chat Completions format: messages with roles, choices in the answer |
The model catalogue shows the styles each model can be called with.
Other endpoints
| Endpoint | What it does |
|---|---|
GET /v1/models | the models your key may use (model ids) |
GET /v1/billing/balance | your balance (balance and billing) |
GET /public/v1/models | the public catalogue with prices, no key needed |
GET /public/v1/plans | the subscription plans, no key needed |
GET /public/v1/status | the live status, no key needed (status page) |
GET /public/v1/status/history | the last 24 hours of each API format in half-hour steps, no key (the bars on the status page) |
Conventions
- Requests and answers are JSON in UTF-8; streamed answers are server-sent events.
- Every answer carries
x-request-id. Quote it when you contact support. - Errors have one shape per API style and a stable
error.code: see errors. - Request bodies have a size limit; a larger body is refused with
413. - The version is in the path (
/v1). Fields may be added to answers at any time; read them leniently.