> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mira.network/llms.txt
> Use this file to discover all available pages before exploring further.

# Quickstart

> Make your first Mira Network call in minutes: chat completions, streaming responses, multi-turn conversations, and error handling with the Python SDK.

This guide walks you through your first calls with the Mira Network Python SDK.

<Note>
  **Before you start:** [install the SDK](/network/get-started/installation) and have your API key ready (it starts with `sk-mira-`). The examples read it from the `MIRA_API_KEY` environment variable — replace `"your-api-key"` with your own key or set that variable.
</Note>

## Basic Chat Completion

Send a message and read the model's reply:

```python theme={null}
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-mini",  # See list_models() for all available models
            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:

```python theme={null}
async def stream_response():
    async with MiraClient(api_key="your-api-key") as client:
        stream = await client.chat_completions_create(
            model="your-chosen-model",
            messages=[{"role": "user", "content": "Write a story"}],
            stream=True
        )
        async for chunk in stream:
            print(chunk["choices"][0]["delta"]["content"], end="")
```

## Managing Conversations

Handle multi-turn conversations:

```python theme={null}
messages = [
    {"role": "system", "content": "You are a helpful assistant"},
    {"role": "user", "content": "Hi! Can you help me?"},
]

async with MiraClient(api_key="your-api-key") as client:
    response = await client.chat_completions_create(
        model="your-chosen-model",
        messages=messages
    )
```

## Error Handling

Handle validation and request errors:

```python theme={null}
try:
    response = await client.chat_completions_create(
        model="your-chosen-model",
        messages=[{"role": "user", "content": "Hello"}]
    )
except ValueError as e:
    print(f"Validation error: {e}")
except Exception as e:
    print(f"An error occurred: {e}")
```

## Next Steps

* Learn to [Generate Text](/network/model-operations/generate) with more options
* Browse the available [Models](/network/model-operations/list-models)
* Manage your [API Tokens](/network/token-operations/create-api-token)
* Check your [Credit Balance](/network/credit-operations/getting-credit)
