# How to inference an AI model

The Sunrise Model Service exposes an OpenAI-compatible API for every Active Model. To send an inference request you need three pieces of information: a **Base URL**, a **Model Name**, and an **API Key**.

---

## Make your first call

### 1. Get the Base API URL

All inference requests are sent to the Sunrise Model Service endpoint.

| Environment | Base API URL                 |
|-------------|------------------------------|
| Production  | `https://maas.ai.sunrise.ch/` |

### 2. Pick a Model Name

Choose a model from the [Active Models](../active-models.md) table. The value in the **Model Name** column is what you pass as `"model"` in your request body.

Examples:

- `inference-llama4-maverick`
- `inference-bge-m3`

### 3. Get your API Key

Your API Key authenticates every request. Pass it in the `Authorization` HTTP header:

```bash
Authorization: Bearer YOUR_API_KEY
```

!!!warning Keep your API Key secret
Never commit an API Key to source control or expose it in client-side code. Rotate the key immediately if you suspect it has been leaked.
!!!

### 4. Send the request

With the three pieces above you can call any of the OpenAI-compatible endpoints. The minimal chat completion call looks like this:

+++ cURL
```bash
curl --location 'https://maas.ai.sunrise.ch/v1/chat/completions' \
  --header 'Authorization: Bearer YOUR_API_KEY' \
  --header 'Content-Type: application/json' \
  --data '{
    "model": "inference-llama4-maverick",
    "messages": [{"role": "user", "content": "Hello!"}]
  }'
```
+++ Python
```python
from openai import OpenAI

client = OpenAI(
    base_url="https://maas.ai.sunrise.ch/v1",
    api_key="YOUR_API_KEY",
)

response = client.chat.completions.create(
    model="inference-llama4-maverick",
    messages=[{"role": "user", "content": "Hello!"}],
)

print(response.choices[0].message.content)
```
+++ Node.js
```javascript
import OpenAI from "openai";

const client = new OpenAI({
  baseURL: "https://maas.ai.sunrise.ch/v1",
  apiKey: "YOUR_API_KEY",
});

const response = await client.chat.completions.create({
  model: "inference-llama4-maverick",
  messages: [{ role: "user", content: "Hello!" }],
});

console.log(response.choices[0].message.content);
```
+++

---

## See also

[!ref Sample API calls](sample-api-calls.md)
[!ref Active Models](../active-models.md)
