Skip to main content

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 message
  • ModelProvider: Configuration for custom model providers
  • AiRequest: Request for model inference
  • FlowChatCompletion: Request for flow-based chat completion
  • FlowRequest: Request for creating/updating flows
  • ApiTokenRequest: Request for creating API tokens
  • AddCreditRequest: Request for adding credits

Client Methods

Model Operations

  • list_models(): List available models
  • generate(request: AiRequest): Generate text using specified model

Flow Operations

  • list_flows(): List all flows
  • get_flow(flow_id: str): Get flow details
  • create_flow(request: FlowRequest): Create new flow
  • update_flow(flow_id: str, request: FlowRequest): Update flow
  • delete_flow(flow_id: str): Delete flow
  • generate_with_flow(flow_id: str, request: FlowChatCompletion): Generate using flow

Token Operations

  • create_api_token(request: ApiTokenRequest): Create API token
  • list_api_tokens(): List API tokens
  • delete_api_token(token: str): Delete API token

Credit Operations

  • get_user_credits(): Get credit information
  • add_credit(request: AddCreditRequest): Add credits
  • get_credits_history(): Get credit history

License

MIT License

Project details


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)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mira_network-0.1.3-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

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

Hashes for mira_network-0.1.3.tar.gz
Algorithm Hash digest
SHA256 e3e0e342f60f688da8c87b3de17c2c0c42dd27157e04a9253ae24bd1c4282824
MD5 ab2182eb35c0b59514aa37b2f5cb9f40
BLAKE2b-256 79aa4d3c70418cf2e2d72412186e08a6d2cbab2a94044534ac85332d57a08cf9

See more details on using hashes here.

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

Hashes for mira_network-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 be7b414fbd846fffca3ee126b0072173ecd469643239d92bcac2f37249c9b410
MD5 8a50755174023f829239367d5a788fcd
BLAKE2b-256 c14166df06fc7467557fac43b41525ffc8952900cd344e9bcc23cc18a60e6a77

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page