# Coding (Beta) API reference

> Account, models and streamed completions for coding clients. Beta. Needs a personal key with coding:read or coding:complete; an organisation integration key gets 403 integration_not_permitted.

Request and response schemas, with examples, are in the OpenAPI document: https://developers.komplai.dk/openapi.json

## GET /v1/coding/account

**Read the coding account** (Beta)

Your organisation, the current terms as contract, where a coding call's data goes, the organisation's monthly AI spending cap and this month's use (in balance, a name kept for installed clients), the default model and the coding models with the provider's prices. Read it before the first completion and whenever a completion answers 409 terms_changed, and show the terms to the person before they connect. It sends no text and runs no model. Needs a personal key with coding:read.

- Operation id: `readCodingAccount`
- Scopes: `coding:read`
- Responses: 200, 401, 403, 429, 503

## GET /v1/coding/models

**List the coding models** (Beta)

The models a coding client may use, with their limits and the provider's prices, in the OpenAI list shape, and the account without its models. Needs a personal key with coding:read.

- Operation id: `listCodingModels`
- Scopes: `coding:read`
- Responses: 200, 401, 403, 429, 503

## POST /v1/coding/chat/completions

**Stream a coding completion** (Beta)

An OpenAI-compatible chat completion for coding clients, streamed as server-sent events, with text and function calls. komplai never runs a tool: the client runs it, asks the person where needed, and sends the result in the next request. The model runs in komplai's EU cloud on your organisation's approved route. Before the provider is called, the most the call can cost is reserved under the organisation's monthly AI spending cap; usage is metered at the provider's price, and calls stop when the cap, the organisation's own limit or your personal limit is reached. komplai stores no prompts, answers or tool results, only the call's metadata. Send X-Komplai-Contract with the current contract and X-Request-Id with a new UUID for each operation. Needs a personal key with coding:complete.

- Operation id: `createCodingChatCompletion`
- Scopes: `coding:complete`
- Parameters: `X-Komplai-Contract` (header, required), `X-Request-Id` (header, required)
- Responses: 200, 400, 401, 403, 409, 413, 415, 429, 502, 503, 504

---

https://developers.komplai.dk/reference/coding
