# Documentation

Learn how to set up and get the most out of Viktor.

If your application already talks to OpenAI or Anthropic, you can point it at Viktor and get an AI employee instead of a bare model. The compatible API accepts the standard Chat Completions, Responses, and Messages wire formats and runs a full Viktor agent behind them — with access to your connected tools.

- **OpenAI-style base URL:** `https://api.viktor.com/api/compat/v1`
- **Anthropic-style base URL:** `https://api.viktor.com/api/compat`
- **Model ID:** `viktor`
- **Authentication:** the same [Viktor API keys](/content/docs/public-api/index.html), with the `chat:completions` scope granted.

## Quickstart

Grant the `chat:completions` scope to a key in [Settings → API Keys](https://app.viktor.com/settings/api-keys), then swap the base URL, API key, and model in your existing code:

```
from openai import OpenAI

client = OpenAI(
    base_url="https://api.viktor.com/api/compat/v1",
    api_key="zt_live_sk_...",
)

completion = client.chat.completions.create(
    model="viktor",
    messages=[
        {"role": "user", "content": "Summarize yesterday's Stripe payouts."}
    ],
)
print(completion.choices[0].message.content)
```

The Anthropic SDK works the same way with `base_url="https://api.viktor.com/api/compat"`.

## Endpoints

| Method | Endpoint | Protocol |
| --- | --- | --- |
| `POST` | `/api/compat/v1/chat/completions` | OpenAI Chat Completions |
| `POST` | `/api/compat/v1/responses` | OpenAI Responses |
| `POST` | `/api/compat/v1/messages` | Anthropic Messages |
| `POST` | `/api/compat/v1/messages/count_tokens` | Anthropic token counting |
| `GET` | `/api/compat/v1/models` | Model listing (returns `viktor`) |

Streaming is supported on all three chat surfaces.

## How it differs from a bare model

- **Each call runs the Viktor agent**, not a single model invocation. Viktor can use your connected integrations and skills while producing the reply, so calls take longer than a plain LLM call and are capped at 10 minutes.
- **Conversation state:** Chat Completions and Anthropic Messages are stateless — send the full message history on each call, as you would with the upstream APIs. The Responses surface supports `previous_response_id` to continue a server-side conversation across calls.
- **System messages are appended** to Viktor's own system prompt, never substituted, so Viktor stays Viktor.
- **Structured output** via `response_format` with a JSON Schema is supported, as are tool declarations.
- **Credits:** each call consumes workspace credits like any other Viktor run. See [how credits work](/content/help/category/credits/how-credits-work/index.html).
- **Rate limits:** requests are limited per route and per key owner (all keys of the same owner share one quota), and the limits scale with your workspace plan tier — higher plans get proportionally higher limits. A `429` includes `Retry-After`; wait for the advertised interval before retrying. See [rate limits and retries](/content/docs/public-api#rate-limits-and-retries/index.html).

## When to use which API

- Use this compatible API when you have existing OpenAI or Anthropic client code and want a drop-in upgrade.
- Use the [Public API](/content/docs/public-api/index.html) when you want explicit threads, runs you can poll or cancel, and downloadable file artifacts.
- Use the [MCP server](/content/docs/mcp-server/index.html) when the caller is itself an AI agent.
