MIAAI Proxy
AI Proxy
Quickstart
Get startedMarkdown ↗

Quickstart

Make your first model request with MIA AI Proxy.

1. Get an API key

Sign in to API 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, 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.

Shell
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

Shell
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 if your request fails.

For Anthropic, Google, other model interfaces, and tools, see Native APIs.

Models & tools ↗