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

[API del panel de control](https://ailoot.ai/docs/es/) 

# Historial y gastos

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

Métodos, campos de las solicitudes y respuestas.

Esta sección contiene 11 métodos. Abre un método para consultar las condiciones de acceso, los campos de la solicitud y la respuesta.

| Método y ruta | Descripción | Acceso |
| --- | --- | --- |
| `GET /api/v1/usage` | Historial de solicitudes | Token del panel de control |
| `GET /api/v1/usage/:id` | Una solicitud del historial | Token del panel de control |
| `POST /api/v1/usage/dashboard/api-keys-usage` | Estadísticas de tus claves API | Token del panel de control |
| `GET /api/v1/usage/dashboard/models` | Uso por modelos | Token del panel de control |
| `GET /api/v1/usage/dashboard/snapshot-v2` | Instantánea conjunta de los gráficos | Token del panel de control |
| `GET /api/v1/usage/dashboard/stats` | Resumen de uso | Token del panel de control |
| `GET /api/v1/usage/dashboard/trend` | Evolución del uso | Token del panel de control |
| `GET /api/v1/usage/errors` | Historial de errores | Token del panel de control |
| `GET /api/v1/usage/errors/:id` | Detalles de un error propio | Token del panel de control |
| `GET /api/v1/usage/stats` | Estadísticas de uso | Token del panel de control |
| `GET /api/v1/user/api-keys/:id/usage/daily` | Estadísticas diarias de tu clave API | Token del panel de control |

**GET /api/v1/usage** — Historial de solicitudes

Acceso: token del panel de control

GET`/api/v1/usage`

Lectura; el ID se obtiene de tu respuesta anterior

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

## Parámetros de consulta

| El campo | Tipo | Obligatorio | Validación / descripción |
| --- | --- | --- | --- |
| `sort_by` | `string` | no | ; valor predeterminado: created\_at |
| `sort_order` | `string` | no | ; valor predeterminado: 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 | ; valor predeterminado: 1; valor positivo; page\_size/limit \<=1000 |
| `page_size` | `integer` | no | ; valor predeterminado: 20; valor positivo; page\_size/limit \<=1000 |
| `limit` | `integer` | no | ; valor predeterminado: 20; valor positivo; page\_size/limit \<=1000 |

No se necesita cuerpo de solicitud. Envía los parámetros anteriores en la URL.

## Respuesta

La respuesta JSON contiene code, message y data. El contenido de data se describe en los esquemas siguientes.

Esquemas de datos de la respuesta: `UsageLog`. Los campos y los tipos se describen en las páginas «Esquemas de datos».

Esquema de respuesta con valores ilustrativos

```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)"
  }
}
```

Notas: todos los datos personales y los objetos quedan limitados al sujeto del JWT.

**GET /api/v1/usage/:id** — Una solicitud del historial

Acceso: token del panel de control

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

Lectura; el ID se obtiene de tu respuesta anterior

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

## Parámetros de ruta

| El campo | Tipo | Obligatorio | Validación / descripción |
| --- | --- | --- | --- |
| `id` | `integer` | sí |  |

No se necesita cuerpo de solicitud. Envía los parámetros anteriores en la URL.

## Respuesta

La respuesta JSON contiene code, message y data. El contenido de data se describe en los esquemas siguientes.

Esquemas de datos de la respuesta: `UsageLog`. Los campos y los tipos se describen en las páginas «Esquemas de datos».

Esquema de respuesta con valores ilustrativos

```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)"
  }
}
```

Notas: todos los datos personales y los objetos quedan limitados al sujeto del JWT.

**POST /api/v1/usage/dashboard/api-keys-usage** — Estadísticas de tus claves API

Acceso: token del panel de control

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

## Campos JSON / formulario

| El campo | Tipo | Obligatorio | Validación / descripción |
| --- | --- | --- | --- |
| `api_key_ids` | `array` | sí | required |

Plantilla del cuerpo de la solicitud

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

PLACEHOLDER representa tu entrada y su tipo. Sustituye los valores y conserva solo los campos opcionales que necesites; los marcadores de cadena no se envían en lugar de números, boolean, objetos o arrays.

Esquema de la solicitud: `BatchAPIKeysUsageRequest`

## Respuesta

La respuesta JSON contiene code, message y data. El contenido de data se describe en los esquemas siguientes.

Esquemas de datos de la respuesta: `BatchAPIKeyUsageStats`. Los campos y los tipos se describen en las páginas «Esquemas de datos».

Esquema de respuesta con valores ilustrativos

```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)"
  }
}
```

Notas: todos los datos personales y los objetos quedan limitados al sujeto del JWT.

Notas: el método consulta las estadísticas de tus propias claves API; el ejemplo describe el contrato y no se ejecuta.

El método devuelve estadísticas y no modifica las claves API ni los gastos. Para volver a consultar los datos no hace falta Idempotency-Key; la respuesta refleja el estado en el momento de la solicitud.

**GET /api/v1/usage/dashboard/models** — Uso por modelos

Acceso: token del panel de control

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

Lectura; el ID se obtiene de tu respuesta anterior

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

## Parámetros de consulta

| El campo | Tipo | Obligatorio | Validación / descripción |
| --- | --- | --- | --- |
| `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 |  |

No se necesita cuerpo de solicitud. Envía los parámetros anteriores en la URL.

## Respuesta

La respuesta JSON contiene code, message y data. El contenido de data se describe en los esquemas siguientes.

Esquema de respuesta con valores ilustrativos

```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"
  }
}
```

Notas: todos los datos personales y los objetos quedan limitados al sujeto del JWT.

**GET /api/v1/usage/dashboard/snapshot-v2** — Instantánea conjunta de los gráficos

Acceso: token del panel de control

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

Lectura; el ID se obtiene de tu respuesta anterior

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

## Parámetros de consulta

| El campo | Tipo | Obligatorio | Validación / descripción |
| --- | --- | --- | --- |
| `granularity` | `string` | no | ; valor predeterminado: day |
| `include_trend` | `boolean` | no | ; valor predeterminado: true |
| `include_model_stats` | `boolean` | no | ; valor predeterminado: 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 |  |

No se necesita cuerpo de solicitud. Envía los parámetros anteriores en la URL.

## Respuesta

La respuesta JSON contiene code, message y data. El contenido de data se describe en los esquemas siguientes.

Esquema de respuesta con valores ilustrativos

```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"
  }
}
```

Notas: todos los datos personales y los objetos quedan limitados al sujeto del JWT.

**GET /api/v1/usage/dashboard/stats** — Resumen de uso

Acceso: token del panel de control

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

Lectura; el ID se obtiene de tu respuesta anterior

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

No se necesita cuerpo de solicitud. Envía los parámetros anteriores en la URL.

## Respuesta

La respuesta JSON contiene code, message y data. El contenido de data se describe en los esquemas siguientes.

Esquemas de datos de la respuesta: `UserDashboardStats`. Los campos y los tipos se describen en las páginas «Esquemas de datos».

Esquema de respuesta con valores ilustrativos

```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)"
  }
}
```

Notas: todos los datos personales y los objetos quedan limitados al sujeto del JWT.

**GET /api/v1/usage/dashboard/trend** — Evolución del uso

Acceso: token del panel de control

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

Lectura; el ID se obtiene de tu respuesta anterior

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

## Parámetros de consulta

| El campo | Tipo | Obligatorio | Validación / descripción |
| --- | --- | --- | --- |
| `granularity` | `string` | no | ; valor predeterminado: 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 |  |

No se necesita cuerpo de solicitud. Envía los parámetros anteriores en la URL.

## Respuesta

La respuesta JSON contiene code, message y data. El contenido de data se describe en los esquemas siguientes.

Esquema de respuesta con valores ilustrativos

```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"
  }
}
```

Notas: todos los datos personales y los objetos quedan limitados al sujeto del JWT.

**GET /api/v1/usage/errors** — Historial de errores

Acceso: token del panel de control

GET`/api/v1/usage/errors`

Lectura; el ID se obtiene de tu respuesta anterior

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

## Parámetros de consulta

| El campo | Tipo | Obligatorio | Validación / descripción |
| --- | --- | --- | --- |
| `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 | ; valor predeterminado: 1; valor positivo; page\_size/limit \<=1000 |
| `page_size` | `integer` | no | ; valor predeterminado: 20; valor positivo; page\_size/limit \<=1000 |
| `limit` | `integer` | no | ; valor predeterminado: 20; valor positivo; page\_size/limit \<=1000 |

