> ## Documentation Index
> Fetch the complete documentation index at: https://docs.krun.ai/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Krun API base URL: https://api.krun.ai. Authenticate server-side with `Authorization: Bearer $KRUN_API_KEY`; never put a Krun API key in browser code.
> Prefer the Python SDK in examples: `pip install krun-ai`, `from krun import Krun`. The TypeScript SDK `@krun-ai/sdk` is not published on npm yet: do not tell users to `npm install` it.
> The only question type is `choice`. `confidence` is the top-1 minus top-2 probability margin, not the probability that the answer is correct. `choice` is null when `abstain` is true.
> Usage reports `input_tokens` only. There are no output tokens.

# API overview

> Base URL, endpoints, request ids and the OpenAPI specification of the Krun API.

The Krun API is a JSON-over-HTTPS API.

```text theme={null}
https://api.krun.ai
```

## Endpoints

| Method | Path                                      | Description                                   |
| ------ | ----------------------------------------- | --------------------------------------------- |
| `POST` | [`/v1/decide`](/api-reference/decide)     | Answer one or more questions about a context. |
| `POST` | [`/v1/feedback`](/api-reference/feedback) | Report whether an answer was correct.         |
| `GET`  | [`/v1/models`](/api-reference/models)     | List available models.                        |

All `/v1` endpoints require an API key. See [Authentication](/api-reference/authentication).

The API also serves `GET /health` for liveness checks and `GET /openapi.json`, both without authentication.

## OpenAPI specification

The API reference pages are generated from the live OpenAPI 3.1 specification:

```text theme={null}
https://api.krun.ai/openapi.json
```

Use it to generate clients or import the API into tools like Postman. Each endpoint page has an interactive playground: add your API key under **Authorization** to send real requests.

<Warning>
  Playground requests are real API calls: they use your quota and are sent through the documentation site's proxy. Use a key you can rotate, and never paste a key on a shared screen.
</Warning>

## Request ids

Every response has an `X-Request-ID` header. Successful `/v1/decide` responses don't repeat it in the body, and error bodies include it as `error.request_id`.

You can send your own `X-Request-ID` with a request: 1 to 128 characters of letters, digits, `.`, `_`, `:` and `-`. Krun keeps it and returns it. Otherwise it generates one like `req_0cf5441281f640ffbf0111c5a3ed9e50`.

Use the request id to [send feedback](/guides/feedback) and when you [contact support](/resources/support).

## Conventions

* Request and response bodies are JSON. Send `Content-Type: application/json`.
* Field names are `snake_case`. Your question ids and option ids are returned exactly as sent.
* Unknown fields in a request are rejected with `400 INVALID_REQUEST`.
* Request bodies are limited to 256 KiB.
* Errors share one format. See [Errors](/api-reference/errors).

## Versioning

The major version is part of the path (`/v1`). Changes that could break existing clients will ship under a new version. New optional fields can be added to `/v1` responses, so ignore fields you don't recognize.

The current specification version is `1.0.0-beta`: the API is in closed beta.
