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

# API endpoint

> Call a model's live version from your apps through an OpenAI-compatible endpoint. Any OpenAI SDK works by changing two settings.

Source: https://docs.heurastudios.com/ship/api-endpoint/

*Available on Pro and Studio plans.*

Every model is served at an **OpenAI-compatible** endpoint the moment it has a live version. If your code already calls OpenAI's Chat Completions API, point the client at Heura Studios and use the model's key: nothing else changes.

| Setting | Value |
| --- | --- |
| Base URL | `https://app.heurastudios.com/v1` |
| API key | The model's own key, from its **api** tab (owner only) |
| Model | The model's id, for example `quarry-3f9a1c2b7d` |

## Make a request

**Python**

```python
from openai import OpenAI

client = OpenAI(base_url="https://app.heurastudios.com/v1", api_key="hs_...")

reply = client.chat.completions.create(
    model="quarry-3f9a1c2b7d",
    messages=[{"role": "user", "content": "Which customer spent the most this year?"}],
)
print(reply.choices[0].message.content)
```

**TypeScript**

```ts
import OpenAI from "openai";

const client = new OpenAI({ baseURL: "https://app.heurastudios.com/v1", apiKey: process.env.HEURA_API_KEY });

const reply = await client.chat.completions.create({
  model: "quarry-3f9a1c2b7d",
  messages: [{ role: "user", content: "Which customer spent the most this year?" }],
});
console.log(reply.choices[0].message.content);
```

**cURL**

```bash
curl https://app.heurastudios.com/v1/chat/completions \
  -H "Authorization: Bearer $HEURA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "quarry-3f9a1c2b7d", "messages": [{"role": "user", "content": "Which customer spent the most this year?"}]}'
```

## Stream the answer

Set `stream` to `true` to receive the answer as it's written, as server-sent events in OpenAI's chunk format.

```python
stream = client.chat.completions.create(
    model="quarry-3f9a1c2b7d",
    messages=[{"role": "user", "content": "Summarize last week's refunds."}],
    stream=True,
)
for chunk in stream:
    print(chunk.choices[0].delta.content or "", end="", flush=True)
```

## What answers

The endpoint answers with the model's **live version** and everything it's been taught: its script, rules and facts, the parts of its files that match the question, and its closest examples. When a new version passes the release gate, the endpoint answers with it from the next request; there's nothing to redeploy.

## Keys

Each model has one key. **New key** in the api tab replaces it: apps using the old key stop working immediately, and the website agent isn't affected. Heura Studios stores only a hash of the key, so copy it when it's shown. Keep it on your server; for browsers, use the [website agent](https://docs.heurastudios.com/ship/website-agent/).

## Limits

Up to 60 requests a minute per key, and 120 across all of an account's keys. Each answer draws on the account's credits. See [Errors and limits](https://docs.heurastudios.com/api/errors-and-limits/) for every status code, and the [API reference](https://docs.heurastudios.com/api/overview/) for the full request and response.

> **Note:**
>
> A model answers only while **Deploy** is in its pipeline. Without it, the endpoint returns 503 `not_serving`.