No se necesita cuerpo de solicitud. Envía los parámetros anteriores en la URL.

## Respuesta

La respuesta JSON contiene code, message y data. El contenido de data se describe en los esquemas siguientes.

Esquema de respuesta con valores ilustrativos

```json
{
  "code": 0,
  "message": "success",
  "data": {
    "items": [
      "PLACEHOLDER_DATA (object, descripción en la página «Esquemas de datos»)"
    ],
    "total": "PLACEHOLDER_TOTAL (integer)",
    "page": "PLACEHOLDER_PAGE (integer)",
    "page_size": "PLACEHOLDER_PAGE_SIZE (integer)",
    "pages": "PLACEHOLDER_PAGES (integer)"
  }
}
```

Notas: todos los datos personales y los objetos quedan limitados al sujeto del JWT.

**GET /api/v1/usage/errors/:id** — Detalles de un error propio

Acceso: token del panel de control

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

Lectura; el ID se obtiene de tu respuesta anterior

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

## Parámetros de ruta

| El campo | Tipo | Obligatorio | Validación / descripción |
| --- | --- | --- | --- |
| `id` | `integer` | sí |  |

No se necesita cuerpo de solicitud. Envía los parámetros anteriores en la URL.

## Respuesta

La respuesta JSON contiene code, message y data. El contenido de data se describe en los esquemas siguientes.

