API Reference
Completions
POST /v1/completions
POST /v1/completionsOpenAI-compatible text completions. Supports streaming.
Request
| Field | Type | Required | Description |
|---|---|---|---|
model | string | Yes | Your Carrot model name |
prompt | string | Yes | Text prompt to complete |
stream | boolean | No | Stream response as SSE. Default: false |
max_tokens | integer | No | Maximum tokens to generate |
Example
curl https://api.carrotlabs.ai/v1/completions \
-H "Authorization: Bearer sk-..." \
-H "Content-Type: application/json" \
-d '{
"model": "my-custom-model",
"prompt": "The meaning of life is",
"max_tokens": 100
}'Errors
| Status | Meaning |
|---|---|
401 | Invalid or missing API key |
404 | Model not found |
502 | Inference provider temporarily unavailable |