Skip to main content
Docs/API Reference/Chat Completions
API ReferenceOpenAI-compatible

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.0staffify-ki-1.0

Fast, 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." }
    ]
  }'
POST/api/v1/chat/completions

Creates 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.

FieldTypeRequiredDescription
modelstringrequiredMust be "staffify-ki-1.0". Any other value returns 400 UNSUPPORTED_MODEL.
messagesarrayrequiredChat history. Roles: system, user, assistant, tool. Content can be a string or an array of parts (text + image_url for vision).
streambooleanoptionalIf true, chunks are sent as Server-Sent Events. Usage counts arrive in the final chunk.
temperaturenumberoptional0–2, default 1. Higher = more random.
top_pnumberoptional0–1, default 1. Nucleus sampling.
max_tokensintegeroptionalCap on output tokens. Used for the credits pre-check (worst case).
max_completion_tokensintegeroptionalAlias for max_tokens. Takes precedence if both are provided.
toolsarrayoptionalOpenAI-format function tool definitions.
tool_choicestring | objectoptional"auto" | "none" | { type: "function", function: { name } }
response_formatobjectoptional{ type: "json_object" } or { type: "json_schema", ... } for structured output.
seedintegeroptionalBest-effort deterministic sampling.
stopstring | string[]optionalUp to 4 stop sequences.
nintegeroptionalNumber of completions to generate. Default 1.
logprobsbooleanoptionalReturn log probabilities of the output tokens.
presence_penaltynumberoptional-2 to 2, default 0.
frequency_penaltynumberoptional-2 to 2, default 0.
userstringoptionalEnd-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" }
  }'
GET/api/v1/models

Returns 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_tokens and usage.completion_tokens returned 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.

TierRequests / minConcurrent
PAYG605
Starter20015
Growth50040
Scale1,00080
EnterpriseUnlimitedUnlimited

Errors

CodeHTTPDescription
MISSING_API_KEY401No Authorization or X-Api-Key header provided.
INVALID_API_KEY401API key not found, revoked, or malformed.
INSUFFICIENT_CREDITS402Worst-case request cost exceeds wallet balance, or wallet is paused.
WALLET_MISSING402No credits wallet exists for this org (contact support).
UNSUPPORTED_MODEL400model must be "staffify-ki-1.0".
INVALID_MESSAGES400messages missing or not a non-empty array.
AI_RATE_LIMIT_EXCEEDED429Per-minute request limit exceeded for this tier.
AI_CONCURRENT_LIMIT_EXCEEDED429Too many simultaneous in-flight requests — reduce parallelism.
UPSTREAM_ERROR502Upstream provider returned an error and no fallback was available.

Good to know

  • The response model field 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 the base_url / baseURL field.
Chat Completions (Staffify KI 1.0) - Staffify API