Esquema de respuesta con valores ilustrativos

```json
{
  "code": 0,
  "message": "success",
  "data": "PLACEHOLDER_DATA (object, descripción en la página «Esquemas de datos»)"
}
```

Notas: todos los datos personales y los objetos quedan limitados al sujeto del JWT.

**GET /api/v1/usage/stats** — Estadísticas de uso

Acceso: token del panel de control

GET`/api/v1/usage/stats`

Lectura; el ID se obtiene de tu respuesta anterior

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

## Parámetros de consulta

| El campo | Tipo | Obligatorio | Validación / descripción |
| --- | --- | --- | --- |
| `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 |  |

No se necesita cuerpo de solicitud. Envía los parámetros anteriores en la URL.

## Respuesta

La respuesta JSON contiene code, message y data. El contenido de data se describe en los esquemas siguientes.

Esquemas de datos de la respuesta: `UsageStats`. Los campos y los tipos se describen en las páginas «Esquemas de datos».

Esquema de respuesta con valores ilustrativos

```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)"
  }
}
```

Notas: todos los datos personales y los objetos quedan limitados al sujeto del JWT.

**GET /api/v1/user/api-keys/:id/usage/daily** — Estadísticas diarias de tu clave API

Acceso: token del panel de control

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

Lectura; el ID se obtiene de tu respuesta anterior

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

## Parámetros de ruta

| El campo | Tipo | Obligatorio | Validación / descripción |
| --- | --- | --- | --- |
| `id` | `integer` | sí |  |

## Parámetros de consulta

| El campo | Tipo | Obligatorio | Validación / descripción |
| --- | --- | --- | --- |
| `days` | `integer` | no | ; valor predeterminado: 30 |
| `timezone` | `string` | no |  |

No se necesita cuerpo de solicitud. Envía los parámetros anteriores en la URL.

## Respuesta

La respuesta JSON contiene code, message y data. El contenido de data se describe en los esquemas siguientes.

Esquemas de datos de la respuesta: `APIKeyDailyUsagePoint`. Los campos y los tipos se describen en las páginas «Esquemas de datos».

Esquema de respuesta con valores ilustrativos

```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)"
  }
}
```

Notas: todos los datos personales y los objetos quedan limitados al sujeto del JWT.

## Historial y gastos · USD

total\_cost es el coste calculado según la tarifa; actual\_cost es el cargo registrado en USD.

### Ejemplo de cálculo

```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`.

¿Tienes alguna pregunta? Envíanos el Request ID y una descripción; te ayudaremos a resolverla.[Contactar con soporte](mailto:support@ailoot.ai)

## Ailoot · La empresa y su cartera de proyectos





Ailoot se apoya en la experiencia operativa acumulada, una amplia base de clientes, un servicio estable y el seguimiento continuo de KPI.





La empresa y su cartera de proyectos: millones de clientes; ventas por miles de millones al mes.





Ailoot aplica esa experiencia operativa al acceso por API a funciones de IA en productos de clientes, agentes, aplicaciones y automatizaciones.
