Goal: send one non-streaming chat completion in about five minutes.

Prerequisites

  1. API key — create in the console (see API keys).
  2. Base URLhttps://51kik.com/v1 for OpenAI-compatible calls (Base URL and environments).
  3. Model id — list the catalog without auth:
curl -sS "https://51kik.com/v1/models" | head -c 2000

Use an entry's id as model (your catalog may differ).

Step 1 — set environment variables

export API_KEY="YOUR_API_KEY"
export MODEL_ID="YOUR_MODEL_ID_FROM_CATALOG"

Never commit keys. Use secrets in CI (see Configuration from env).

Step 2 — call chat completions

curl -sS "https://51kik.com/v1/chat/completions" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -H "x-trace-id: quickstart-$(date +%s)" \
  -d "{
    \"model\": \"$MODEL_ID\",
    \"messages\": [{ \"role\": \"user\", \"content\": \"Reply with exactly: ok\" }]
  }"

x-trace-id is optional; it helps support and usage correlation (Request correlation).

Step 3 — verify the response

On 200, the body follows OpenAI shape, for example:

{
  "id": "chatcmpl-...",
  "object": "chat.completion",
  "choices": [
    {
      "message": { "role": "assistant", "content": "ok" },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 0,
    "completion_tokens": 0,
    "total_tokens": 0
  }
}

Token counts come from the upstream provider.

Common failures

HTTPWhat to check
401Missing, wrong, or expired API key
403Model not allowed, balance, IP allow list
400Invalid JSON or messages / model
429Rate limit — back off (Rate limits)

See Errors for the full matrix.

Next steps