> For the complete documentation index, see [llms.txt](https://docs.kontinent.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.kontinent.ai/reference/api-reference.md).

# API reference

## Interactive OpenAPI reference

The operations below are generated from the canonical OpenAPI specification. Use **Test it** to build and send a real request, inspect every field, and view the documented response and error schemas.

{% hint style="warning" %}
Testing an authenticated endpoint sends a real request and may consume credits.
{% endhint %}

### Create a chat completion

{% openapi src="<https://openapi.gitbook.com/o/Vw6A4MslJqK6lSyRGgOt/spec/kontinent-api.yaml>" path="/v1/chat/completions" method="post" %}
<https://openapi.gitbook.com/o/Vw6A4MslJqK6lSyRGgOt/spec/kontinent-api.yaml>
{% endopenapi %}

### Create a response

{% openapi src="<https://openapi.gitbook.com/o/Vw6A4MslJqK6lSyRGgOt/spec/kontinent-api.yaml>" path="/v1/responses" method="post" %}
<https://openapi.gitbook.com/o/Vw6A4MslJqK6lSyRGgOt/spec/kontinent-api.yaml>
{% endopenapi %}

### Create embeddings

{% openapi src="<https://openapi.gitbook.com/o/Vw6A4MslJqK6lSyRGgOt/spec/kontinent-api.yaml>" path="/v1/embeddings" method="post" %}
<https://openapi.gitbook.com/o/Vw6A4MslJqK6lSyRGgOt/spec/kontinent-api.yaml>
{% endopenapi %}

### List models

{% openapi src="<https://openapi.gitbook.com/o/Vw6A4MslJqK6lSyRGgOt/spec/kontinent-api.yaml>" path="/v1/models" method="get" %}
<https://openapi.gitbook.com/o/Vw6A4MslJqK6lSyRGgOt/spec/kontinent-api.yaml>
{% endopenapi %}

### Check service health

{% openapi src="<https://openapi.gitbook.com/o/Vw6A4MslJqK6lSyRGgOt/spec/kontinent-api.yaml>" path="/healthz" method="get" %}
<https://openapi.gitbook.com/o/Vw6A4MslJqK6lSyRGgOt/spec/kontinent-api.yaml>
{% endopenapi %}

## Conventions

* **Model ids** are `provider/model`, e.g. `mistral/mistral-large-latest`.
* **Money** is integer micro-EUR (1 EUR = 1,000,000 µEUR), quoted per million tokens.
* **Request bodies** are capped at 2 MiB.

## Guides and examples

### Chat completion

{% tabs %}
{% tab title="TypeScript" %}

```typescript
const res = await client.chat.completions.create({
  model: "mistral/mistral-large-latest",
  messages: [{ role: "user", content: "Hallo!" }],
});
```

{% endtab %}

{% tab title="Python" %}

```python
res = client.chat.completions.create(
    model="mistral/mistral-large-latest",
    messages=[{"role": "user", "content": "Hallo!"}],
)
```

{% endtab %}

{% tab title="curl" %}

```bash
curl https://api.kontinent.ai/v1/chat/completions \
  -H "Authorization: Bearer $KONTINENT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"mistral/mistral-large-latest",
       "messages":[{"role":"user","content":"Hallo!"}]}'
```

{% endtab %}
{% endtabs %}

Streaming works the same way with `"stream": true`. See [Streaming](/features/streaming.md).

Tool calling works on every chat model, streaming and non-streaming: send `tools` (function tools) with an optional `tool_choice` and `parallel_tool_calls`, and the model answers with `message.tool_calls` (or `delta.tool_calls` while streaming) and `finish_reason: "tool_calls"`. Continue the loop by sending the assistant turn back with its `tool_calls`, followed by one `{"role": "tool", "tool_call_id": "...", "content": "..."}` message per call; on a reasoning model, replay that turn's `reasoning_details` as well.

A tool definition travels whole, `strict` and the JSON Schema in `parameters` included. Nothing tool-related is silently dropped on a path that rebuilds the request: Claude via Bedrock or Vertex, and `/v1/responses`. There the request is refused with a `400` naming the field when an upstream cannot express a value: `tool_choice: "none"` and `parallel_tool_calls: false` on Claude via Bedrock, forcing a tool call (`"required"` or a named function) together with `reasoning` on either Claude path, and hosted tools such as web search or MCP, because this gateway runs no tools of its own. On an OpenAI-compatible model the request is passed through untouched instead, so a tool the provider rejects comes back as that provider's own error. See [Streaming](/features/streaming.md) for the delta shape.

Reasoning models take a `reasoning` object and answer with `message.reasoning` and/or `message.reasoning_details`. Neither field is guaranteed: `reasoning.exclude: true` removes both, and thinking that a provider only returns encrypted arrives as a `reasoning_details` entry with **no** `message.reasoning` at all, because there is no plaintext. Treat both as optional. See [Reasoning](/features/reasoning.md).

### Responses

The same models, OpenAI's Responses shape. `input` takes a string or a list of input items, `max_output_tokens` replaces `max_tokens`, and the reply is a `response` object whose `output` array holds `reasoning` and `message` items.

```bash
curl https://api.kontinent.ai/v1/responses \
  -H "Authorization: Bearer $KONTINENT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"bedrock/claude-sonnet-5","input":"Hallo!",
       "reasoning":{"effort":"high"}}'
```

With `"stream": true` you get named events, each with a monotonic `sequence_number`: `response.created`, `response.output_item.added`, `response.reasoning_text.delta`, `response.reasoning_text.done`, `response.content_part.added`, `response.output_text.delta`, `response.output_text.done`, `response.content_part.done`, `response.function_call_arguments.delta`, `response.function_call_arguments.done`, `response.output_item.done`, `response.completed` — or `response.failed` when a generation breaks after the first byte. Item and content-part events are paired (added/done), so a client can close what it opened.

Tools work here too, in the flattened Responses shape: `tools: [{"type": "function", "name": "...", "parameters": {...}}]`, with `tool_choice` and `parallel_tool_calls`. A call comes back as a `function_call` output item (`call_id`, `name`, `arguments`), and the loop continues by replaying it in `input` as a `function_call` item followed by a `function_call_output` item with the same `call_id`. On a reasoning model, replay the `reasoning` output item that preceded the call as well, `reasoning_details` and all: Claude verifies its own thinking and rejects a tool loop that comes back without it. The refusals are the ones chat completions make, named the same way.

{% hint style="warning" %}
This endpoint is **stateless**. `store: true` and `previous_response_id` are rejected with `400` — Kontinent retains no prompts or completions, so a stored response could never be read back. Send the previous turns in `input` instead.
{% endhint %}

### Embeddings

```bash
curl https://api.kontinent.ai/v1/embeddings \
  -H "Authorization: Bearer $KONTINENT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"mistral/mistral-embed","input":"Hallo!"}'
```

Sending a chat model here (or an embeddings model to the chat endpoint) is rejected.

### List models

{% tabs %}
{% tab title="TypeScript" %}

```typescript
const models = await client.models.list();
```

{% endtab %}

{% tab title="Python" %}

```python
models = client.models.list()
```

{% endtab %}

{% tab title="curl" %}

```bash
curl https://api.kontinent.ai/v1/models \
  -H "Authorization: Bearer $KONTINENT_API_KEY"
```

{% endtab %}
{% endtabs %}

Returns only the models your organization can call, each with `kind`, `context_length`, `sovereignty`, `pricing`, and — for models that think — a `reasoning` object (`supported_efforts`, `default_effort`, `supports_max_tokens`, `mandatory`). See [Models & sovereignty](/models-and-routing/models.md).

### Health

```bash
curl https://api.kontinent.ai/healthz
```

Unauthenticated liveness probe. Use it for uptime monitoring, not for model availability.

## Related

{% content-ref url="/pages/bL1Oxi0LjKZ8LARuwJ8R" %}
[Limits & conventions](/reference/limits.md)
{% endcontent-ref %}

{% content-ref url="/pages/e4XLAToYQziKWGuYMiZu" %}
[Handling errors](/features/errors.md)
{% endcontent-ref %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.kontinent.ai/reference/api-reference.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
