# Guida rapida

> Fai la tua prima richiesta a un modello NotHoly in circa due minuti.


## 1. Ottieni una chiave API

1. Crea un account su [notholy.com/signup](https://notholy.com/it/signup) e conferma la tua email.
2. Aggiungi crediti in **Fatturazione**. La ricarica minima è indicata in quella pagina.
3. Apri **Chiavi API** e crea una chiave. Inizia con `nh_live_` e viene mostrata una sola volta.

Esportala nella shell. Va nell'header `Authorization` come token bearer.

```bash
export NOTHOLY_API_KEY="nh_live_..."
```

## 2. Elenca i modelli

```bash test
curl https://api.notholy.com/v1/models -H "Authorization: Bearer $NOTHOLY_API_KEY"
```

L'elenco è pubblico e mostra limiti e prezzi di ogni modello. Vedi [Modelli](/it/getting-started/models).

## 3. Invia una chat completion

```bash test
curl https://api.notholy.com/v1/chat/completions \
  -H "Authorization: Bearer $NOTHOLY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "notholy-specter", "messages": [{"role": "user", "content": "Explain IDOR in two sentences."}]}'
```

```python test
import os
from openai import OpenAI

client = OpenAI(base_url="https://api.notholy.com/v1", api_key=os.environ["NOTHOLY_API_KEY"])

r = client.chat.completions.create(
    model="notholy-specter",
    messages=[{"role": "user", "content": "Explain IDOR in two sentences."}],
)
print(r.choices[0].message.content)
```

```js test
import OpenAI from 'openai';

const client = new OpenAI({ baseURL: 'https://api.notholy.com/v1', apiKey: process.env.NOTHOLY_API_KEY });

const r = await client.chat.completions.create({
  model: 'notholy-specter',
  messages: [{ role: 'user', content: 'Explain IDOR in two sentences.' }],
});
console.log(r.choices[0].message.content);
```

## 4. In streaming

Aggiungi `"stream": true` e leggi i server-sent events. Ogni evento è `data: {...}`, e lo stream finisce con `data: [DONE]`. Vedi [Streaming](/it/guides/streaming).

## Dal terminale

La CLI usa lo stesso account e fa l'accesso dal browser, quindi non devi esportare una chiave.

```bash
# macOS and Linux
curl -fsSL https://notholy.com/install.sh | sh
```

```powershell
# Windows (PowerShell)
irm https://notholy.com/install.ps1 | iex
```

```bash
notholy --version
notholy login
notholy "explain IDOR in two sentences"
```

Ogni passo è spiegato in [Installa la CLI](/it/cli/install).

## Errori comuni

| Stato | Codice | Cosa fare |
|---|---|---|
| 401 | `invalid_api_key` | Controlla la chiave e l'header `Authorization: Bearer` |
| 402 | `insufficient_credits` | Aggiungi crediti in Fatturazione |
| 404 | `model_not_found` | Usa un ID restituito da `GET /v1/models` |

## Prossimi passi

- [Autenticazione](/it/getting-started/authentication): header, chiavi ed errori di autenticazione
- [Modelli](/it/getting-started/models): i modelli attuali, limiti e prezzi
- [Chat completions](/it/api/chat-completions): richiesta e risposta complete
- [SDK](/it/getting-started/sdks): gli SDK di OpenAI e Anthropic
