Documentation
SDK Reference
Complete API reference for the Aionvision Python SDK
Reference Documentation
This section provides a comprehensive reference of all classes, methods, and types in the SDK. For tutorials and guides, see the SDK Guide.
Quick Reference
| Section | Description |
|---|---|
| Client | Main AionVision client class and convenience methods |
| Resources | Sub-client resources (uploads, files, chats, etc.) |
| Types | All dataclasses and response types |
| Exceptions | Exception hierarchy and error types |
class AionVision
Main async client for the Aionvision Vision AI API
Constructor
AionVision( api_key: str, *, base_url: str = "https://api.aionvision.tech/api/v2", timeout: float = 300.0, max_retries: int = 3, retry_delay: float = 1.0, polling_interval: float = 2.0, polling_timeout: float = 360.0, tenant_id: Optional[str] = None, proxy_url: Optional[str] = None, enable_tracing: bool = False,)Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| api_key | str | required | Your Aionvision API key (starts with aion_) |
| base_url | str | production URL | API base URL |
| timeout | float | 300.0 | Request timeout in seconds |
| max_retries | int | 3 | Maximum retry attempts for transient failures |
| retry_delay | float | 1.0 | Initial delay between retries (exponential backoff) |
| polling_interval | float | 2.0 | Interval for polling operations (auto-describe) |
| polling_timeout | float | 360.0 | Maximum time to wait for polling operations |
| tenant_id | Optional[str] | None | Tenant ID for multi-tenant deployments |
| proxy_url | Optional[str] | None | Proxy URL (http, https, or socks5) |
| enable_tracing | bool | False | Enable OpenTelemetry tracing |
Context Manager Usage
The client must be used as an async context manager
async with AionVision(api_key="aion_...") as client: result = await client.upload_one("photo.jpg") print(result.description)Factory Methods
from_env()
Create a client from environment variables
@classmethoddef from_env(**overrides) -> AionVisionReads configuration from AIONVISION_* environment variables. See Environment Variables for details.
Convenience Methods
High-level methods that handle common operations
upload_one()
Upload a single file with automatic AI description
async def upload_one( file: Union[str, Path, bytes], *, filename: Optional[str] = None, wait_for_descriptions: bool = True, raise_on_failure: bool = True, description_timeout: Optional[float] = None, storage_target: Union[StorageTarget, str] = StorageTarget.DEFAULT,) -> UploadResultupload()
Upload one or more files with automatic AI description
async def upload( files: Union[str, Path, bytes, list[Union[str, Path, bytes]]], *, filename: Optional[str] = None, filenames: Optional[list[str]] = None, recursive: bool = True, include_hidden: bool = False, wait_for_descriptions: bool = True, raise_on_failure: bool = True, on_progress: Optional[Callable[[UploadProgressEvent], None]] = None, on_file_complete: Optional[Callable[[FileCompleteEvent], None]] = None, on_description_progress: Optional[Callable[[DescriptionProgressEvent], None]] = None, on_description_failed: Optional[Callable[[DescriptionFailedEvent], None]] = None, description_timeout: Optional[float] = None, storage_target: Union[StorageTarget, str] = StorageTarget.DEFAULT,) -> BatchUploadResultschat_session()
Create a chat session context manager
def chat_session( *, title: Optional[str] = None, image_ids: Optional[list[str]] = None, use_all_images: bool = True, auto_close: bool = True,) -> ChatSessionContextchat()
Send a message to an existing session and get a complete response
async def chat( message: str, *, session_id: str, force_detailed_analysis: bool = False,) -> ChatResponsechat_stream()
Send a message and stream response tokens as they arrive
async def chat_stream( message: str, *, session_id: str, force_detailed_analysis: bool = False,) -> AsyncIterator[ChatToken]pipeline()
Create a pipeline builder for multi-step agent workflows
def pipeline() -> PipelineReturns a Pipeline builder. Chain agent steps and call .run() to execute.
Resource Properties
Access to sub-client resources for advanced operations
| Property | Type | Description |
|---|---|---|
| client.uploads | UploadResource | Low-level upload operations |
| client.chats | ChatResource | Chat session management |
| client.files | FilesResource | File management operations |
| client.batch | BatchResource | Batch operation management |
| client.colors | ColorsResource | Color analysis and search (automatic on upload) |
| client.settings | SettingsResource | Organization settings (custom S3) |
| client.tenant | TenantResource | Tenant management |
| client.audit | AuditResource | Audit log operations |
| client.agent_search | AgentSearchResource | Standalone AI-powered search |
| client.agent_operations | AgentOperationsResource | AI-powered synthesis, analysis, and organization |
| client.documents | DocumentsResource | Document upload, processing, and search |
| client.links | LinksResource | Link management and crawling |
| client.folders | FoldersResource | Folder management and organization |
| client.cloud_storage | CloudStorageResource | Cloud storage import/export (Google Drive) |