# API dei modelli

> GET /v1/models e GET /v1/models/{id} elencano i modelli pubblici con limiti, prezzi e capacità.


## Elencare i modelli

```endpoint
GET https://api.notholy.com/v1/models
```

L'elenco è pubblico: non serve una chiave. Contiene tutti i modelli attivi o deprecati, nell'ordine del catalogo, nel formato di elenco OpenAI con campi in più.

```json
{
  "object": "list",
  "data": [
    {
      "id": "notholy-specter",
      "object": "model",
      "created": 1794014537,
      "owned_by": "notholy",
      "base_model": "GLM 5.3 Abliterated",
      "capabilities": {
        "reasoning": true,
        "reasoning_efforts": [
          "low",
          "high",
          "max"
        ],
        "tools": true
      },
      "context_length": 1048576,
      "input_modalities": [
        "text"
      ],
      "max_output_tokens": 131072,
      "name": "NotHoly Specter",
      "pricing": {
        "currency": "USD",
        "unit": "1M tokens",
        "cached_input": "0.273000",
        "input": "1.820000",
        "output": "3.640000"
      },
      "status": "active"
    }
  ]
}
```

### Campi

| Campo | Tipo | Note |
|---|---|---|
| `id` | string | Invialo come `model` |
| `name` | string | Nome visualizzato |
| `status` | string | `active` o `deprecated` |
| `context_length` | integer | Token di input più token di output |
| `max_output_tokens` | integer | Il massimo che una richiesta può generare |
| `input_modalities` | string[] | `text`, più `image` sui modelli che accettano immagini |
| `capabilities` | object | `tools`, `reasoning` e i `reasoning_efforts` accettati |
| `pricing` | object | USD per milione di token come stringhe decimali: `input`, `output`, `cached_input` |
| `base_model` | string | Il modello a pesi aperti su cui si basa, quando è pubblicato |
| `default` | boolean | Presente e `true` sul modello che i client devono usare quando l'utente non ne ha scelto uno |

Con un header `anthropic-version` l'elenco usa la forma di Anthropic: `{data, has_more, first_id, last_id}` con elementi `{type: "model", id, display_name, created_at}`.

## Leggere un modello

```endpoint
GET https://api.notholy.com/v1/models/notholy-specter
```

Restituisce lo stesso oggetto per un solo modello. Un ID sconosciuto o ritirato restituisce `404 model_not_found`.

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

```python test
import os
from openai import OpenAI

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

for m in client.models.list():
    print(m.id)
```
