Source: https://ailoot.ai/docs/it/cabinet/usage/
Canonical: https://ailoot.ai/docs/it/cabinet/usage/
Language: it

[API dell’area personale](https://ailoot.ai/docs/it/) 

# Cronologia e spese

[Markdown](https://ailoot.ai/docs/it/cabinet/usage/index.md)

Metodi, campi delle richieste e risposte.

La sezione contiene 11 metodi. Apri un metodo per vedere condizioni di accesso, campi della richiesta e risposta.

| Metodo e percorso | Descrizione | Accesso |
| --- | --- | --- |
| `GET /api/v1/usage` | Cronologia delle richieste | Token dell’area personale |
| `GET /api/v1/usage/:id` | Una richiesta dalla cronologia | Token dell’area personale |
| `POST /api/v1/usage/dashboard/api-keys-usage` | Statistiche delle proprie chiavi API | Token dell’area personale |
| `GET /api/v1/usage/dashboard/models` | Utilizzo per modello | Token dell’area personale |
| `GET /api/v1/usage/dashboard/snapshot-v2` | Vista unificata dei grafici | Token dell’area personale |
| `GET /api/v1/usage/dashboard/stats` | Riepilogo dell’utilizzo | Token dell’area personale |
| `GET /api/v1/usage/dashboard/trend` | Andamento dell’utilizzo | Token dell’area personale |
| `GET /api/v1/usage/errors` | Cronologia degli errori | Token dell’area personale |
| `GET /api/v1/usage/errors/:id` | Dettagli di un proprio errore | Token dell’area personale |
| `GET /api/v1/usage/stats` | Statistiche di utilizzo | Token dell’area personale |
| `GET /api/v1/user/api-keys/:id/usage/daily` | Statistiche giornaliere della propria chiave API | Token dell’area personale |

**GET /api/v1/usage** — Cronologia delle richieste

Accesso: token dell’area personale

GET`/api/v1/usage`

Lettura; l’ID si ricava dalla risposta precedente che hai ricevuto

```bash
curl --fail-with-body "https://ailoot.ai/api/v1/usage" \
  -H "Authorization: Bearer $TOKEN"
```

## Parametri query

| Il campo | Tipo | Obbligatorio | Verifica / descrizione |
| --- | --- | --- | --- |
| `sort_by` | `string` | no | ; predefinito: created\_at |
| `sort_order` | `string` | no | ; predefinito: desc |
| `api_key_id` | `integer` | no |  |
| `request_type` | `string` | no |  |
| `stream` | `boolean` | no |  |
| `timezone` | `string` | no |  |
| `start_date` | `string` | no |  |
| `end_date` | `string` | no |  |
| `period` | `string` | no |  |
| `model` | `string` | no |  |
| `page` | `integer` | no | ; predefinito: 1; positivo; page\_size/limit \<=1000 |
| `page_size` | `integer` | no | ; predefinito: 20; positivo; page\_size/limit \<=1000 |
| `limit` | `integer` | no | ; predefinito: 20; positivo; page\_size/limit \<=1000 |

Il corpo della richiesta non è necessario. Passa i parametri indicati sopra nell’URL.

## Risposta

La risposta JSON contiene code, message e data. Il contenuto di data è descritto negli schemi sotto.

Schemi dei dati della risposta: `UsageLog`. Campi e tipi sono nelle pagine «Schemi dei dati».

Schema della risposta, valori illustrativi

```json
{
  "code": 0,
  "message": "success",
  "data": {
    "items": [
      {
        "id": "PLACEHOLDER_ID (integer)",
        "user_id": "PLACEHOLDER_USER_ID (integer)",
        "api_key_id": "PLACEHOLDER_API_KEY_ID (integer)",
        "request_id": "PLACEHOLDER_REQUEST_ID (string)",
        "model": "PLACEHOLDER_MODEL (string)",
        "service_tier": "PLACEHOLDER_SERVICE_TIER (string)",
        "reasoning_effort": "PLACEHOLDER_REASONING_EFFORT (string)",
        "input_tokens": "PLACEHOLDER_INPUT_TOKENS (integer)",
        "output_tokens": "PLACEHOLDER_OUTPUT_TOKENS (integer)",
        "cache_creation_tokens": "PLACEHOLDER_CACHE_CREATION_TOKENS (integer)",
        "cache_read_tokens": "PLACEHOLDER_CACHE_READ_TOKENS (integer)",
        "cache_creation_5m_tokens": "PLACEHOLDER_CACHE_CREATION_5M_TOKENS (integer)",
        "cache_creation_1h_tokens": "PLACEHOLDER_CACHE_CREATION_1H_TOKENS (integer)",
        "input_cost": "PLACEHOLDER_INPUT_COST (number)",
        "output_cost": "PLACEHOLDER_OUTPUT_COST (number)",
        "cache_creation_cost": "PLACEHOLDER_CACHE_CREATION_COST (number)",
        "cache_read_cost": "PLACEHOLDER_CACHE_READ_COST (number)",
        "total_cost": "PLACEHOLDER_TOTAL_COST (number)",
        "actual_cost": "PLACEHOLDER_ACTUAL_COST (number)",
        "long_context_billing_applied": "PLACEHOLDER_LONG_CONTEXT_BILLING_APPLIED (boolean)",
        "request_type": "PLACEHOLDER_REQUEST_TYPE (string)",
        "stream": "PLACEHOLDER_STREAM (boolean)",
        "duration_ms": "PLACEHOLDER_DURATION_MS (integer)",
        "first_token_ms": "PLACEHOLDER_FIRST_TOKEN_MS (integer)",
        "image_count": "PLACEHOLDER_IMAGE_COUNT (integer)",
        "image_size": "PLACEHOLDER_IMAGE_SIZE (string)",
        "image_input_size": "PLACEHOLDER_IMAGE_INPUT_SIZE (string)",
        "image_output_size": "PLACEHOLDER_IMAGE_OUTPUT_SIZE (string)",
        "image_input_tokens": "PLACEHOLDER_IMAGE_INPUT_TOKENS (integer)",
        "image_input_cost": "PLACEHOLDER_IMAGE_INPUT_COST (number)",
        "image_output_tokens": "PLACEHOLDER_IMAGE_OUTPUT_TOKENS (integer)",
        "image_output_cost": "PLACEHOLDER_IMAGE_OUTPUT_COST (number)",
        "image_size_breakdown": "PLACEHOLDER_IMAGE_SIZE_BREAKDOWN (object)",
        "media_type": "PLACEHOLDER_MEDIA_TYPE (string)",
        "ip_address": "PLACEHOLDER_IP_ADDRESS (string)",
        "session_id": "PLACEHOLDER_SESSION_ID (string)",
        "created_at": "PLACEHOLDER_CREATED_AT (string)",
        "user": "PLACEHOLDER_USER (object)",
        "api_key": "PLACEHOLDER_API_KEY (object)"
      }
    ],
    "total": "PLACEHOLDER_TOTAL (integer)",
    "page": "PLACEHOLDER_PAGE (integer)",
    "page_size": "PLACEHOLDER_PAGE_SIZE (integer)",
    "pages": "PLACEHOLDER_PAGES (integer)"
  }
}
```

Particolarità: Tutti i dati personali e gli oggetti sono limitati al soggetto JWT.

**GET /api/v1/usage/:id** — Una richiesta dalla cronologia

Accesso: token dell’area personale

GET`/api/v1/usage/:id`

Lettura; l’ID si ricava dalla risposta precedente che hai ricevuto

```bash
curl --fail-with-body "https://ailoot.ai/api/v1/usage/$ID" \
  -H "Authorization: Bearer $TOKEN"
```

## Parametri del percorso

| Il campo | Tipo | Obbligatorio | Verifica / descrizione |
| --- | --- | --- | --- |
| `id` | `integer` | sì |  |

Il corpo della richiesta non è necessario. Passa i parametri indicati sopra nell’URL.

## Risposta

La risposta JSON contiene code, message e data. Il contenuto di data è descritto negli schemi sotto.

Schemi dei dati della risposta: `UsageLog`. Campi e tipi sono nelle pagine «Schemi dei dati».

Schema della risposta, valori illustrativi

```json
{
  "code": 0,
  "message": "success",
  "data": {
    "id": "PLACEHOLDER_ID (integer)",
    "user_id": "PLACEHOLDER_USER_ID (integer)",
    "api_key_id": "PLACEHOLDER_API_KEY_ID (integer)",
    "request_id": "PLACEHOLDER_REQUEST_ID (string)",
    "model": "PLACEHOLDER_MODEL (string)",
    "service_tier": "PLACEHOLDER_SERVICE_TIER (string)",
    "reasoning_effort": "PLACEHOLDER_REASONING_EFFORT (string)",
    "input_tokens": "PLACEHOLDER_INPUT_TOKENS (integer)",
    "output_tokens": "PLACEHOLDER_OUTPUT_TOKENS (integer)",
    "cache_creation_tokens": "PLACEHOLDER_CACHE_CREATION_TOKENS (integer)",
    "cache_read_tokens": "PLACEHOLDER_CACHE_READ_TOKENS (integer)",
    "cache_creation_5m_tokens": "PLACEHOLDER_CACHE_CREATION_5M_TOKENS (integer)",
    "cache_creation_1h_tokens": "PLACEHOLDER_CACHE_CREATION_1H_TOKENS (integer)",
    "input_cost": "PLACEHOLDER_INPUT_COST (number)",
    "output_cost": "PLACEHOLDER_OUTPUT_COST (number)",
    "cache_creation_cost": "PLACEHOLDER_CACHE_CREATION_COST (number)",
    "cache_read_cost": "PLACEHOLDER_CACHE_READ_COST (number)",
    "total_cost": "PLACEHOLDER_TOTAL_COST (number)",
    "actual_cost": "PLACEHOLDER_ACTUAL_COST (number)",
    "long_context_billing_applied": "PLACEHOLDER_LONG_CONTEXT_BILLING_APPLIED (boolean)",
    "request_type": "PLACEHOLDER_REQUEST_TYPE (string)",
    "stream": "PLACEHOLDER_STREAM (boolean)",
    "duration_ms": "PLACEHOLDER_DURATION_MS (integer)",
    "first_token_ms": "PLACEHOLDER_FIRST_TOKEN_MS (integer)",
    "image_count": "PLACEHOLDER_IMAGE_COUNT (integer)",
    "image_size": "PLACEHOLDER_IMAGE_SIZE (string)",
    "image_input_size": "PLACEHOLDER_IMAGE_INPUT_SIZE (string)",
    "image_output_size": "PLACEHOLDER_IMAGE_OUTPUT_SIZE (string)",
    "image_input_tokens": "PLACEHOLDER_IMAGE_INPUT_TOKENS (integer)",
    "image_input_cost": "PLACEHOLDER_IMAGE_INPUT_COST (number)",
    "image_output_tokens": "PLACEHOLDER_IMAGE_OUTPUT_TOKENS (integer)",
    "image_output_cost": "PLACEHOLDER_IMAGE_OUTPUT_COST (number)",
    "image_size_breakdown": "PLACEHOLDER_IMAGE_SIZE_BREAKDOWN (object)",
    "media_type": "PLACEHOLDER_MEDIA_TYPE (string)",
    "ip_address": "PLACEHOLDER_IP_ADDRESS (string)",
    "session_id": "PLACEHOLDER_SESSION_ID (string)",
    "created_at": "PLACEHOLDER_CREATED_AT (string)",
    "user": "PLACEHOLDER_USER (object)",
    "api_key": "PLACEHOLDER_API_KEY (object)"
  }
}
```

Particolarità: Tutti i dati personali e gli oggetti sono limitati al soggetto JWT.

**POST /api/v1/usage/dashboard/api-keys-usage** — Statistiche delle proprie chiavi API

Accesso: token dell’area personale

POST`/api/v1/usage/dashboard/api-keys-usage`

## Campi JSON / modulo

| Il campo | Tipo | Obbligatorio | Verifica / descrizione |
| --- | --- | --- | --- |
| `api_key_ids` | `array` | sì | required |

Modello del corpo della richiesta

```json
{
  "api_key_ids": "PLACEHOLDER_API_KEY_IDS (array)"
}
```

PLACEHOLDER indica il tuo input e il suo tipo. Sostituisci i valori e mantieni solo i campi facoltativi necessari; i segnaposto stringa non vanno inviati al posto di numeri, boolean, oggetti o array.

Schema della richiesta: `BatchAPIKeysUsageRequest`

## Risposta

La risposta JSON contiene code, message e data. Il contenuto di data è descritto negli schemi sotto.

Schemi dei dati della risposta: `BatchAPIKeyUsageStats`. Campi e tipi sono nelle pagine «Schemi dei dati».

Schema della risposta, valori illustrativi

```json
{
  "code": 0,
  "message": "success",
  "data": {
    "api_key_id": "PLACEHOLDER_API_KEY_ID (integer)",
    "today_actual_cost": "PLACEHOLDER_TODAY_ACTUAL_COST (number)",
    "total_actual_cost": "PLACEHOLDER_TOTAL_ACTUAL_COST (number)"
  }
}
```

Particolarità: Tutti i dati personali e gli oggetti sono limitati al soggetto JWT.

Particolarità: il metodo legge le statistiche delle proprie chiavi API; l’esempio descrive il contratto e non viene eseguito.

Il metodo restituisce statistiche e non modifica le chiavi API né le spese. Per ripetere la lettura non è necessario Idempotency-Key; la risposta riflette lo stato al momento della richiesta.

**GET /api/v1/usage/dashboard/models** — Utilizzo per modello

Accesso: token dell’area personale

GET`/api/v1/usage/dashboard/models`

Lettura; l’ID si ricava dalla risposta precedente che hai ricevuto

```bash
curl --fail-with-body "https://ailoot.ai/api/v1/usage/dashboard/models" \
  -H "Authorization: Bearer $TOKEN"
```

## Parametri query

| Il campo | Tipo | Obbligatorio | Verifica / descrizione |
| --- | --- | --- | --- |
| `api_key_id` | `integer` | no |  |
| `request_type` | `string` | no |  |
| `stream` | `boolean` | no |  |
| `timezone` | `string` | no |  |
| `start_date` | `string` | no |  |
| `end_date` | `string` | no |  |
| `period` | `string` | no |  |
| `model` | `string` | no |  |

Il corpo della richiesta non è necessario. Passa i parametri indicati sopra nell’URL.

## Risposta

La risposta JSON contiene code, message e data. Il contenuto di data è descritto negli schemi sotto.

Schema della risposta, valori illustrativi

```json
{
  "code": 0,
  "message": "success",
  "data": {
    "end_date": "VALUE_FROM_RESPONSE",
    "models": "VALUE_FROM_RESPONSE",
    "month": "VALUE_FROM_RESPONSE",
    "start_date": "VALUE_FROM_RESPONSE",
    "today": "VALUE_FROM_RESPONSE",
    "week": "VALUE_FROM_RESPONSE"
  }
}
```

Particolarità: Tutti i dati personali e gli oggetti sono limitati al soggetto JWT.

**GET /api/v1/usage/dashboard/snapshot-v2** — Vista unificata dei grafici

Accesso: token dell’area personale

GET`/api/v1/usage/dashboard/snapshot-v2`

Lettura; l’ID si ricava dalla risposta precedente che hai ricevuto

```bash
curl --fail-with-body "https://ailoot.ai/api/v1/usage/dashboard/snapshot-v2" \
  -H "Authorization: Bearer $TOKEN"
```

## Parametri query

| Il campo | Tipo | Obbligatorio | Verifica / descrizione |
| --- | --- | --- | --- |
| `granularity` | `string` | no | ; predefinito: day |
| `include_trend` | `boolean` | no | ; predefinito: true |
| `include_model_stats` | `boolean` | no | ; predefinito: true |
| `api_key_id` | `integer` | no |  |
| `request_type` | `string` | no |  |
| `stream` | `boolean` | no |  |
| `timezone` | `string` | no |  |
| `start_date` | `string` | no |  |
| `end_date` | `string` | no |  |
| `period` | `string` | no |  |
| `model` | `string` | no |  |

Il corpo della richiesta non è necessario. Passa i parametri indicati sopra nell’URL.

## Risposta

La risposta JSON contiene code, message e data. Il contenuto di data è descritto negli schemi sotto.

Schema della risposta, valori illustrativi

```json
{
  "code": 0,
  "message": "success",
  "data": {
    "end_date": "VALUE_FROM_RESPONSE",
    "generated_at": "VALUE_FROM_RESPONSE",
    "granularity": "VALUE_FROM_RESPONSE",
    "month": "VALUE_FROM_RESPONSE",
    "start_date": "VALUE_FROM_RESPONSE",
    "today": "VALUE_FROM_RESPONSE",
    "week": "VALUE_FROM_RESPONSE"
  }
}
```

Particolarità: Tutti i dati personali e gli oggetti sono limitati al soggetto JWT.

**GET /api/v1/usage/dashboard/stats** — Riepilogo dell’utilizzo

Accesso: token dell’area personale

GET`/api/v1/usage/dashboard/stats`

Lettura; l’ID si ricava dalla risposta precedente che hai ricevuto

```bash
curl --fail-with-body "https://ailoot.ai/api/v1/usage/dashboard/stats" \
  -H "Authorization: Bearer $TOKEN"
```

Il corpo della richiesta non è necessario. Passa i parametri indicati sopra nell’URL.

## Risposta

La risposta JSON contiene code, message e data. Il contenuto di data è descritto negli schemi sotto.

Schemi dei dati della risposta: `UserDashboardStats`. Campi e tipi sono nelle pagine «Schemi dei dati».

Schema della risposta, valori illustrativi

```json
{
  "code": 0,
  "message": "success",
  "data": {
    "total_api_keys": "PLACEHOLDER_TOTAL_API_KEYS (integer)",
    "active_api_keys": "PLACEHOLDER_ACTIVE_API_KEYS (integer)",
    "total_requests": "PLACEHOLDER_TOTAL_REQUESTS (integer)",
    "total_input_tokens": "PLACEHOLDER_TOTAL_INPUT_TOKENS (integer)",
    "total_output_tokens": "PLACEHOLDER_TOTAL_OUTPUT_TOKENS (integer)",
    "total_cache_creation_tokens": "PLACEHOLDER_TOTAL_CACHE_CREATION_TOKENS (integer)",
    "total_cache_read_tokens": "PLACEHOLDER_TOTAL_CACHE_READ_TOKENS (integer)",
    "total_tokens": "PLACEHOLDER_TOTAL_TOKENS (integer)",
    "total_cost": "PLACEHOLDER_TOTAL_COST (number)",
    "total_actual_cost": "PLACEHOLDER_TOTAL_ACTUAL_COST (number)",
    "today_requests": "PLACEHOLDER_TODAY_REQUESTS (integer)",
    "today_input_tokens": "PLACEHOLDER_TODAY_INPUT_TOKENS (integer)",
    "today_output_tokens": "PLACEHOLDER_TODAY_OUTPUT_TOKENS (integer)",
    "today_cache_creation_tokens": "PLACEHOLDER_TODAY_CACHE_CREATION_TOKENS (integer)",
    "today_cache_read_tokens": "PLACEHOLDER_TODAY_CACHE_READ_TOKENS (integer)",
    "today_tokens": "PLACEHOLDER_TODAY_TOKENS (integer)",
    "today_cost": "PLACEHOLDER_TODAY_COST (number)",
    "today_actual_cost": "PLACEHOLDER_TODAY_ACTUAL_COST (number)",
    "average_duration_ms": "PLACEHOLDER_AVERAGE_DURATION_MS (number)",
    "rpm": "PLACEHOLDER_RPM (integer)",
    "tpm": "PLACEHOLDER_TPM (integer)"
  }
}
```

Particolarità: Tutti i dati personali e gli oggetti sono limitati al soggetto JWT.

**GET /api/v1/usage/dashboard/trend** — Andamento dell’utilizzo

Accesso: token dell’area personale

GET`/api/v1/usage/dashboard/trend`

Lettura; l’ID si ricava dalla risposta precedente che hai ricevuto

```bash
curl --fail-with-body "https://ailoot.ai/api/v1/usage/dashboard/trend" \
  -H "Authorization: Bearer $TOKEN"
```

## Parametri query

| Il campo | Tipo | Obbligatorio | Verifica / descrizione |
| --- | --- | --- | --- |
| `granularity` | `string` | no | ; predefinito: day |
| `api_key_id` | `integer` | no |  |
| `request_type` | `string` | no |  |
| `stream` | `boolean` | no |  |
| `timezone` | `string` | no |  |
| `start_date` | `string` | no |  |
| `end_date` | `string` | no |  |
| `period` | `string` | no |  |
| `model` | `string` | no |  |

Il corpo della richiesta non è necessario. Passa i parametri indicati sopra nell’URL.

## Risposta

La risposta JSON contiene code, message e data. Il contenuto di data è descritto negli schemi sotto.

Schema della risposta, valori illustrativi

```json
{
  "code": 0,
  "message": "success",
  "data": {
    "end_date": "VALUE_FROM_RESPONSE",
    "granularity": "VALUE_FROM_RESPONSE",
    "month": "VALUE_FROM_RESPONSE",
    "start_date": "VALUE_FROM_RESPONSE",
    "today": "VALUE_FROM_RESPONSE",
    "trend": "VALUE_FROM_RESPONSE",
    "week": "VALUE_FROM_RESPONSE"
  }
}
```

Particolarità: Tutti i dati personali e gli oggetti sono limitati al soggetto JWT.

**GET /api/v1/usage/errors** — Cronologia degli errori

Accesso: token dell’area personale

GET`/api/v1/usage/errors`

Lettura; l’ID si ricava dalla risposta precedente che hai ricevuto

```bash
curl --fail-with-body "https://ailoot.ai/api/v1/usage/errors" \
  -H "Authorization: Bearer $TOKEN"
```

## Parametri query

| Il campo | Tipo | Obbligatorio | Verifica / descrizione |
| --- | --- | --- | --- |
| `timezone` | `string` | no |  |
| `start_date` | `string` | no |  |
| `end_date` | `string` | no |  |
| `model` | `string` | no |  |
| `api_key_id` | `integer` | no |  |
| `status_code` | `integer` | no |  |
| `category` | `string` | no |  |
| `sort_by` | `string` | no |  |
| `sort_order` | `string` | no |  |
| `page` | `integer` | no | ; predefinito: 1; positivo; page\_size/limit \<=1000 |
| `page_size` | `integer` | no | ; predefinito: 20; positivo; page\_size/limit \<=1000 |
| `limit` | `integer` | no | ; predefinito: 20; positivo; page\_size/limit \<=1000 |

Il corpo della richiesta non è necessario. Passa i parametri indicati sopra nell’URL.

## Risposta

La risposta JSON contiene code, message e data. Il contenuto di data è descritto negli schemi sotto.

Schema della risposta, valori illustrativi

```json
{
  "code": 0,
  "message": "success",
  "data": {
    "items": [
      "PLACEHOLDER_DATA (object, descrizione nella pagina «Schemi dei dati»)"
    ],
    "total": "PLACEHOLDER_TOTAL (integer)",
    "page": "PLACEHOLDER_PAGE (integer)",
    "page_size": "PLACEHOLDER_PAGE_SIZE (integer)",
    "pages": "PLACEHOLDER_PAGES (integer)"
  }
}
```

Particolarità: Tutti i dati personali e gli oggetti sono limitati al soggetto JWT.

**GET /api/v1/usage/errors/:id** — Dettagli di un proprio errore

Accesso: token dell’area personale

GET`/api/v1/usage/errors/:id`

Lettura; l’ID si ricava dalla risposta precedente che hai ricevuto

```bash
curl --fail-with-body "https://ailoot.ai/api/v1/usage/errors/$ID" \
  -H "Authorization: Bearer $TOKEN"
```

## Parametri del percorso

| Il campo | Tipo | Obbligatorio | Verifica / descrizione |
| --- | --- | --- | --- |
| `id` | `integer` | sì |  |

Il corpo della richiesta non è necessario. Passa i parametri indicati sopra nell’URL.

## Risposta

La risposta JSON contiene code, message e data. Il contenuto di data è descritto negli schemi sotto.

Schema della risposta, valori illustrativi

```json
{
  "code": 0,
  "message": "success",
  "data": "PLACEHOLDER_DATA (object, descrizione nella pagina «Schemi dei dati»)"
}
```

Particolarità: Tutti i dati personali e gli oggetti sono limitati al soggetto JWT.

**GET /api/v1/usage/stats** — Statistiche di utilizzo

Accesso: token dell’area personale

GET`/api/v1/usage/stats`

Lettura; l’ID si ricava dalla risposta precedente che hai ricevuto

```bash
curl --fail-with-body "https://ailoot.ai/api/v1/usage/stats" \
  -H "Authorization: Bearer $TOKEN"
```

## Parametri query

| Il campo | Tipo | Obbligatorio | Verifica / descrizione |
| --- | --- | --- | --- |
| `api_key_id` | `integer` | no |  |
| `request_type` | `string` | no |  |
| `stream` | `boolean` | no |  |
| `timezone` | `string` | no |  |
| `start_date` | `string` | no |  |
| `end_date` | `string` | no |  |
| `period` | `string` | no |  |
| `model` | `string` | no |  |

Il corpo della richiesta non è necessario. Passa i parametri indicati sopra nell’URL.

## Risposta

La risposta JSON contiene code, message e data. Il contenuto di data è descritto negli schemi sotto.

Schemi dei dati della risposta: `UsageStats`. Campi e tipi sono nelle pagine «Schemi dei dati».

Schema della risposta, valori illustrativi

```json
{
  "code": 0,
  "message": "success",
  "data": {
    "total_requests": "PLACEHOLDER_TOTAL_REQUESTS (integer)",
    "total_input_tokens": "PLACEHOLDER_TOTAL_INPUT_TOKENS (integer)",
    "total_output_tokens": "PLACEHOLDER_TOTAL_OUTPUT_TOKENS (integer)",
    "total_cache_tokens": "PLACEHOLDER_TOTAL_CACHE_TOKENS (integer)",
    "total_cache_creation_tokens": "PLACEHOLDER_TOTAL_CACHE_CREATION_TOKENS (integer)",
    "total_cache_read_tokens": "PLACEHOLDER_TOTAL_CACHE_READ_TOKENS (integer)",
    "total_tokens": "PLACEHOLDER_TOTAL_TOKENS (integer)",
    "total_cost": "PLACEHOLDER_TOTAL_COST (number)",
    "total_actual_cost": "PLACEHOLDER_TOTAL_ACTUAL_COST (number)",
    "average_duration_ms": "PLACEHOLDER_AVERAGE_DURATION_MS (number)",
    "endpoints": "PLACEHOLDER_ENDPOINTS (array)"
  }
}
```

Particolarità: Tutti i dati personali e gli oggetti sono limitati al soggetto JWT.

**GET /api/v1/user/api-keys/:id/usage/daily** — Statistiche giornaliere della propria chiave API

Accesso: token dell’area personale

GET`/api/v1/user/api-keys/:id/usage/daily`

Lettura; l’ID si ricava dalla risposta precedente che hai ricevuto

```bash
curl --fail-with-body "https://ailoot.ai/api/v1/user/api-keys/$ID/usage/daily" \
  -H "Authorization: Bearer $TOKEN"
```

## Parametri del percorso

| Il campo | Tipo | Obbligatorio | Verifica / descrizione |
| --- | --- | --- | --- |
| `id` | `integer` | sì |  |

## Parametri query

| Il campo | Tipo | Obbligatorio | Verifica / descrizione |
| --- | --- | --- | --- |
| `days` | `integer` | no | ; predefinito: 30 |
| `timezone` | `string` | no |  |

Il corpo della richiesta non è necessario. Passa i parametri indicati sopra nell’URL.

## Risposta

La risposta JSON contiene code, message e data. Il contenuto di data è descritto negli schemi sotto.

Schemi dei dati della risposta: `APIKeyDailyUsagePoint`. Campi e tipi sono nelle pagine «Schemi dei dati».

Schema della risposta, valori illustrativi

```json
{
  "code": 0,
  "message": "success",
  "data": {
    "date": "PLACEHOLDER_DATE (string)",
    "requests": "PLACEHOLDER_REQUESTS (integer)",
    "input_tokens": "PLACEHOLDER_INPUT_TOKENS (integer)",
    "output_tokens": "PLACEHOLDER_OUTPUT_TOKENS (integer)",
    "cache_read_tokens": "PLACEHOLDER_CACHE_READ_TOKENS (integer)",
    "cache_write_tokens": "PLACEHOLDER_CACHE_WRITE_TOKENS (integer)",
    "total_tokens": "PLACEHOLDER_TOTAL_TOKENS (integer)",
    "cost": "PLACEHOLDER_COST (number)",
    "actual_cost": "PLACEHOLDER_ACTUAL_COST (number)"
  }
}
```

Particolarità: Tutti i dati personali e gli oggetti sono limitati al soggetto JWT.

## Cronologia e spese · USD

total\_cost è il costo calcolato in base alla tariffa; actual\_cost è l’addebito registrato in USD.

### Esempio di calcolo

```json
{
  "total_cost": 0.1,
  "actual_cost": 0.08
}
```

`period ∈ {today, week, month}`; `start_date, end_date: YYYY-MM-DD`; `timezone: IANA` · `timezone=UTC`. `end_date`: `[00:00, +1 day 00:00)`. `display: actual_cost.toFixed(8)`; `JSON: number`.

Hai altre domande? Invia il Request ID e una descrizione — ti aiuteremo a chiarire il problema.[Contatta l’assistenza](mailto:support@ailoot.ai)

## Ailoot · L’azienda e il suo portafoglio di progetti





Ailoot si basa su un’esperienza operativa consolidata, un’ampia base di clienti, un servizio stabile e un controllo costante dei KPI.





L’azienda e il suo portafoglio di progetti: milioni di clienti; vendite nell’ordine dei miliardi ogni mese.





Ailoot mette questa esperienza operativa al servizio dell’accesso API alle funzioni AI nei prodotti dei clienti, negli agenti, nelle applicazioni e nelle automazioni.
