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

# Quickstart

> Your first call to DeepSeek V4.1 Flash 1017 on OS3, in curl, Python and TypeScript.

> [!NOTE]
>
> Your first US$10 is on us: a new organisation gets US$10 of credit when OS3 sets it up. After that, add a card or buy credit in **Usage**. A call with no credit left and no card is refused with `402 payment_required`.

## Set up

Create a key in the portal (**Keys → Create key**) and keep it in a `.env` file, out of version control:

```bash .env theme={null}
OS3_GATEWAY_URL="https://gateway.os3compute.com"
OS3_GATEWAY_KEY="<your key: os3_gw_...>"
```

```bash curl theme={null}
set -a; source .env; set +a
```

```bash Python theme={null}
pip install openai anthropic
set -a; source .env; set +a
python quickstart.py
```

```bash TypeScript theme={null}
npm install openai @anthropic-ai/sdk
# Node.js 22.18 or later
node --env-file=.env quickstart.mts
```

## Send a chat completion

Your key is the API key; the model is its id.

```bash curl theme={null}
curl -sS --fail-with-body "$OS3_GATEWAY_URL/v1/chat/completions" \
  -H "Authorization: Bearer $OS3_GATEWAY_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "deepseek/deepseek-v4.1-flash-1017",
    "reasoning_effort": "none",
    "messages": [{"role": "user", "content": "Hello"}]
  }'
```

```python Python theme={null}
import os

from openai import OpenAI

MODEL = "deepseek/deepseek-v4.1-flash-1017"
client = OpenAI(
    base_url=os.environ["OS3_GATEWAY_URL"] + "/v1",
    api_key=os.environ["OS3_GATEWAY_KEY"],
)
reply = client.chat.completions.create(
    model=MODEL,
    reasoning_effort="none",  # answer without thinking
    messages=[{"role": "user", "content": "Hello"}],
)
print(reply.choices[0].message.content)
```

```typescript TypeScript theme={null}
import OpenAI from "openai";

const MODEL = "deepseek/deepseek-v4.1-flash-1017";
const client = new OpenAI({
  baseURL: `${process.env.OS3_GATEWAY_URL}/v1`,
  apiKey: process.env.OS3_GATEWAY_KEY,
});
const reply = await client.chat.completions.create({
  model: MODEL,
  reasoning_effort: "none", // answer without thinking
  messages: [{ role: "user", content: "Hello" }],
});
console.log(reply.choices[0].message.content);
```

The answer, abridged:

```json theme={null}
{
  "object": "chat.completion",
  "model": "deepseek/deepseek-v4.1-flash-1017",
  "choices": [
    {
      "index": 0,
      "message": { "role": "assistant", "content": "Hello! How can I help?" },
      "finish_reason": "stop"
    }
  ],
  "usage": { "prompt_tokens": 8, "completion_tokens": 7, "total_tokens": 15 }
}
```

