AI-API

Klok AI-API

OpenAI-compatible chat API for Klok Integration models. Use it from OpenCode, the OpenAI SDK, or any client that speaks POST /v1/chat/completions.

You send an API_TOKEN and pick a model. Start with Kloker. Use Architect or Developer when the answer should follow how you already integrate.

Kloker is Klok's house model. We pick an open source model, try it with Klok skills and MCPs, and only then put it on the API. Today that model is Qwen 3.8 Flash Next. When a better one shows up, we switch.

Kloker runs on servers in Sweden, first and foremost on our own. If more capacity is needed, we only bring in another Swedish provider if you have approved it.

Skills are extra instructions. MCPs are extra tools the agent can call. The platform team checks that Kloker works well with our specific set of instructions, tools and utilities.

We use this same service ourselves to write documentation, model data, and build integrations. You call it like OpenAI, so you can plug it into your own agents or extend the Klok agent flow.

Two model types

Kloker

Everyday model

Cheap, and it starts blank. Your systems are not pre-loaded. Klok chooses the open source model behind it and tests it with our skills and MCPs. Current pick: Qwen 3.8 Flash Next.

It also sees images. If the request has an image, the same model reads it together with your question.

API model: Kloker

Environment and Klok best practices

Architect and Developer

These models know your integration environment and Klok best practices. Architect is opinionated about structure. Developer is opinionated about implementation.

  • Server-side tools for ecosystem lookup. The client does not execute extra tool_calls for those.
  • A system-prompt injection that steers answers toward Klok integration best practices: data contracts, CloudEvents, event-driven flows.

The gateway appends that injection. It does not drop a client role: system message. OpenCode sends its own agent instructions and tools. Those still have to reach the model.

API modelOpenCode IDType
Klokerklokintegration/KlokerEveryday model
Kloker-Integration-Architectklokintegration/Kloker-Integration-ArchitectEnvironment and Klok best practices
Kloker-Integration-Developerklokintegration/Kloker-Integration-DeveloperEnvironment and Klok best practices

Endpoint

Base URL:

https://ai.klok.ipaas.se/proxy/kloker-key/v1

The earlier base URL, https://api-gw.klok.ipaas.se/proxy/kloker-key/v1, keeps working and reaches the same service.

MethodPathPurpose
POST/chat/completionsChat completions (OpenAI shape)
GET/modelsList models, if enabled on the key

Authentication

Already on klokintegration.se? Create API keys there. You do not wait for us.

Not on the platform yet? Email klokintegration@integrera.com and ask for a token.

Send the token as a Bearer header. OpenCode and the OpenAI SDK do the same:

Authorization: Bearer $API_TOKEN

The same token is accepted as:

x-api-key: $API_TOKEN

Do not commit tokens. Rotate a key if it has been pasted into a client screenshot or chat.

Chat completions

curl https://ai.klok.ipaas.se/proxy/kloker-key/v1/chat/completions \
  -H "Authorization: Bearer $API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "Kloker",
    "messages": [
      {"role": "user", "content": "What does Klok Integration do?"}
    ]
  }'

Documents

Long documents go to https://ai.klok.ipaas.se/v1/documents instead, with the same token. Kloker reads a PDF, Word, ODT or PowerPoint file, an EPUB, MOBI, AZW3 or FB2 e-book, a batch of images, or an MP3 or WAV recording into text, page by page in parallel, and describes pictures and charts on the way. The text is kept by the file's hash, 90 days by default, so running new prompts later does not read the file again. A prompt runs on the whole text, however long it is.

# 1. Upload the file (kept seven days)
curl https://ai.klok.ipaas.se/v1/documents/uploads \
  -H "Authorization: Bearer $API_TOKEN" \
  -F file=@agreement.pdf

# 2. Read it and ask about it: 202 with a taskId
curl https://ai.klok.ipaas.se/v1/documents/read \
  -H "Authorization: Bearer $API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "inputs": [{"claimCheckUri": "<claimCheckUri from the upload>", "fileName": "agreement.pdf"}],
    "prompts": [{"promptId": "summary", "text": "Summarize the parties, the term and the prices."}]
  }'

# 3. Follow the task, then take the result
curl https://ai.klok.ipaas.se/v1/documents/tasks/$TASK_ID -H "Authorization: Bearer $API_TOKEN"
curl https://ai.klok.ipaas.se/v1/documents/tasks/$TASK_ID/result -H "Authorization: Bearer $API_TOKEN"

Reading options include a prompt per page (read.itemPrompts), the model of the reading and of each prompt, and how long to keep the text (retentionDays).

Fill in a form

Give a JSON Schema and, where you like, a prompt per field or per group of fields. Kloker fills in the document with structured output, turns each value into its type, says where in the document it found it, and validates the result against your schema.

curl https://ai.klok.ipaas.se/v1/documents/extract \
  -H "Authorization: Bearer $API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "inputs": [{"claimCheckUri": "<claimCheckUri from the upload>", "fileName": "invoice.pdf"}],
    "extraction": {
      "jsonSchema": "{\"type\":\"object\",\"properties\":{\"invoiceNumber\":{\"type\":\"string\"},\"total\":{\"type\":\"number\"},\"dueDate\":{\"type\":\"string\",\"format\":\"date\"}}}",
      "fields": [{"path": "/total", "prompt": "The amount to pay, VAT included"}]
    }
  }'

OpenCode

Set API_TOKEN. After the models.dev catalog ships, /connect lists klokintegration.se. Until then, use the provider block in examples/opencode.jsonc.

Pricing

Usage is billed per million tokens, excl. VAT, the same for every customer. Every input token counts, at one constant low price: there is no cached tier. Reading a document is billed the same way, for each page or image read. A recording has no tokens to count, so reading audio is billed per minute, and a prompt on its text per token.

InputOutputAudio
€0.20 / M · SEK 3 / M€1 / M · SEK 12 / M€0.03 / min · SEK 0.30 / min

Platform customers create keys in the product.