# Quickstart Make your first model request with MIA AI Proxy. ## 1. Get an API key Sign in to [API Keys](https://mia-ai-proxy-sit.ambr.io/console/keys), create a key, and copy it to a safe place. Check your MIA Points balance before making a request. ## 2. Choose a model Open [Explore](https://mia-ai-proxy-sit.ambr.io/explore), choose a model with the `chat` interface (Chat Completions), and copy its model ID. Model availability and supported interfaces vary. ## 3. Set your environment Run the following in your terminal. Paste your key at the prompt, press Enter, then replace `your-model-id` with the ID you copied. ```bash printf 'API key: ' read -rs MIA_API_KEY export MIA_API_KEY printf '\n' export MIA_MODEL="your-model-id" export MIA_API_BASE_URL="https://mia-ai-proxy-sit.ambr.io/v1" ``` ## 4. Make a request ```bash curl "$MIA_API_BASE_URL/chat/completions" \ -H "Authorization: Bearer $MIA_API_KEY" \ -H "Content-Type: application/json" \ -d "{\"model\":\"$MIA_MODEL\",\"messages\":[{\"role\":\"user\",\"content\":\"Say hello.\"}]}" ``` ```python # pip install openai import os from openai import OpenAI client = OpenAI(api_key=os.environ["MIA_API_KEY"], base_url=os.environ["MIA_API_BASE_URL"], max_retries=0) response = client.chat.completions.create( model=os.environ["MIA_MODEL"], messages=[{"role": "user", "content": "Say hello."}], ) print(response.choices[0].message.content) ``` ```javascript // npm install openai import OpenAI from "openai"; const client = new OpenAI({ apiKey: process.env.MIA_API_KEY, baseURL: process.env.MIA_API_BASE_URL, maxRetries: 0, }); const response = await client.chat.completions.create({ model: process.env.MIA_MODEL, messages: [{ role: "user", content: "Say hello." }], }); console.log(response.choices[0].message.content); ``` The answer is in `choices[0].message.content`. See [Errors and retries](https://mia-ai-proxy-sit.ambr.io/docs/errors.md) if your request fails. For Anthropic, Google, other model interfaces, and tools, see [Native APIs](https://mia-ai-proxy-sit.ambr.io/docs/native-apis.md). --- # Native APIs Use native API formats and SDKs with your MIA API key. ## Choose an API Open a model in [Explore](https://mia-ai-proxy-sit.ambr.io/explore) and check **API support**. Choose **View account rates**, then select an **API** in Quickstart when a selector is available. Use its model ID, URL, and parameters. If the API you need is not shown, [contact MIA](https://mia.ambr.io/contact) to confirm support. Support is specific to the model and operation; a native API format does not imply support for every feature in a provider's API. | API | SDK base URL | Authentication | Reference | | --- | --- | --- | --- | | OpenAI | `https://mia-ai-proxy-sit.ambr.io/v1` | `Authorization: Bearer` | [Chat Completions](https://mia-ai-proxy-sit.ambr.io/docs/api/chat-completions.md), [Responses](https://mia-ai-proxy-sit.ambr.io/docs/api/responses.md) | | Anthropic | `https://mia-ai-proxy-sit.ambr.io` | `x-api-key` | [Messages](https://mia-ai-proxy-sit.ambr.io/docs/api/messages.md) | | Google Gen AI | `https://mia-ai-proxy-sit.ambr.io`, API version `v1beta` | `x-goog-api-key` | [Google API](https://mia-ai-proxy-sit.ambr.io/docs/api/google.md) | Use the MIA key as the SDK's API key. The Anthropic and Google SDKs add their API version paths; their base URL is the origin above. HTTP requests can also use `Authorization: Bearer YOUR_API_KEY`. ## OpenAI SDK Install [`openai`](https://github.com/openai/openai-python). Set `MIA_MODEL` to a model that supports Responses. ```python import os from openai import OpenAI client = OpenAI( api_key=os.environ["MIA_API_KEY"], base_url="https://mia-ai-proxy-sit.ambr.io/v1", max_retries=0, ) response = client.responses.create( model=os.environ["MIA_MODEL"], input="Hello", store=False, ) print(response.output_text) ``` For Chat Completions, use the [Quickstart](https://mia-ai-proxy-sit.ambr.io/docs/quickstart.md#4-make-a-request). ## Anthropic SDK Install [`anthropic`](https://github.com/anthropics/anthropic-sdk-python). Set `MIA_MODEL` to a model that supports Messages. ```python import os from anthropic import Anthropic client = Anthropic( api_key=os.environ["MIA_API_KEY"], base_url="https://mia-ai-proxy-sit.ambr.io", max_retries=0, ) response = client.messages.create( model=os.environ["MIA_MODEL"], max_tokens=256, messages=[{"role": "user", "content": "Hello"}], ) print(response.content) ``` ## Google Gen AI SDK Install [`google-genai`](https://github.com/googleapis/python-genai). Set `MIA_GOOGLE_MODEL` to the native model name shown in the model's Quickstart, without the `google/` catalog prefix. ```python import os from google import genai from google.genai import types client = genai.Client( api_key=os.environ["MIA_API_KEY"], vertexai=False, http_options=types.HttpOptions( base_url="https://mia-ai-proxy-sit.ambr.io", api_version="v1beta", retry_options=types.HttpRetryOptions(attempts=1), ), ) response = client.models.generate_content( model=os.environ["MIA_GOOGLE_MODEL"], contents="Hello", ) print(response.text) ``` These examples disable automatic retries. For streaming and error handling, see [Streaming](https://mia-ai-proxy-sit.ambr.io/docs/streaming.md) and [Errors and retries](https://mia-ai-proxy-sit.ambr.io/docs/errors.md). ## Other model APIs Embeddings, images, audio, video, realtime, and other provider-specific operations use the examples in each model's Quickstart. Use its exact method, URL, request format, and SDK or WebSocket setup. [Image and video](https://mia-ai-proxy-sit.ambr.io/docs/media.md) explains how to resume asynchronous results. ## Tools and APIs Tools use their native request format with the endpoint supplied for your integration, such as `https://mia-ai-proxy-sit.ambr.io/proxy/{name}/{path}`, and your MIA key as a Bearer token. For an enabled tool, open [API Keys](https://mia-ai-proxy-sit.ambr.io/console/keys), expand the key, then choose **Agreed prices → Integration details** for its methods, endpoints, request requirements, and rates. To arrange access, choose a tool in [Explore](https://mia-ai-proxy-sit.ambr.io/explore?kind=tools) and follow its integration instructions. A tool listing alone does not establish access. ### Exa native search and research For a provisioned Exa route, use `https://mia-ai-proxy-sit.ambr.io/proxy/exa` as the official Exa SDK base URL and your MIA key as its API key. No `/v1` suffix is needed. Search, Contents and Answer retain native parameters, rich results, citations and SSE. [Tool details](https://mia-ai-proxy-sit.ambr.io/explore?kind=tools&capability=exa) show the published Points rates; an explicit agreement on your key takes precedence. Agent runs retain their native lifecycle at `/agent/runs`. Creation reserves credit and freezes the price. Completion settles the final usage once; failed or cancelled runs have zero customer fee. Reading the same run or replaying its events adds no fee. Background settlement continues if your client disconnects. The admission estimate does not change Exa's effort or budget parameters. Use the same key and Account to read, stop, cancel, continue or delete a run. Delete only after settlement; team-wide listing is unavailable on shared metered routes. An uncertain creation must not be repeated automatically. Monitors, batches and Websets are not included in this Points offering. --- # Authentication Use an API key to authenticate requests to MIA AI Proxy. ## Create a key Sign in to [API Keys](https://mia-ai-proxy-sit.ambr.io/console/keys), name your key, and create it. A Workspace is a shared space where a team uses individual keys and a shared balance. ## API base URL The OpenAI API base URL is `https://mia-ai-proxy-sit.ambr.io/v1`. Anthropic, Google, and tool APIs use different URL paths; see [Native APIs](https://mia-ai-proxy-sit.ambr.io/docs/native-apis.md) for SDK setup and authentication. Model-specific examples are available on your [account model pages](https://mia-ai-proxy-sit.ambr.io/console). ## Send your key For the HTTP examples in this documentation, send the key as a Bearer token: ```http Authorization: Bearer YOUR_API_KEY ``` Store your key in an environment variable or secret manager. Do not put it in browser code, public repositories, or support messages. If a key may have been exposed, revoke it and create a new one. ## Key limits You can set a total limit and a daily, weekly, or monthly limit in MIA Points. Reaching a limit pauses new requests; requests already in progress can still add usage. Limits include past usage and changing them does not reset it. Periods use UTC; weeks begin on Monday. --- # Models Find a model and its supported APIs. ## Find a model [Explore](https://mia-ai-proxy-sit.ambr.io/explore) shows model capabilities, supported interfaces, and pricing. Open a model, then choose **View account rates** for its Quick Start. A model's presence in the directory does not guarantee access or availability. ## Choose an interface The [model catalog](https://mia-ai-proxy-sit.ambr.io/console/discover/api/models) uses `interface` for a model's default API, not its complete list of supported APIs: | `interface` | API | Endpoint | | --- | --- | --- | | `chat` | [Chat Completions](https://mia-ai-proxy-sit.ambr.io/docs/api/chat-completions.md) | `POST /v1/chat/completions` | | `responses` | [Responses](https://mia-ai-proxy-sit.ambr.io/docs/api/responses.md) | `POST /v1/responses` | | `anthropic-messages` | [Messages](https://mia-ai-proxy-sit.ambr.io/docs/api/messages.md) | `POST /v1/messages` | Check **API support** on the model page, then select an **API** in the model’s Quickstart when available. See [Native APIs](https://mia-ai-proxy-sit.ambr.io/docs/native-apis.md) for SDK setup and other interfaces. ## List models ```bash curl "https://mia-ai-proxy-sit.ambr.io/v1/models" \ -H "Authorization: Bearer $MIA_API_KEY" ``` The response contains model objects in `data`. For Chat Completions, Responses, and Messages, use a model's `id` as the `model` value. [Google's native API](https://mia-ai-proxy-sit.ambr.io/docs/api/google.md) uses the native model name in its URL. Follow the model's Quickstart for other operations; support for one interface does not imply support for every interface or parameter. --- # Chat Completions Send a conversation to a model that supports Chat Completions. ## Endpoint `POST https://mia-ai-proxy-sit.ambr.io/v1/chat/completions` ## Request Set `MIA_MODEL` to a Chat Completions model ID from [Explore](https://mia-ai-proxy-sit.ambr.io/explore). ```bash curl "https://mia-ai-proxy-sit.ambr.io/v1/chat/completions" \ -H "Authorization: Bearer $MIA_API_KEY" \ -H "Content-Type: application/json" \ -d "{\"model\":\"$MIA_MODEL\",\"messages\":[{\"role\":\"user\",\"content\":\"Hello\"}]}" ``` Read the answer from `choices[0].message.content`. For a subsequent turn, preserve the complete assistant message, including any tool calls or `reasoning_items`, in the conversation history. ## Fields | Field | Type | Description | | --- | --- | --- | | `model` | string | Required. ID of a model that supports Chat Completions. | | `messages` | array | Required. Conversation messages with a `role` and `content`. | | `stream` | boolean | Optional. Set to `true` to receive events as they are generated. | ## Response A non-streaming text response includes: ```json { "choices": [{"message": {"role": "assistant", "content": "Hello!"}, "finish_reason": "stop"}] } ``` Fields and content vary by model and request. ## Streaming Set `stream` to `true` to receive events as output is generated. See [Streaming](https://mia-ai-proxy-sit.ambr.io/docs/streaming.md). --- # Responses Generate a response with a model that supports the Responses API. ## Endpoint `POST https://mia-ai-proxy-sit.ambr.io/v1/responses` For the OpenAI SDK, see [Native APIs](https://mia-ai-proxy-sit.ambr.io/docs/native-apis.md#openai-sdk). ## Request Set `MIA_MODEL` to a Responses model ID from [Explore](https://mia-ai-proxy-sit.ambr.io/explore). ```bash curl "https://mia-ai-proxy-sit.ambr.io/v1/responses" \ -H "Authorization: Bearer $MIA_API_KEY" \ -H "Content-Type: application/json" \ -d "{\"model\":\"$MIA_MODEL\",\"input\":\"Hello\",\"store\":false}" ``` For a subsequent turn, preserve the complete response output or response ID as appropriate for your integration. A stored reference may not be portable to another model or route; if you receive `supplier_state_not_portable`, start a new turn with portable history. ## Fields | Field | Type | Description | | --- | --- | --- | | `model` | string | Required. ID of a model that supports Responses. | | `input` | string or array | Required. Text or structured input for the model. | | `store` | boolean | Optional. Whether to store the response for later use. | | `stream` | boolean | Optional. Set to `true` to receive events as they are generated. | ## Response A non-streaming text response includes: ```json { "id": "resp_example", "status": "completed", "output": [{"type": "message", "role": "assistant", "content": [{"type": "output_text", "text": "Hello!"}]}] } ``` Fields and content vary by model and request. ## Streaming Set `stream` to `true` to receive events as output is generated. See [Streaming](https://mia-ai-proxy-sit.ambr.io/docs/streaming.md). --- # Messages Send a conversation to a model that supports the Messages API. ## Endpoint `POST https://mia-ai-proxy-sit.ambr.io/v1/messages` For the Anthropic SDK and its `x-api-key` authentication, see [Native APIs](https://mia-ai-proxy-sit.ambr.io/docs/native-apis.md#anthropic-sdk). ## Request Set `MIA_MODEL` to a Messages model ID from [Explore](https://mia-ai-proxy-sit.ambr.io/explore). ```bash curl "https://mia-ai-proxy-sit.ambr.io/v1/messages" \ -H "Authorization: Bearer $MIA_API_KEY" \ -H "Content-Type: application/json" \ -d "{\"model\":\"$MIA_MODEL\",\"max_tokens\":256,\"messages\":[{\"role\":\"user\",\"content\":\"Hello\"}]}" ``` For a subsequent turn, preserve the complete assistant content, including tool use and thinking blocks. ## Fields | Field | Type | Description | | --- | --- | --- | | `model` | string | Required. ID of a model that supports Messages. | | `max_tokens` | integer | Required. Maximum number of tokens to generate. | | `messages` | array | Required. Conversation messages with a `role` and `content`. | | `stream` | boolean | Optional. Set to `true` to receive events as they are generated. | ## Sampling compatibility On Claude targets that have removed sampling controls, legacy `temperature`, `top_p` and `top_k` fields are accepted for compatibility but do not affect the output. Supported older models retain them. No client migration is required for requests that reach the gateway. If your request requires every supplied parameter to take effect, use `provider.require_parameters: true`; a route that cannot honor those parameters is not selected. ## Response A non-streaming text response includes: ```json { "type": "message", "role": "assistant", "content": [{"type": "text", "text": "Hello!"}], "stop_reason": "end_turn" } ``` Fields and content vary by model and request. ## Streaming Set `stream` to `true` to receive events as output is generated. See [Streaming](https://mia-ai-proxy-sit.ambr.io/docs/streaming.md). --- # Google API Use Google's native request and response format with a supported Google model. ## Endpoint `POST https://mia-ai-proxy-sit.ambr.io/v1beta/models/{model}:generateContent` Use the native model name from the model's [account model page](https://mia-ai-proxy-sit.ambr.io/console) Quickstart, without the `google/` catalog prefix. Choose a model whose example uses `generateContent`; other Google models can use different operations. ## Request Set `MIA_GOOGLE_MODEL` to that native model name. ```bash curl "https://mia-ai-proxy-sit.ambr.io/v1beta/models/$MIA_GOOGLE_MODEL:generateContent" \ -H "x-goog-api-key: $MIA_API_KEY" \ -H "Content-Type: application/json" \ -d '{"contents":[{"role":"user","parts":[{"text":"Hello"}]}]}' ``` For SDK setup, see [Native APIs](https://mia-ai-proxy-sit.ambr.io/docs/native-apis.md#google-gen-ai-sdk). ## Response A text response includes: ```json { "candidates": [{ "content": {"role": "model", "parts": [{"text": "Hello!"}]}, "finishReason": "STOP" }] } ``` Read the parts in `candidates[].content.parts`. Parts can contain text, media, or function calls depending on the model. Preserve the complete content for subsequent turns, including thought signatures when returned. ## Check completion Inspect each candidate's `finishReason`: | Value | Meaning | | --- | --- | | `STOP` | Generation reached a natural stopping point or a stop sequence. | | `MAX_TOKENS` | The output limit was reached; the answer may be incomplete. | | `SAFETY` | The candidate was filtered for safety. | If no candidate is returned, inspect `promptFeedback` and any error. For other values, use Google's [finish reason reference](https://ai.google.dev/api/generate-content#FinishReason). ## Streaming Use `POST https://mia-ai-proxy-sit.ambr.io/v1beta/models/{model}:streamGenerateContent?alt=sse` with the same body to receive server-sent events. Read each candidate's `finishReason`; a closed connection alone does not establish completion. See [Errors and retries](https://mia-ai-proxy-sit.ambr.io/docs/errors.md) before repeating an interrupted request. ## Other operations Google embeddings, image, video, audio, interactions, and live sessions have model-specific operations. Use the method and payload in the selected model's Quickstart rather than substituting `generateContent`. --- # Streaming Receive output as it is generated instead of waiting for a complete response. ## Stream a request For Chat Completions, Responses, and Messages, set `stream` to `true` when the model supports streaming. [Google's native API](https://mia-ai-proxy-sit.ambr.io/docs/api/google.md#streaming) uses `streamGenerateContent`. This example uses a Chat Completions model: ```bash curl -N "https://mia-ai-proxy-sit.ambr.io/v1/chat/completions" \ -H "Authorization: Bearer $MIA_API_KEY" \ -H "Content-Type: application/json" \ -d "{\"model\":\"$MIA_MODEL\",\"stream\":true,\"messages\":[{\"role\":\"user\",\"content\":\"Hello\"}]}" ``` The response uses server-sent events (SSE). An HTTP `200` means the stream started; it does not prove generation succeeded. ## Check completion | API | Completion signal | What to inspect | | --- | --- | --- | | Chat Completions | `data: [DONE]` ends the stream. | Check each choice’s `finish_reason`: `stop` is a natural stop, `length` means the output hit a limit, and `tool_calls` requires tool handling. Check for an `error` object before `[DONE]`; the marker alone does not mean success. | | Responses | `response.completed`, `response.failed`, or `response.incomplete` | Only `response.completed` means completed. For incomplete output, inspect `response.incomplete_details`. | | Messages | `message_stop` ends the message. | Read `message_delta.delta.stop_reason`: `end_turn` is a natural stop, `max_tokens` means a limit was reached, and `tool_use` requires tool handling. An `error` event means failure. | | Google | Each candidate's `finishReason` | Inspect the [completion reason](https://mia-ai-proxy-sit.ambr.io/docs/api/google.md#check-completion) and any error or blocked content. | Models may return other stop reasons. Handle them according to the selected interface. If the connection closes without a terminal signal, treat the result as incomplete or unknown. ## Handle stream errors Errors can arrive after output has started. For example, a Messages stream can contain: ```text event: error data: {"type":"error","error":{"type":"api_error","message":"Generation could not complete."}} ``` Stop consuming the result as a successful answer when an error arrives. Keep any partial output separate from a completed result. ## Long generations Use streaming for long generations. A non-streaming request can exceed the response time limit. If the outcome is uncertain, do not automatically repeat a paid request. See [Errors and retries](https://mia-ai-proxy-sit.ambr.io/docs/errors.md). --- # Errors and retries Use the status, error code, and response headers together to decide what to do next. ## HTTP status | Status | What to check | | --- | --- | | 400 | Check the request and whether the model supports the requested interface and parameters. | | 401 | Check the API key and the API URL. | | 402 | Check your MIA Points balance. | | 403 | Check key status and access. | | 404 | Check the endpoint and model ID. | | 409 | Check whether a request or continuation conflicts with an earlier one. | | 413 | Reduce the request size, attachments, or conversation history. | | 429 | Check the error code for a limit or capacity rejection. | | 502, 503 | The service could not complete the request. Check the retry guidance below. | | 504 | The request timed out. For long generations, use streaming. | Error bodies follow the requested API's format. `x-mia-error-code`, when present, identifies the error across API formats. Responses from an intermediary may not include MIA's error body or headers. ## Error codes When `x-mia-error-code` is present, use it with the HTTP status: | Code | Status | Next action | | --- | --- | --- | | `vk_invalid`, `vk_expired` | 401 | Check the key and create a new one if needed. | | `vk_disabled` | 403 | Check key status in API Keys. | | `insufficient_credit` | 402 | Add MIA Points. | | `quota_exceeded` | 429 | Check the key's Points limits. | | `rate_limit` | 429 | Check retry headers before trying again. | | `model_not_found` | 404 | Copy a current model ID from Explore or the model list. | | `parameter_capability_unavailable` | 400 | The message names the field and why no route can carry it. Change that field or use another interface the model supports. | | `request_too_large` | 413 | Reduce the request size. | | `request_conflict` | 409 | Check the request identity and continuation. | | `supplier_state_not_portable` | 400 | Start a new turn with portable history. | | `provider_timeout` | 504 | Use streaming for long generations; check retry guidance. | ## Content safety rejections When a model provider rejects a prompt, input media, or generated result under its content safety policy, the response is a 400 with `x-mia-upstream-error-reason`: | Reason | Meaning | | --- | --- | | `content_real_person` | An input image or video may contain a real person. | | `content_copyright` | An input or the generated result may be subject to copyright restrictions. | | `content_counterfeit` | The generated result may contain counterfeit documents or credentials. | | `content_sensitive` | The request or result did not pass the provider's content safety review. | `x-mia-upstream-error-code`, when present, is the provider's documented label, for example `InputImageSensitiveContentDetected.PrivacyInformation`; its `Input` or `Output` prefix tells you whether the provider rejected what you sent or what it generated. Repeating the same request does not change the result. ## Retry safely `x-should-retry: false` means do not automatically retry. `Retry-After`, when present, gives a delay; it does not override a `false` retry instruction. An absent retry header does not establish that a retry is safe. For paid generation, disable automatic SDK retries. A timeout or lost connection can leave the outcome unknown; do not repeat the request automatically. You can provide an `Idempotency-Key` to identify a request, but it does not make replay safe. An already accepted request cannot be automatically replayed with the same identity. ## Get help For a persistent problem, [contact MIA](https://mia.ambr.io/contact) with the endpoint, model ID, status, error code, and request ID if available. Do not send your API key or private request content. --- # Image and video Choose an image or video model and follow its model-specific Quick Start. ## Choose a model Open [Explore](https://mia-ai-proxy-sit.ambr.io/explore), select an image or video model, and check its supported interface and pricing. Choose **View account rates** to open the model’s Quick Start, which provides the endpoint, request format, and examples for that model. Formats and parameters vary by model. Some entries require an access request; follow the instructions on the model page. ## Retrieve video results Some video requests return a task ID before the result is ready. Keep the task ID and use the same API key to check its status using the status endpoint in the model’s integration example. If polling times out, resume polling the same task instead of repeating the generation request. --- # Usage and MIA Points MIA Points are the credits used to pay for model requests. ## Pricing See [Explore](https://mia-ai-proxy-sit.ambr.io/explore) for each model's rates and units. Check the model detail before making a request; rates can differ by input, output, and capability. ## Balance and usage In [API Keys](https://mia-ai-proxy-sit.ambr.io/console/keys), open **View Account Points** to see your balance and charges. Key details show usage for each key. A Workspace is a shared space where a team uses individual keys and a shared balance. ## Failed requests An HTTP failure before model output has a zero Points fee. A client timeout alone does not establish the request's outcome. A successful response, an interrupted stream, or a cancelled request can have different usage results. --- # Build with agents Give your agent the documentation and the information it needs to make a supported request. ## Discover capabilities Start with [Explore](https://mia-ai-proxy-sit.ambr.io/explore) and the [agent index](https://mia-ai-proxy-sit.ambr.io/llms.txt). Select a model and check its supported interface before calling it. [Native APIs](https://mia-ai-proxy-sit.ambr.io/docs/native-apis.md) covers SDK setup, protocol-specific URLs, and tool integrations. A catalog entry is not a guarantee of access or availability. ## Read as text Use [llms.txt](https://mia-ai-proxy-sit.ambr.io/llms.txt) to discover the documentation, [llms-full.txt](https://mia-ai-proxy-sit.ambr.io/llms-full.txt) for the full text, or append `.md` to a documentation page URL for its Markdown. ## Set up a personal key Follow the [personal key guide](https://mia-ai-proxy-sit.ambr.io/console/skills/mia-ai-proxy-user/SKILL.md). Keep the key in your local environment or secret manager, and give the agent the API base URL and model ID. Do not paste keys into prompts or source files. ## Preserve conversation state Keep complete assistant messages and tool calls between turns. For Responses, preserve the response output or response ID; for Messages, preserve all assistant content blocks. Use the same key and account for continuation. If a stored reference cannot continue on the requested model or route, start a new turn with portable history. ## Handle uncertainty Treat interrupted streams as incomplete and avoid automatic retries of paid requests with unknown outcomes. See [Errors and retries](https://mia-ai-proxy-sit.ambr.io/docs/errors.md).