Every answer carries an `x-os3-request-id` header. Send it to [support](https://docs.os3compute.com/support.md) when a request goes wrong.

## Let it think

The model thinks unless you send `reasoning_effort: "none"`. Efforts are `low`, `high` (the default) and `max`. Thinking comes back in `reasoning_content`, and its tokens are billed as output. Stream long answers.

```bash curl theme={null}
curl -sS --fail-with-body -N "$OS3_GATEWAY_URL/v1/chat/completions" \
  -H "Authorization: Bearer $OS3_GATEWAY_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "deepseek/deepseek-v4.1-flash-1017",
    "reasoning_effort": "high",
    "stream": true,
    "messages": [{"role": "user", "content": "What is 17 * 23?"}]
  }'
```

```python Python theme={null}
stream = client.chat.completions.create(
    model=MODEL,
    reasoning_effort="high",  # low, high or max
    stream=True,
    messages=[{"role": "user", "content": "What is 17 * 23?"}],
)
for chunk in stream:
    if not chunk.choices:
        continue  # the last chunk: usage
    delta = chunk.choices[0].delta
    thinking = getattr(delta, "reasoning_content", None)
    print(thinking or delta.content or "", end="")
print()
```

```typescript TypeScript theme={null}
const stream = await client.chat.completions.create({
  model: MODEL,
  reasoning_effort: "high", // low, high or max
  stream: true,
  messages: [{ role: "user", content: "What is 17 * 23?" }],
});
for await (const chunk of stream) {
  const delta = chunk.choices[0]?.delta as
    | { content?: string; reasoning_content?: string }
    | undefined;
  process.stdout.write(delta?.reasoning_content ?? delta?.content ?? "");
}
console.log();
```

## Anthropic's Messages API

The same model answers in Anthropic's shape. Use the gateway's address without `/v1`. Thinking comes back as a `thinking` block with an empty signature.

```bash curl theme={null}
curl -sS --fail-with-body "$OS3_GATEWAY_URL/v1/messages" \
  -H "x-api-key: $OS3_GATEWAY_KEY" \
  -H "anthropic-version: 2023-06-01" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "deepseek/deepseek-v4.1-flash-1017",
    "max_tokens": 1024,
    "messages": [{"role": "user", "content": "Hello"}]
  }'
```

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

claude = Anthropic(
    base_url=os.environ["OS3_GATEWAY_URL"],
    api_key=os.environ["OS3_GATEWAY_KEY"],
)
message = claude.messages.create(
    model=MODEL,
    max_tokens=1024,
    messages=[{"role": "user", "content": "Hello"}],
)
print([b.text for b in message.content if b.type == "text"])
```

```typescript TypeScript theme={null}
import Anthropic from "@anthropic-ai/sdk";

const claude = new Anthropic({
  baseURL: process.env.OS3_GATEWAY_URL,
  apiKey: process.env.OS3_GATEWAY_KEY,
});
const message = await claude.messages.create({
  model: MODEL,
  max_tokens: 1024,
  messages: [{ role: "user", content: "Hello" }],
});
console.log(message.content.filter((b) => b.type === "text"));
```

## OpenAI's Responses API

OS3 keeps no response: send the conversation each turn. A request with `store: true` or `previous_response_id` is refused.

```bash curl theme={null}
curl -sS --fail-with-body "$OS3_GATEWAY_URL/v1/responses" \
  -H "Authorization: Bearer $OS3_GATEWAY_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "deepseek/deepseek-v4.1-flash-1017",
    "input": "Hello"
  }'
```

```python Python theme={null}
response = client.responses.create(model=MODEL, input="Hello")
print(response.output_text)
```

```typescript TypeScript theme={null}
const response = await client.responses.create({
  model: MODEL,
  input: "Hello",
});
console.log(response.output_text);
```

## The fast id

The same model on a separate, less crowded lane. Each answer is billed by the lane that served it, and the `x-os3-lane` header says which. See [Normal and fast](https://docs.os3compute.com/models/fast.md).

```bash curl theme={null}
# -D - prints the answer's headers: look for x-os3-lane
curl -sS --fail-with-body -D - "$OS3_GATEWAY_URL/v1/chat/completions" \
  -H "Authorization: Bearer $OS3_GATEWAY_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "deepseek/deepseek-v4.1-flash-1017-fast",
    "reasoning_effort": "none",
    "messages": [{"role": "user", "content": "Hello"}]
  }'
```

```python Python theme={null}
raw = client.chat.completions.with_raw_response.create(
    model=MODEL + "-fast",
    reasoning_effort="none",
    messages=[{"role": "user", "content": "Hello"}],
)
print("lane:", raw.headers.get("x-os3-lane"))  # fast, or bulk
print(raw.parse().choices[0].message.content)
```

```typescript TypeScript theme={null}
const { data, response: http } = await client.chat.completions
  .create({
    model: `${MODEL}-fast`,
    reasoning_effort: "none",
    messages: [{ role: "user", content: "Hello" }],
  })
  .withResponse();
console.log("lane:", http.headers.get("x-os3-lane")); // fast, or bulk
console.log(data.choices[0].message.content);
```

## Next

* [Pricing](https://docs.os3compute.com/pricing.md) and [limits by plan](https://docs.os3compute.com/limits.md).
* [Errors](https://docs.os3compute.com/errors.md), with what to do for each.
* `GET /v1/models` lists the ids your key can call.


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