# Admin

## Get Llm Info

`admin.get_llms_info()  -> AdminGetLlmsInfoResponse`

**get** `/api/v1/admin/llms/info`

Get Llm Info

### Returns

- `class AdminGetLlmsInfoResponse: …`

  - `llm_info: Dict[str, Dict[str, LlmInfoLlmInfoItem]]`

    - `internal_model_name: Optional[str]`

    - `valid: bool`

    - `error_message: Optional[str]`

    - `last_validated: Optional[datetime]`

### Example

```python
import os
from llama_cloud_admin import LlamaCloudAdmin

client = LlamaCloudAdmin(
    api_key=os.environ.get("LLAMA_CLOUD_API_KEY"),  # This is the default and can be omitted
)
response = client.admin.get_llms_info()
print(response.llm_info)
```

#### Response

```json
{
  "llm_info": {
    "foo": {
      "foo": {
        "internal_model_name": "internal_model_name",
        "valid": true,
        "error_message": "error_message",
        "last_validated": "2019-12-27T18:11:19.117Z"
      }
    }
  }
}
```

## Get License Info

`admin.get_license_info(AdminGetLicenseInfoParams**kwargs)  -> AdminGetLicenseInfoResponse`

**get** `/api/v1/admin/license/info`

Get License Info

### Parameters

- `include_scopes: Optional[bool]`

  Whether to include scopes in the response

### Returns

- `class AdminGetLicenseInfoResponse: …`

  - `expires_at: datetime`

    License expiration date

  - `status: str`

    License validation status

  - `message: Optional[str]`

    License message

  - `scopes: Optional[List[str]]`

    License scopes

### Example

```python
import os
from llama_cloud_admin import LlamaCloudAdmin

client = LlamaCloudAdmin(
    api_key=os.environ.get("LLAMA_CLOUD_API_KEY"),  # This is the default and can be omitted
)
response = client.admin.get_license_info()
print(response.expires_at)
```

#### Response

```json
{
  "expires_at": "2019-12-27T18:11:19.117Z",
  "status": "status",
  "message": "message",
  "scopes": [
    "string"
  ]
}
```

## Get File Store Info

`admin.get_filestores_info()  -> AdminGetFilestoresInfoResponse`

**get** `/api/v1/admin/filestores/info`

Get File Store Info

### Returns

- `class AdminGetFilestoresInfoResponse: …`

  - `status: Literal["missing_buckets", "missing_credentials", "ok"]`

    - `"missing_buckets"`

    - `"missing_credentials"`

    - `"ok"`

  - `available_buckets: Optional[Dict[str, str]]`

  - `unavailable_buckets: Optional[Dict[str, str]]`

### Example

```python
import os
from llama_cloud_admin import LlamaCloudAdmin

client = LlamaCloudAdmin(
    api_key=os.environ.get("LLAMA_CLOUD_API_KEY"),  # This is the default and can be omitted
)
response = client.admin.get_filestores_info()
print(response.status)
```

#### Response

```json
{
  "status": "missing_buckets",
  "available_buckets": {
    "foo": "string"
  },
  "unavailable_buckets": {
    "foo": "string"
  }
}
```

## Get Llamaextract Features

`admin.get_llamaextract_features()  -> AdminGetLlamaextractFeaturesResponse`

**get** `/api/v1/admin/llamaextract/features`

Get LlamaExtract feature availability based on available models.

### Returns

- `class AdminGetLlamaextractFeaturesResponse: …`

  - `available_modes: List[AvailableMode]`

    - `mode: str`

    - `parse_mode: str`

    - `status: Literal["available", "unavailable"]`

      - `"available"`

      - `"unavailable"`

    - `available_extract_models: Optional[List[str]]`

    - `available_parse_models: Optional[List[str]]`

    - `missing_extract_models: Optional[List[str]]`

    - `missing_parse_models: Optional[List[str]]`

  - `schema_generation: SchemaGeneration`

    - `model: str`

    - `status: Literal["available", "unavailable"]`

      - `"available"`

      - `"unavailable"`

### Example

```python
import os
from llama_cloud_admin import LlamaCloudAdmin

client = LlamaCloudAdmin(
    api_key=os.environ.get("LLAMA_CLOUD_API_KEY"),  # This is the default and can be omitted
)
response = client.admin.get_llamaextract_features()
print(response.available_modes)
```

#### Response

```json
{
  "available_modes": [
    {
      "mode": "mode",
      "parse_mode": "parse_mode",
      "status": "available",
      "available_extract_models": [
        "string"
      ],
      "available_parse_models": [
        "string"
      ],
      "missing_extract_models": [
        "string"
      ],
      "missing_parse_models": [
        "string"
      ]
    }
  ],
  "schema_generation": {
    "model": "model",
    "status": "available"
  }
}
```

