# Quickstart

> Make your first request to a Hollow model with curl, Python or TypeScript, using the OpenAI or Anthropic SDKs with a changed base address.

Hollow models are called with the OpenAI and Anthropic SDKs you already use. You change the base address and the key; nothing else. There is no Hollow SDK.

## Before you start

You need three things: credit on the account, an API key, and the key set as a shell variable.

1. Add credit. Every model request is paid from prepaid credit, so you need some before the first request. An account with no credit can create keys, browse [Models](https://platform.projecthollow.com/docs/models.md) and read these guides, but a request is refused with HTTP 402 and the code `credit_exhausted` until credit is added, and nothing is charged for a refused request. Add credit on [Billing](https://platform.projecthollow.com/billing/). See [Errors and status codes](https://platform.projecthollow.com/docs/errors.md) for the 402 body.
2. Open [Keys](https://platform.projecthollow.com/keys/) and choose Create API key. The default access (Models only) and expiry are right for a first request. A Project is the group that holds keys, limits and usage together, and the key is charged to the project you create it in.
3. Copy the key when it is shown. It is shown once and cannot be shown again.
4. Set it as a variable in your terminal with `export HOLLOW_API_KEY="paste-your-key-here"`. The curl samples below read `$HOLLOW_API_KEY`. In the Python and TypeScript samples, replace the `HOLLOW_API_KEY` text with your key for a first try, then read it from an environment variable in your own code, never from source.

## Base address

Both protocols use one address, `https://models.projecthollow.com`. The two SDK families differ only in the path they add and the base address they expect.

**The two protocols and where they are called**

| Protocol | Path | SDK base address |
| --- | --- | --- |
| OpenAI-compatible | `/v1/chat/completions` | `https://models.projecthollow.com/v1` |
| Anthropic-compatible | `/v1/messages` | `https://models.projecthollow.com` |

## Make a request with the OpenAI SDK

This sends one message and prints the reply. The samples call the available chat model with the lowest input price in the [Models](https://platform.projecthollow.com/docs/models.md) table, so a copied request costs as little as possible.

**OpenAI-compatible request**

**curl**

```bash
curl 'https://models.projecthollow.com/v1/chat/completions' \
  -H "Authorization: Bearer $HOLLOW_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
  "model": "claude-haiku-5-5",
  "messages": [
    {
      "role": "user",
      "content": "Hello from Hollow."
    }
  ],
  "max_tokens": 256
}'
```

**Python**

```python
from openai import OpenAI

client = OpenAI(
    api_key="HOLLOW_API_KEY",
    base_url="https://models.projecthollow.com/v1",
)

response = client.chat.completions.create(
    model="claude-haiku-5-5",
    messages=[
        {
            "role": "user",
            "content": "Hello from Hollow.",
        },
    ],
    max_tokens=256,
)
print(response.choices[0].message.content)
```

**TypeScript**

```typescript
import OpenAI from "openai";

const client = new OpenAI({
  apiKey: "HOLLOW_API_KEY",
  baseURL: "https://models.projecthollow.com/v1",
});

const response = await client.chat.completions.create({
  "model": "claude-haiku-5-5",
  "messages": [
    {
      "role": "user",
      "content": "Hello from Hollow."
    }
  ],
  "max_tokens": 256
});
console.log(response.choices[0].message.content);
```

## Make a request with the Anthropic SDK

**Anthropic-compatible request**

**curl**

```bash
curl 'https://models.projecthollow.com/v1/messages' \
  -H "Authorization: Bearer $HOLLOW_API_KEY" \
  -H 'anthropic-version: 2023-06-01' \
  -H 'Content-Type: application/json' \
  -d '{
  "model": "claude-haiku-5-5",
  "max_tokens": 256,
  "messages": [
    {
      "role": "user",
      "content": "Hello from Hollow."
    }
  ]
}'
```

**Python**

```python
from anthropic import Anthropic

client = Anthropic(
    auth_token="HOLLOW_API_KEY",
    base_url="https://models.projecthollow.com",
)

message = client.messages.create(
    model="claude-haiku-5-5",
    max_tokens=256,
    messages=[
        {
            "role": "user",
            "content": "Hello from Hollow.",
        },
    ],
)
print(message.content)
```

**TypeScript**

```typescript
import Anthropic from "@anthropic-ai/sdk";

const client = new Anthropic({
  authToken: "HOLLOW_API_KEY",
  baseURL: "https://models.projecthollow.com",
});

const message = await client.messages.create({
  "model": "claude-haiku-5-5",
  "max_tokens": 256,
  "messages": [
    {
      "role": "user",
      "content": "Hello from Hollow."
    }
  ]
});
console.log(message.content);
```

> **Note: Send the key in the Authorization header**
>
> The API reads the key from `Authorization: Bearer <key>` and from nowhere else. The Anthropic SDKs send their `api_key` option as an `x-api-key` header, which is not read, so pass the key as the SDK's auth token instead (`auth_token` in Python, `authToken` in TypeScript). See [Authentication](https://platform.projecthollow.com/docs/authentication.md).

## Stream the reply

Add `"stream": true` to ask for server-sent events on either protocol. The samples below stream the OpenAI-compatible reply as it is written.

**OpenAI-compatible streaming request**

**curl**

```bash
# This request streams: the reply arrives as a stream of events, not one JSON body.
# Set stream to false (or leave it out) to get a single reply.
curl -N 'https://models.projecthollow.com/v1/chat/completions' \
  -H "Authorization: Bearer $HOLLOW_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
  "model": "claude-haiku-5-5",
  "messages": [
    {
      "role": "user",
      "content": "Hello from Hollow."
    }
  ],
  "max_tokens": 256,
  "stream": true
}'
```

**Python**

```python
# This request streams: the reply arrives as a stream of events, not one JSON body.
# Set stream to false (or leave it out) to get a single reply.
from openai import OpenAI

client = OpenAI(
    api_key="HOLLOW_API_KEY",
    base_url="https://models.projecthollow.com/v1",
)

stream = client.chat.completions.create(
    model="claude-haiku-5-5",
    messages=[
        {
            "role": "user",
            "content": "Hello from Hollow.",
        },
    ],
    max_tokens=256,
    stream=True,
)
for chunk in stream:
    if chunk.choices and chunk.choices[0].delta.content:
        print(chunk.choices[0].delta.content, end="", flush=True)
```

**TypeScript**

```typescript
// This request streams: the reply arrives as a stream of events, not one JSON body.
// Set stream to false (or leave it out) to get a single reply.
import OpenAI from "openai";

const client = new OpenAI({
  apiKey: "HOLLOW_API_KEY",
  baseURL: "https://models.projecthollow.com/v1",
});

const stream = await client.chat.completions.create({
  "model": "claude-haiku-5-5",
  "messages": [
    {
      "role": "user",
      "content": "Hello from Hollow."
    }
  ],
  "max_tokens": 256,
  "stream": true
});
for await (const chunk of stream) {
  process.stdout.write(chunk.choices[0]?.delta?.content ?? "");
}
```

## What comes back

The reply is the standard shape of the protocol you called, with the token counts for the request in `usage`. The response does not include a cost: see what you have spent on [Usage](https://platform.projecthollow.com/usage/) and [Cost](https://platform.projecthollow.com/cost/). Shortened examples of a good reply:

**A successful reply, shortened**

**OpenAI-compatible**

```json
{
  "id": "chatcmpl-example",
  "object": "chat.completion",
  "model": "claude-haiku-5-5",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "Hello! How can I help?"
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 12,
    "completion_tokens": 8,
    "total_tokens": 20
  }
}
```

**Anthropic-compatible**

```json
{
  "id": "msg_example",
  "type": "message",
  "role": "assistant",
  "model": "claude-haiku-5-5",
  "content": [
    {
      "type": "text",
      "text": "Hello! How can I help?"
    }
  ],
  "stop_reason": "end_turn",
  "usage": {
    "input_tokens": 12,
    "output_tokens": 8
  }
}
```

- OpenAI-compatible: `choices[0].message.content` holds the text, and `usage` has `prompt_tokens`, `completion_tokens` and `total_tokens`.
- Anthropic-compatible: `content[0].text` holds the text, and `usage` has `input_tokens` and `output_tokens`.
- The `model` field is the id the request was run on. Hollow never swaps in a different model.
- Cost follows usage: input tokens are charged at the model's input price and output tokens at its output price, both per million tokens in the [Models](https://platform.projecthollow.com/docs/models.md) table. Where a model has a prompt cache, a cache read (input served from a saved prompt) and a cache write (input saved for later) have their own prices.

## Keep your key on your server

The API accepts cross-origin requests, so a key placed in browser or mobile code can be used by any site or app that obtains it, and it spends your credit. Call Hollow from your backend, keep the key in an environment variable or secret store there, and let your own front end talk to your backend instead. See [Authentication](https://platform.projecthollow.com/docs/authentication.md) for rotating a key that may have been seen.

## Next steps

- [Authentication](https://platform.projecthollow.com/docs/authentication.md): scopes, expiry, rotation and keeping the key out of client code.
- [Models](https://platform.projecthollow.com/docs/models.md): every model id you can call, with its context window and status.
- [Errors and status codes](https://platform.projecthollow.com/docs/errors.md): what each failure means and which ones to retry.
- [Limits](https://platform.projecthollow.com/docs/limits.md): your credit, the optional spend caps and the request rate limit.
- Try a request without writing code in the [Playground](https://platform.projecthollow.com/playground/), which shows the same samples for your project.
