Python SDK for Mira Network API
Project description
Mira Network 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-network
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="gpt-4o",
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.3.tar.gz
(4.3 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.3.tar.gz.
File metadata
- Download URL: mira_network-0.1.3.tar.gz
- Upload date:
- Size: 4.3 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 |
e3e0e342f60f688da8c87b3de17c2c0c42dd27157e04a9253ae24bd1c4282824
|
|
| MD5 |
ab2182eb35c0b59514aa37b2f5cb9f40
|
|
| BLAKE2b-256 |
79aa4d3c70418cf2e2d72412186e08a6d2cbab2a94044534ac85332d57a08cf9
|
File details
Details for the file mira_network-0.1.3-py3-none-any.whl.
File metadata
- Download URL: mira_network-0.1.3-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 |
be7b414fbd846fffca3ee126b0072173ecd469643239d92bcac2f37249c9b410
|
|
| MD5 |
8a50755174023f829239367d5a788fcd
|
|
| BLAKE2b-256 |
c14166df06fc7467557fac43b41525ffc8952900cd344e9bcc23cc18a60e6a77
|