## Get Ocr Health

`admin.get_ocr_status()  -> AdminGetOcrStatusResponse`

**get** `/api/v1/admin/ocr/statusz`

Get OCR service health status including GPU availability.

### Returns

- `class AdminGetOcrStatusResponse: …`

  Response model for OCR service health/GPU status.

  - `status: Literal["degraded", "ok", "unavailable"]`

    - `"degraded"`

    - `"ok"`

    - `"unavailable"`

  - `device: Optional[str]`

  - `error_message: Optional[str]`

  - `gpu_available: Optional[bool]`

  - `gpu_device_count: Optional[int]`

  - `gpu_device_name: Optional[str]`

### Example

```python
import os
from llama_cloud_admin import LlamaCloudAdmin

client = LlamaCloudAdmin(
    api_key=os.environ.get("LLAMA_CLOUD_API_KEY"),  # This is the default and can be omitted
)
response = client.admin.get_ocr_status()
print(response.status)
```

#### Response

```json
{
  "status": "degraded",
  "device": "device",
  "error_message": "error_message",
  "gpu_available": true,
  "gpu_device_count": 0,
  "gpu_device_name": "gpu_device_name"
}
```

## Domain Types

### Admin Get Llms Info Response

- `class AdminGetLlmsInfoResponse: …`

  - `llm_info: Dict[str, Dict[str, LlmInfoLlmInfoItem]]`

    - `internal_model_name: Optional[str]`

    - `valid: bool`

    - `error_message: Optional[str]`

    - `last_validated: Optional[datetime]`

### Admin Get License Info Response

- `class AdminGetLicenseInfoResponse: …`

  - `expires_at: datetime`

    License expiration date

  - `status: str`

    License validation status

  - `message: Optional[str]`

    License message

  - `scopes: Optional[List[str]]`

    License scopes

### Admin Get Filestores Info Response

- `class AdminGetFilestoresInfoResponse: …`

  - `status: Literal["missing_buckets", "missing_credentials", "ok"]`

    - `"missing_buckets"`

    - `"missing_credentials"`

    - `"ok"`

  - `available_buckets: Optional[Dict[str, str]]`

  - `unavailable_buckets: Optional[Dict[str, str]]`

### Admin Get Llamaextract Features Response

- `class AdminGetLlamaextractFeaturesResponse: …`

  - `available_modes: List[AvailableMode]`

    - `mode: str`

    - `parse_mode: str`

    - `status: Literal["available", "unavailable"]`

      - `"available"`

      - `"unavailable"`

    - `available_extract_models: Optional[List[str]]`

    - `available_parse_models: Optional[List[str]]`

    - `missing_extract_models: Optional[List[str]]`

    - `missing_parse_models: Optional[List[str]]`

  - `schema_generation: SchemaGeneration`

    - `model: str`

    - `status: Literal["available", "unavailable"]`

      - `"available"`

      - `"unavailable"`

### Admin Get Ocr Status Response

- `class AdminGetOcrStatusResponse: …`

  Response model for OCR service health/GPU status.

  - `status: Literal["degraded", "ok", "unavailable"]`

    - `"degraded"`

    - `"ok"`

    - `"unavailable"`

  - `device: Optional[str]`

  - `error_message: Optional[str]`

  - `gpu_available: Optional[bool]`

  - `gpu_device_count: Optional[int]`

  - `gpu_device_name: Optional[str]`

# Users

## Get User Claims

`admin.users.get_claims(struser_id)  -> UserClaims`

**get** `/api/v1/admin/users/{user_id}/claims`

Get a user's resolved custom claims.

Claims that have not been explicitly set fall back to their system default. Returns 404 if the user does not exist.

Global admin only.

### Parameters

- `user_id: str`

### Returns

- `class UserClaims: …`

  A user's fully resolved custom claims after applying system defaults.

  - `claims: CustomClaims`

    The user's resolved custom claims.

    - `allow_org_deletion: Optional[bool]`

      Whether the user is allowed to delete organizations.

    - `allowed_org_creation: Optional[bool]`

      Whether the user is allowed to create organizations.

    - `api_datasource_access: Optional[bool]`

      Whether the user is allowed to access API data sources.

    - `maximum_org_creation: Optional[int]`

      Cap on how many organizations this user may create. None means unlimited. Only enforced when allowed_org_creation is True.

  - `user_id: str`

    The user ID the claims belong to.

### Example

