Chat Completions
Send messages to the Staffify KI 1.0 model and get a response back. The API mirrors OpenAI's chat completions endpoint one-to-one, so you can use the official OpenAI SDK by swapping only api_key and base_url.
The model
staffify-ki-1.0Fast, versatile chat model with vision and tool calling. Ideal for chatbots, agents and content generation. 128k context window.
Input pricing
€0.552 / 1M tokens
Output pricing
€2.208 / 1M tokens
Context
128k
Max output
16,384
Vision
yes
Tools
yes
Quick start
Use the official OpenAI SDK. Only two lines change compared to a normal OpenAI setup.
curl https://api.staffifyai.com/api/v1/chat/completions \
-H "Authorization: Bearer sfy_live_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "staffify-ki-1.0",
"messages": [
{ "role": "user", "content": "Say hi in one word." }
]
}'/api/v1/chat/completionsCreates a model response for the given chat conversation. The full OpenAI request body shape is supported — any parameter not listed below is forwarded to the upstream model untouched.
| Field | Type | Required | Description |
|---|---|---|---|
| model | string | Must be "staffify-ki-1.0". Any other value returns 400 UNSUPPORTED_MODEL. | |
| messages | array | Chat history. Roles: system, user, assistant, tool. Content can be a string or an array of parts (text + image_url for vision). | |
| stream | boolean | optional | If true, chunks are sent as Server-Sent Events. Usage counts arrive in the final chunk. |
| temperature | number | optional | 0–2, default 1. Higher = more random. |
| top_p | number | optional | 0–1, default 1. Nucleus sampling. |
| max_tokens | integer | optional | Cap on output tokens. Used for the credits pre-check (worst case). |
| max_completion_tokens | integer | optional | Alias for max_tokens. Takes precedence if both are provided. |
| tools | array | optional | OpenAI-format function tool definitions. |
| tool_choice | string | object | optional | "auto" | "none" | { type: "function", function: { name } } |
| response_format | object | optional | { type: "json_object" } or { type: "json_schema", ... } for structured output. |
| seed | integer | optional | Best-effort deterministic sampling. |
| stop | string | string[] | optional | Up to 4 stop sequences. |
| n | integer | optional | Number of completions to generate. Default 1. |
| logprobs | boolean | optional | Return log probabilities of the output tokens. |
| presence_penalty | number | optional | -2 to 2, default 0. |
| frequency_penalty | number | optional | -2 to 2, default 0. |
| user | string | optional | End-user identifier for abuse monitoring on your side. |
Example response (non-stream)
{
"id": "chatcmpl-9a1B2c3D4e...",
"object": "chat.completion",
"created": 1751812345,
"model": "staffify-ki-1.0",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "Hi!"
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 12,
"completion_tokens": 2,
"total_tokens": 14
}
}Streaming
Set stream: true to receive chunks as they are generated. Frames follow the OpenAI SSE format — data: {...} lines separated by blank lines, ending with data: [DONE]. Token usage is included in the final chunk before [DONE].
curl -N https://api.staffifyai.com/api/v1/chat/completions \
-H "Authorization: Bearer sfy_live_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "staffify-ki-1.0",
"messages": [{ "role": "user", "content": "Count from 1 to 5." }],
"stream": true
}'Vision
Send images as content parts alongside text. Either an HTTPS URL or a base64 data URL.
curl https://api.staffifyai.com/api/v1/chat/completions \
-H "Authorization: Bearer sfy_live_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "staffify-ki-1.0",
"messages": [{
"role": "user",
"content": [
{ "type": "text", "text": "What is in this image?" },
{ "type": "image_url", "image_url": { "url": "https://example.com/photo.jpg" } }
]
}]
}'Function calling (tools)
Define tools in OpenAI format. The assistant may reply with tool_calls instead of content. Send the tool result back as a role: "tool" message and call the endpoint again to continue.
curl https://api.staffifyai.com/api/v1/chat/completions \
-H "Authorization: Bearer sfy_live_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "staffify-ki-1.0",
"messages": [{ "role": "user", "content": "What is the weather in Amsterdam?" }],
"tools": [{
"type": "function",
"function": {
"name": "get_weather",
"description": "Get current weather for a city",
"parameters": {
"type": "object",
"properties": { "city": { "type": "string" } },
"required": ["city"]
}
}
}]
}'JSON mode & structured output
Force the model to return valid JSON, optionally matching a JSON Schema.
curl https://api.staffifyai.com/api/v1/chat/completions \
-H "Authorization: Bearer sfy_live_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "staffify-ki-1.0",
"messages": [{ "role": "user", "content": "Return the JSON object { \"ok\": true }" }],
"response_format": { "type": "json_object" }
}'/api/v1/modelsReturns the list of models available on this API. Currently a single entry.
{
"object": "list",
"data": [{
"id": "staffify-ki-1.0",
"object": "model",
"owned_by": "staffify",
"display_name": "Staffify KI 1.0",
"context_window": 128000,
"max_output_tokens": 16384,
"supports_vision": true,
"supports_tools": true,
"supports_json_mode": true,
"input_cost_per_million_tokens_eur": 0.552,
"output_cost_per_million_tokens_eur": 2.208
}]
}Billing
Every request is deducted from your Staffify credits wallet based on the actual token usage reported by the model.
- A pre-check runs before the request: if worst-case cost (input + max_tokens output) exceeds your balance, you get
402 INSUFFICIENT_CREDITS. - The actual deduct happens post-response, on
usage.prompt_tokensandusage.completion_tokensreturned by the model. - For streaming requests, usage arrives in the final chunk; billing is applied when the stream closes.
- Transactions appear in /api/v1/credits history with
type: "ai_completion".
Rate limits
Chat completions have their own limits, separate from the standard v1 REST limits. Every response includes X-AI-RateLimit-* headers.
| Tier | Requests / min | Concurrent |
|---|---|---|
| PAYG | 60 | 5 |
| Starter | 200 | 15 |
| Growth | 500 | 40 |
| Scale | 1,000 | 80 |
| Enterprise | Unlimited | Unlimited |
Errors
| Code | HTTP | Description |
|---|---|---|
| MISSING_API_KEY | 401 | No Authorization or X-Api-Key header provided. |
| INVALID_API_KEY | 401 | API key not found, revoked, or malformed. |
| INSUFFICIENT_CREDITS | 402 | Worst-case request cost exceeds wallet balance, or wallet is paused. |
| WALLET_MISSING | 402 | No credits wallet exists for this org (contact support). |
| UNSUPPORTED_MODEL | 400 | model must be "staffify-ki-1.0". |
| INVALID_MESSAGES | 400 | messages missing or not a non-empty array. |
| AI_RATE_LIMIT_EXCEEDED | 429 | Per-minute request limit exceeded for this tier. |
| AI_CONCURRENT_LIMIT_EXCEEDED | 429 | Too many simultaneous in-flight requests — reduce parallelism. |
| UPSTREAM_ERROR | 502 | Upstream provider returned an error and no fallback was available. |
Good to know
- The response
modelfield always echoes back"staffify-ki-1.0". Internal provider names are never exposed. - High-availability failover is built-in. If the primary upstream fails, requests are transparently routed to a fallback provider. Some advanced parameters (
response_format,seed,logprobs) are best-effort during a failover event and may be ignored. - The base URL is
https://api.staffifyai.com/api/v1. When configuring an OpenAI SDK, that value goes into thebase_url/baseURLfield.