API reference
Keiro exposes three authenticated completion surfaces at one public base URL:
On this page 1 of 6
https://api.keirolabs.ai/v1
Choose the wire format that already fits your application. The model and account determine which capabilities are available; the endpoint does not expose private routing or provider details.
Completion endpoints#
| Surface | Endpoint | Primary input | Generated text |
|---|---|---|---|
| Responses | POST /responses | input or typed input items | SDK output_text, or text parts in output |
| Chat Completions | POST /chat/completions | messages | choices[0].message.content |
| Messages | POST /messages | messages, with optional top-level system | Text blocks in content |
All three surfaces support buffered responses and server-sent event streams. Function tools and image input use the native content shape for each surface.
Discovery endpoint#
Use GET /v1/models with the same bearer authentication to list the public model IDs available to the current key. The result is account-scoped and can include effective static limits for each model.
See Models for a runnable request and model-selection guidance.
Utility endpoints#
Use POST /messages/count_tokens to size the prompt of a Messages request before sending it. A body the Messages endpoint accepts is counted the way the request is billed: message text, tool definitions, tool history and the same per-part minimums for images and documents that admission and billing apply. See Messages.
Other operational routes reachable on the base URL — tool-output submission, stream resume, request cancel, and capability discovery — are not yet part of the documented public contract. Do not build against them until they appear in this reference.
Shared request contracts#
- Authenticate with
Authorization: Bearer <api-key>; see API auth. - Use only a model returned for the current key; see Models.
- Add
Idempotency-Keywhen retrying a logical operation must not execute it twice; see Idempotency. - Read request IDs and rate-limit headers for operational handling; see Rate and spend limits.
- Match failures on the machine-readable error
codeandtype, not message text; see Errors. - Streams carry documented per-effort time entitlements: a stream that is actively working is never ended before its effort tier's wall-clock ceiling; see Streaming.
Compatibility boundary#
Keiro is OpenAI-compatible where documented, but compatibility does not mean that every parameter from every SDK or vendor API is accepted. Unknown or unsupported fields fail closed under the current strict validation contract. Build against the fields documented for the selected surface and treat a capability error as a request or model-selection issue, not as permission to fall back silently.