Python SDK for Mira Network API
Project description
Mira SDK
A Python SDK for interacting with the Mira Network API. This SDK provides a simple interface to access all Mira API endpoints including model inference, flow management, and credit system.
Installation
pip install mira-sdk
Quick Start
import asyncio
from mira_sdk import MiraClient, Message, AiRequest
async def main():
# Initialize client
client = MiraClient(
base_url="https://api.mira.example.com",
api_token="your-api-token"
)
# List available models
models = await client.list_models()
print("Available models:", models)
# Generate text
request = AiRequest(
model="mira/llama3.1",
messages=[
Message(role="system", content="You are a helpful assistant."),
Message(role="user", content="Hello!")
],
model_provider=None
)
response = await client.generate(request)
print("Response:", response)
if __name__ == "__main__":
asyncio.run(main())
Features
- Asynchronous API using
httpx - Full type hints support
- Pydantic models for request/response validation
- Support for all Mira API endpoints:
- Model inference
- Flow management
- API token management
- Credit system
API Reference
Models
Message: Represents a chat messageModelProvider: Configuration for custom model providersAiRequest: Request for model inferenceFlowChatCompletion: Request for flow-based chat completionFlowRequest: Request for creating/updating flowsApiTokenRequest: Request for creating API tokensAddCreditRequest: Request for adding credits
Client Methods
Model Operations
list_models(): List available modelsgenerate(request: AiRequest): Generate text using specified model
Flow Operations
list_flows(): List all flowsget_flow(flow_id: str): Get flow detailscreate_flow(request: FlowRequest): Create new flowupdate_flow(flow_id: str, request: FlowRequest): Update flowdelete_flow(flow_id: str): Delete flowgenerate_with_flow(flow_id: str, request: FlowChatCompletion): Generate using flow
Token Operations
create_api_token(request: ApiTokenRequest): Create API tokenlist_api_tokens(): List API tokensdelete_api_token(token: str): Delete API token
Credit Operations
get_user_credits(): Get credit informationadd_credit(request: AddCreditRequest): Add creditsget_credits_history(): Get credit history
License
MIT License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
mira_network-0.1.1.tar.gz
(5.5 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mira_network-0.1.1.tar.gz.
File metadata
- Download URL: mira_network-0.1.1.tar.gz
- Upload date:
- Size: 5.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: pdm/2.21.0 CPython/3.10.15 Darwin/24.2.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3617be3420ebd109536cb491d5ad00560931fc96a65442cb6e3319b8d5864559
|
|
| MD5 |
09361e7c0bf1519fd3489868da556fff
|
|
| BLAKE2b-256 |
31f8daf61ac67fb3dc73c1d8e62c94ef18584d80eb215e3b697a46a6172d73f5
|
File details
Details for the file mira_network-0.1.1-py3-none-any.whl.
File metadata
- Download URL: mira_network-0.1.1-py3-none-any.whl
- Upload date:
- Size: 4.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: pdm/2.21.0 CPython/3.10.15 Darwin/24.2.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2ba2a463b4eff3d49399cb236e971eacc9d81bc439c3f8c04134566e643d841a
|
|
| MD5 |
03074216a8835422dfe09fb45f663486
|
|
| BLAKE2b-256 |
6b3e692dd384289f4a6fc80a9d052687218842b66dc736953377b5de35e6119b
|