```python
import os
from llama_cloud_admin import LlamaCloudAdmin

client = LlamaCloudAdmin(
    api_key=os.environ.get("LLAMA_CLOUD_API_KEY"),  # This is the default and can be omitted
)
user_claims = client.admin.users.get_claims(
    "user_id",
)
print(user_claims.user_id)
```

#### Response

```json
{
  "claims": {
    "allow_org_deletion": true,
    "allowed_org_creation": true,
    "api_datasource_access": true,
    "maximum_org_creation": 0
  },
  "user_id": "user_id"
}
```

## Update User Claims

`admin.users.update_claims(struser_id, UserUpdateClaimsParams**kwargs)  -> UserClaims`

**patch** `/api/v1/admin/users/{user_id}/claims`

Additively update a user's custom claims.

Claims in `set_claims` are added or overwritten; claims named in `remove_claims` are reset to their system default. Claims not referenced by either field are left unchanged, so a single claim can be changed without resending the full set. Returns the user's resolved claims after the update.

Returns 404 if the user does not exist.

Global admin only.

### Parameters

- `user_id: str`

- `remove_claims: Optional[List[Literal["allow_org_deletion", "allowed_org_creation", "api_datasource_access", "maximum_org_creation"]]]`

  Names of claims to reset to their system default.

  - `"allow_org_deletion"`

  - `"allowed_org_creation"`

  - `"api_datasource_access"`

  - `"maximum_org_creation"`

- `set_claims: Optional[SetClaims]`

  A partial set of custom claims for additive updates.

  Every field is optional. Only the claims explicitly provided in a request
  are added or overwritten; claims left unset are not touched, so callers can
  change a single claim without resending the full claim set.

  - `allow_org_deletion: Optional[bool]`

    Whether the user is allowed to delete organizations.

  - `allowed_org_creation: Optional[bool]`

    Whether the user is allowed to create organizations.

  - `api_datasource_access: Optional[bool]`

    Whether the user is allowed to access API data sources.

  - `maximum_org_creation: Optional[int]`

    Cap on how many organizations this user may create. None means unlimited. Only enforced when allowed_org_creation is True.

### Returns

- `class UserClaims: …`

  A user's fully resolved custom claims after applying system defaults.

  - `claims: CustomClaims`

    The user's resolved custom claims.

    - `allow_org_deletion: Optional[bool]`

      Whether the user is allowed to delete organizations.

    - `allowed_org_creation: Optional[bool]`

      Whether the user is allowed to create organizations.

    - `api_datasource_access: Optional[bool]`

      Whether the user is allowed to access API data sources.

    - `maximum_org_creation: Optional[int]`

      Cap on how many organizations this user may create. None means unlimited. Only enforced when allowed_org_creation is True.

  - `user_id: str`

    The user ID the claims belong to.

### Example

```python
import os
from llama_cloud_admin import LlamaCloudAdmin

client = LlamaCloudAdmin(
    api_key=os.environ.get("LLAMA_CLOUD_API_KEY"),  # This is the default and can be omitted
)
user_claims = client.admin.users.update_claims(
    user_id="user_id",
)
print(user_claims.user_id)
```

#### Response

```json
{
  "claims": {
    "allow_org_deletion": true,
    "allowed_org_creation": true,
    "api_datasource_access": true,
    "maximum_org_creation": 0
  },
  "user_id": "user_id"
}
```

## Domain Types

### Custom Claims

- `class CustomClaims: …`

  Custom claims that dictate various limits or allowed behaviors.
  Currently these claims reside at a per user level. Claims may expand to a per organization level or project in the future.

  - `allow_org_deletion: Optional[bool]`

    Whether the user is allowed to delete organizations.

  - `allowed_org_creation: Optional[bool]`

    Whether the user is allowed to create organizations.

  - `api_datasource_access: Optional[bool]`

    Whether the user is allowed to access API data sources.

  - `maximum_org_creation: Optional[int]`

    Cap on how many organizations this user may create. None means unlimited. Only enforced when allowed_org_creation is True.

### User Claims

- `class UserClaims: …`

  A user's fully resolved custom claims after applying system defaults.

  - `claims: CustomClaims`

    The user's resolved custom claims.

    - `allow_org_deletion: Optional[bool]`

      Whether the user is allowed to delete organizations.

    - `allowed_org_creation: Optional[bool]`

      Whether the user is allowed to create organizations.

    - `api_datasource_access: Optional[bool]`

      Whether the user is allowed to access API data sources.

    - `maximum_org_creation: Optional[int]`

      Cap on how many organizations this user may create. None means unlimited. Only enforced when allowed_org_creation is True.

  - `user_id: str`

    The user ID the claims belong to.

# Usage Metrics

## Aggregate Usage Metrics

