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

# API quickstart

> Point an OpenAI or Anthropic SDK at Kubox and send your first request.

Kubox speaks both the OpenAI and the Anthropic API. If you already call either one, change the base URL and the key. Nothing else.

## Get a key

<Steps>
  <Step title="Sign in to the console">
    Open [app.kubox.cloud](https://app.kubox.cloud) and sign in.
  </Step>

  <Step title="Add credits">
    Usage is billed per token against your credit balance.
  </Step>

  <Step title="Create a key">
    Create a key under **Gateway**. It starts with `kbx_live_` and is shown once — copy it before you close the dialog.

    Give each app its own key. You can revoke one key without touching the others, set a spending limit on each, and see which key made every request.
  </Step>
</Steps>

<Warning>
  Treat the key like a password. Pass it in an environment variable — never commit it.

  ```bash theme={null}
  export KUBOX_API_KEY="kbx_live_..."
  ```
</Warning>

## Send a request

The base URL is `https://api.kubox.cloud/v1`.

<CodeGroup>
  ```bash curl theme={null}
  curl https://api.kubox.cloud/v1/chat/completions \
    -H "Authorization: Bearer $KUBOX_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "model": "gpt-oss-120b",
      "messages": [{"role": "user", "content": "Say hello in one sentence."}]
    }'
  ```

  ```python OpenAI SDK theme={null}
  from openai import OpenAI

  client = OpenAI(
      base_url="https://api.kubox.cloud/v1",   # changed
      api_key=os.environ["KUBOX_API_KEY"],     # changed
  )

  response = client.chat.completions.create(
      model="gpt-oss-120b",
      messages=[{"role": "user", "content": "Say hello in one sentence."}],
  )
  print(response.choices[0].message.content)
  ```

  ```python Anthropic SDK theme={null}
  from anthropic import Anthropic

  client = Anthropic(
      base_url="https://api.kubox.cloud",      # changed
      api_key=os.environ["KUBOX_API_KEY"],     # changed
  )

  message = client.messages.create(
      model="gpt-oss-120b",
      max_tokens=256,
      messages=[{"role": "user", "content": "Say hello in one sentence."}],
  )
  print(message.content[0].text)
  ```

  ```javascript Node theme={null}
  import OpenAI from "openai";

  const client = new OpenAI({
    baseURL: "https://api.kubox.cloud/v1",     // changed
    apiKey: process.env.KUBOX_API_KEY,         // changed
  });

  const response = await client.chat.completions.create({
    model: "gpt-oss-120b",
    messages: [{ role: "user", content: "Say hello in one sentence." }],
  });
  console.log(response.choices[0].message.content);
  ```
</CodeGroup>

The two commented lines are the whole migration. Streaming, tool calls, and the response shapes are unchanged.

## Which models can I call?

The catalogue changes, so read it from the endpoint rather than this page:

```bash theme={null}
curl https://api.kubox.cloud/v1/models \
  -H "Authorization: Bearer $KUBOX_API_KEY"
```

Hosting differs per model. Some run on SCX infrastructure in Australia — check the location shown on the model you pick, rather than assuming it applies to the whole catalogue. Those are [SCX's](https://scx.ai) claims about their own platform.

## Choosing between the two APIs

Both routes reach the same models. Pick the one your code already uses.

| | OpenAI-compatible | Anthropic-compatible |
| - | - | - |
| Path | `/v1/chat/completions` | `/v1/messages` |
| Auth header | `Authorization: Bearer` | `x-api-key` or `Authorization: Bearer` |
| Error envelope | OpenAI's | Anthropic's |
| Streaming | SSE chunks | `message_start` / `message_delta` events |

<Note>
  The Anthropic SDKs send `x-api-key` rather than an `Authorization` header, so `/v1/messages` accepts both. It is the same Kubox key either way.
</Note>

## What else the endpoint does

<CardGroup cols={2}>
  <Card title="Embeddings" icon="vector-square" href="/reference/api/create-embeddings">
    OpenAI-compatible embeddings, billed on input tokens.
  </Card>

  <Card title="Transcription" icon="microphone" href="/reference/api/create-transcription">
    Speech to text. Send `multipart/form-data` with a file and a model id.
  </Card>

  <Card title="Speech" icon="volume-high" href="/reference/api/create-speech">
    Text to speech, returned as binary audio.
  </Card>

  <Card title="Models" icon="list" href="/reference/api/list-models">
    The full catalogue available to your key.
  </Card>
</CardGroup>

## Running it in your own boundary

Inference is one of three Kubox products. Run Kubernetes clusters in your own AWS account with a [management plane](/concepts/management-plane), or give coding agents a sandbox with [Coding Sessions](https://kubox.ai/coding-sessions).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.