Quickstart

Get started with Mira Network SDK

Quick Start Guide

Let’s walk through basic usage patterns of the Mira Network SDK.

Basic Chat Completion

Here’s a simple example to get started:

Copy

from mira_network import MiraClient

async def main():
    async with MiraClient(api_key="your-api-key") as client:
        response = await client.chat_completions_create(
            model="gpt-4o",       # You can choose any available model of your choice
            messages=[
                {"role": "user", "content": "What is the capital of France?"}
            ]
        )
        print(response["choices"][0]["message"]["content"])

if __name__ == "__main__":
    import asyncio
    asyncio.run(main())

Streaming Responses

For real-time responses:

Copy

Managing Conversations

Handle multi-turn conversations:

Copy

Error Handling

Implement robust error handling:

Copy

Next Steps

Last updated