API Docs

One line to get started.

Autark is a drop-in replacement for the OpenAI API. Point your existing SDK at our base URL, swap your API key, and keep everything else the same. We route each request to the right model behind the scenes.

Base URLhttps://api.autark.ai/v1
AuthAuthorization: Bearer autark_sk_...

Get an API key from cloud.autark.ai. Usage and savings show up in your dashboard.

Quick start

Works with the official OpenAI SDKs. No custom headers, no provider config.

from openai import OpenAI

client = OpenAI(
    api_key="autark_sk_YOUR_KEY",
    base_url="https://api.autark.ai/v1",
)

response = client.chat.completions.create(
    model="auto",
    messages=[{"role": "user", "content": "Summarize this contract..."}],
)

print(response.choices[0].message.content)
// Same request shape as OpenAI. Routing happens on our side.

Routing modes

Set the model field to control how Autark handles each request. Use auto unless you have a reason not to.

auto

Auto

Autark classifies each request and routes it to the best model for the job. This is what most teams should use.

flash

Flash

Fast, cheap inference for simple queries, classification, and high-throughput workloads.

pro

Pro

The default for chat, agents, and everyday workloads. Good balance of quality and cost.

ultra

Ultra

For hard reasoning, multi-step tasks, and anything where quality matters more than speed.

You can also pin a specific provider model by name if you need to. Autark still handles auth, failover, and billing. See pricing for tier rates.

Streaming

Streaming works the same way as OpenAI. Pass "stream": true and read Server-Sent Events from the response.

stream = client.chat.completions.create(
    model="auto",
    messages=[{"role": "user", "content": "Write a short poem."}],
    stream=True,
)

for chunk in stream:
    delta = chunk.choices[0].delta.content
    if delta:
        print(delta, end="", flush=True)
// Standard SSE stream. No changes to your client code.

Response format

Responses follow the standard OpenAI chat completion shape. The model field in the response matches what you sent. Routing details stay on our side.

{
  "id": "autark_req_abc123",
  "object": "chat.completion",
  "model": "auto",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "Here is a summary of the contract..."
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 142,
    "completion_tokens": 58,
    "total_tokens": 200
  }
}
// Token counts and savings breakdown live in your dashboard.

Endpoints

POST/v1/chat/completions

Create a chat completion. OpenAI-compatible request and response.

GET/v1/models

List models available through Autark.

GET/v1/usage

Current token usage and estimated savings for your account.

GET/health

Health check with provider status.

Data and security

Prompts are processed and discarded. We do not retain request content or use it for training. Compliance metadata (timestamps, model used, token counts) is logged separately from your prompt data.

For the full breakdown, see our trust page.