models
Bases: BaseModels
Source code in airia/client/models/async_models.py
delete_model(model_id, correlation_id=None)
async
Delete a model by its ID.
This method permanently deletes a model from the Airia platform. Once deleted, the model cannot be recovered. Only models that the authenticated user has permission to delete can be removed.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model_id
|
str
|
The unique identifier of the model to delete. |
required |
correlation_id
|
str
|
A unique identifier for request tracing and logging. If not provided, one will be automatically generated. |
None
|
Returns:
| Type | Description |
|---|---|
None
|
None |
Raises:
| Type | Description |
|---|---|
AiriaAPIError
|
If the API request fails, including cases where: - Model not found (404) - Authentication fails (401) - Access is forbidden (403) - Server errors (5xx) |
Example
from airia import AiriaAsyncClient
client = AiriaAsyncClient(api_key="your_api_key")
# Delete a specific model
await client.models.delete_model(
model_id="12345678-1234-1234-1234-123456789abc"
)
print("Model deleted successfully")
# Delete with correlation ID for tracking
await client.models.delete_model(
model_id="12345678-1234-1234-1234-123456789abc",
correlation_id="my-correlation-id"
)
Note
This operation is irreversible. Ensure you have the correct model ID before calling this method. You must have delete permissions for the specified model.
Source code in airia/client/models/async_models.py
list_models(project_id=None, include_global=True, page_number=1, page_size=50, sort_by='updatedAt', sort_direction='DESC', correlation_id=None)
async
Retrieve a list of models accessible to the authenticated user.
This method fetches information about all models that the current user has access to, optionally filtered by project. Models can be either library-provided or user-configured.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
project_id
|
str
|
Filter models by project ID. If provided, returns models associated with this project. |
None
|
include_global
|
bool
|
Whether to include global/library models in the results. Defaults to True. |
True
|
page_number
|
int
|
Page number for pagination. Defaults to 1. |
1
|
page_size
|
int
|
Number of items per page. Defaults to 50. |
50
|
sort_by
|
str
|
Field to sort results by. Defaults to "updatedAt". |
'updatedAt'
|
sort_direction
|
str
|
Sort direction, either "ASC" or "DESC". Defaults to "DESC". |
'DESC'
|
correlation_id
|
str
|
A unique identifier for request tracing and logging. If not provided, one will be automatically generated. |
None
|
Returns:
| Type | Description |
|---|---|
List[ModelItem]
|
List[ModelItem]: A list of ModelItem objects containing model information including configuration, pricing, and capabilities. Returns an empty list if no models are found. |
Raises:
| Type | Description |
|---|---|
AiriaAPIError
|
If the API request fails, including cases where: - Authentication fails (401) - Access is forbidden (403) - Server errors (5xx) |
Example
from airia import AiriaAsyncClient
client = AiriaAsyncClient(api_key="your_api_key")
# Get all accessible models
models = await client.models.list_models()
for model in models:
print(f"Model: {model.display_name}")
print(f"Provider: {model.provider}")
print(f"Type: {model.type}")
print(f"Has tool support: {model.has_tool_support}")
print("---")
# Get models for a specific project
project_models = await client.models.list_models(
project_id="12345678-1234-1234-1234-123456789abc",
include_global=False
)
Note
The returned models are filtered based on the authenticated user's permissions. Users will only see models they have been granted access to.