`admin.usage_metrics.aggregate(UsageMetricAggregateParams**kwargs)  -> UsageMetricAggregateResponse`

**get** `/api/v1/admin/usage-metrics/aggregate`

Aggregate usage metrics by one or more dimensions, reporting total credits used. Global admin only.

A date range is required, which bounds the scan via the `day`-leading index. Supplying `organization_id` narrows it further via the `(organization_id, day)` index.

Supported `group_by` dimensions: `day`, `organization_id`, `project_id`, `event_type`, `user_id`. Buckets are ordered by total credits descending.

### Parameters

- `day_on_or_after: str`

  Inclusive lower bound on the day (YYYY-MM-DD, UTC)

- `day_on_or_before: str`

  Inclusive upper bound on the day (YYYY-MM-DD, UTC)

- `group_by: Sequence[str]`

  Dimensions to group by: day, organization_id, project_id, event_type, user_id

- `event_types: Optional[List[Literal["audio_seconds_parsed", "chart_parsing_agentic", "chart_parsing_efficient", 27 more]]]`

  Filter by event types

  - `"audio_seconds_parsed"`

  - `"chart_parsing_agentic"`

  - `"chart_parsing_efficient"`

  - `"chart_parsing_plus"`

  - `"chat_message_sent"`

  - `"confidence_score_high"`

  - `"directory_count_snapshot"`

  - `"directory_file_count_snapshot"`

  - `"directory_files_exported"`

  - `"directory_files_ingested"`

  - `"directory_pages_exported"`

  - `"extraction_num_pages"`

  - `"form_parsing_pages"`

  - `"image_classified"`

  - `"index_retrieve_query"`

  - `"layout_aware_chart_extraction"`

  - `"layout_aware_parsing"`

  - `"layout_extracted"`

  - `"pages_classified"`

  - `"pages_embedded"`

  - `"pages_indexed"`

  - `"pages_parsed"`

  - `"pages_split"`

  - `"pages_verified"`

  - `"precise_bbox_extraction"`

  - `"set_total_indexes"`

  - `"set_total_pages_indexed"`

  - `"spreadsheet_regions_extracted"`

  - `"stored_file_count"`

  - `"stored_file_mb"`

- `organization_id: Optional[str]`

  Filter by organization ID

- `project_id: Optional[str]`

  Filter by project ID

- `user_id: Optional[str]`

  Filter by user ID

### Returns

- `class UsageMetricAggregateResponse: …`

  Response containing usage metrics aggregated by one or more dimensions.

  - `buckets: List[Bucket]`

    The aggregation buckets, ordered by total credits descending

    - `dimensions: Dict[str, str]`

      The dimension values that define this bucket

    - `metric_count: int`

      Number of metric rows in this bucket

    - `total_credits: Union[float, str]`

      Total credits consumed by metrics in this bucket

      - `float`

      - `str`

    - `total_value: int`

      Total of the metric `value` field in this bucket

  - `group_by: List[Literal["day", "event_type", "organization_id", 2 more]]`

    The dimensions the metrics were grouped by

    - `"day"`

    - `"event_type"`

    - `"organization_id"`

    - `"project_id"`

    - `"user_id"`

### Example

```python
import os
from llama_cloud_admin import LlamaCloudAdmin

client = LlamaCloudAdmin(
    api_key=os.environ.get("LLAMA_CLOUD_API_KEY"),  # This is the default and can be omitted
)
response = client.admin.usage_metrics.aggregate(
    day_on_or_after="day_on_or_after",
    day_on_or_before="day_on_or_before",
    group_by=["string"],
)
print(response.buckets)
```

#### Response

```json
{
  "buckets": [
    {
      "dimensions": {
        "foo": "string"
      },
      "metric_count": 0,
      "total_credits": 0,
      "total_value": 0
    }
  ],
  "group_by": [
    "day"
  ]
}
```

## Domain Types

### Usage Metric Aggregate Response

- `class UsageMetricAggregateResponse: …`

  Response containing usage metrics aggregated by one or more dimensions.

  - `buckets: List[Bucket]`

    The aggregation buckets, ordered by total credits descending

    - `dimensions: Dict[str, str]`

      The dimension values that define this bucket

    - `metric_count: int`

      Number of metric rows in this bucket

    - `total_credits: Union[float, str]`

      Total credits consumed by metrics in this bucket

      - `float`

      - `str`

    - `total_value: int`

      Total of the metric `value` field in this bucket

  - `group_by: List[Literal["day", "event_type", "organization_id", 2 more]]`

    The dimensions the metrics were grouped by

    - `"day"`

    - `"event_type"`

    - `"organization_id"`

    - `"project_id"`

    - `"user_id"`
