# Integrating the API

> From your API key to your first request and response.

Canonical: https://platform.uprelic.com/docs/integration

---

## 1. Create an API key

Log in, open [API keys](https://platform.uprelic.com/console/keys) in the console, and create a key. Copy it when it appears; the full value is shown only once.

## 2. Check your balance

Requests are billed by input tokens. New accounts start at zero: verify a card on the console’s [Overview](https://platform.uprelic.com/console/dashboard) to get 5 units of free credit in your account currency (EUR, USD, GBP, or CHF), without being charged. Send your first requests with it, then add more on the [Billing](https://platform.uprelic.com/console/billing) page.

## 3. Send a request

Save your key in the `UPRELIC_API_KEY` environment variable, then use cURL or the Python SDK. Both examples ask two independent questions about the same message.

:::: tabs
::: tab cURL
```bash Request · cURL
curl https://api.uprelic.com/v1/systemone \
  -H "Authorization: Bearer $UPRELIC_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "strom-1.0.7",
    "state": "Our whole team is blocked. The app has been down since this morning.",
    "questions": {
      "team": {
        "type": "choice",
        "instructions": "Which team should handle this?",
        "criteria": {
          "engineering": "Outages and bugs",
          "billing": "Payments and invoices",
          "account": "Login and access"
        }
      },
      "urgent": {
        "type": "noul",
        "instructions": "This message needs urgent attention."
      }
    }
  }'
```
:::
::: tab Python
Install the [Python SDK](https://pypi.org/project/uprelic/) with Python 3.10 or later. The client reads `UPRELIC_API_KEY` from your environment.

```bash Install · shell
pip install uprelic
```

```python Request · Python
from uprelic import Uprelic, Choice, Noul

with Uprelic() as client:
    response = client.system_one(
        model="strom-1.0.7",
        state="Our whole team is blocked. The app has been down since this morning.",
        questions={
            "team": Choice(
                "Which team should handle this?",
                criteria={
                    "engineering": "Outages and bugs",
                    "billing": "Payments and invoices",
                    "account": "Login and access",
                },
            ),
            "urgent": Noul("This message needs urgent attention."),
        },
    )

print(response.model_dump_json(indent=2))
```

Use typed answers directly: `response.choices["team"].choice` for the selected team and `response.nouls["urgent"].noul` for the probability of urgency.
:::
::::

```json Response · illustrative
{
  "model": "strom-1.0.7",
  "answers": {
    "team": {
      "type": "choice",
      "choice": "engineering",
      "confidence": 0.83,
      "probabilities": {
        "engineering": 0.89,
        "billing": 0.07,
        "account": 0.04
      }
    },
    "urgent": { "type": "noul", "noul": 0.96 }
  },
  "usage": {
    "input_tokens": 283,
    "output_tokens": 2,
    "cached_input_tokens": 256,
    "cost": 0.000011886,
    "currency": "usd"
  },
  "metadata": { "server_processing_time_ms": 85 }
}
```

The example values show the response shape. Actual answers and token counts depend on the request and model.

The response includes input and output token counts in `usage`. Input tokens determine the cost charged to your prepaid balance.

Explore all fields, validation rules, and models in the [API reference](https://api.uprelic.com/v1/docs).
