Python API Reference
Welcome to the 0G AI SDK Python API Reference. This section provides detailed documentation for all classes, methods, and types available in the Python SDK.Overview
The 0G AI SDK Python library is organized into several main modules:Chat
Conversational AI with streaming support
Memory
Persistent storage for AI context and data
Agent
Autonomous AI agents with tool integration
Storage
Decentralized storage on the 0G network
Quick Reference
Core Classes
Class | Description | Import |
---|---|---|
Chat | Main chat interface | from zg_ai_sdk import Chat |
Memory | Memory management | from zg_ai_sdk import Memory |
Agent | AI agent framework | from zg_ai_sdk import Agent |
ZGStorageClient | Storage client | from zg_ai_sdk import ZGStorageClient |
ZGComputeBroker | Compute broker | from zg_ai_sdk import ZGComputeBroker |
Common Types
Installation
Install the Python SDK using pip:Authentication
All API calls require authentication. Set your API key when initializing SDK components:Error Handling
The SDK uses structured exception classes for consistent error handling:Rate Limits
The SDK respects the following rate limits:Endpoint | Limit | Window |
---|---|---|
Chat API | 100 requests | per minute |
Memory API | 1000 requests | per minute |
Storage API | 50 requests | per minute |
Agent API | 20 requests | per minute |
Pagination
For endpoints that return large datasets, use pagination:Async/Await Support
The Python SDK is built with async/await support for better performance:Type Hints
The SDK provides comprehensive type hints for better IDE support:Configuration
Configure the SDK using environment variables or configuration objects:Support
- Documentation: https://docs.0g.ai
- GitHub Issues: https://github.com/0glabs/nebula-sdk-python/issues
- Discord: https://discord.gg/0g
- Email: support@0g.ai