Quickstart

This guide will help you make your first Mira API call in minutes.

Prerequisites

You'll need a Mira API key. Get one by signing up at platform.vmira.ai.

Installation

cURL

No installation needed — cURL is available on most systems.

Python

pip
pip install requests

JavaScript / Node.js

npm
npm install node-fetch

Mira Code CLI

npm
npm install -g mira-code

Make your first API call

Base URL

https://api.vmira.ai/v1

cURL

cURL
curl https://api.vmira.ai/v1/chat/completions \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "mira",
    "messages": [
      {"role": "user", "content": "Hello, Mira!"}
    ]
  }'

Python

Python
import requests

response = requests.post(
    "https://api.vmira.ai/v1/chat/completions",
    headers={"Authorization": "Bearer YOUR_API_KEY"},
    json={
        "model": "mira",
        "messages": [
            {"role": "user", "content": "Explain quantum computing"}
        ]
    }
)

print(response.json()["choices"][0]["message"]["content"])

JavaScript

JavaScript
const response = await fetch("https://api.vmira.ai/v1/chat/completions", {
  method: "POST",
  headers: {
    "Authorization": "Bearer YOUR_API_KEY",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    model: "mira",
    messages: [{ role: "user", content: "Hello!" }],
  }),
});

const data = await response.json();
console.log(data.choices[0].message.content);

Using the OpenAI SDK

Since the Mira API is OpenAI-compatible, you can use the official OpenAI SDK by simply changing the base URL:

Python (OpenAI SDK)
from openai import OpenAI

client = OpenAI(
    api_key="sk-mira-YOUR_API_KEY",
    base_url="https://api.vmira.ai/v1"
)

response = client.chat.completions.create(
    model="mira",
    messages=[{"role": "user", "content": "Hello!"}]
)

print(response.choices[0].message.content)
JavaScript (OpenAI SDK)
import OpenAI from "openai";

const client = new OpenAI({
  apiKey: "sk-mira-YOUR_API_KEY",
  baseURL: "https://api.vmira.ai/v1",
});

const response = await client.chat.completions.create({
  model: "mira",
  messages: [{ role: "user", content: "Hello!" }],
});

console.log(response.choices[0].message.content);

API response

A successful response looks like this:

JSON
{
  "id": "chatcmpl-abc123",
  "object": "chat.completion",
  "created": 1711000000,
  "model": "mira",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "Hello! I'm Mira, your AI assistant. How can I help you?"
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 12,
    "completion_tokens": 18,
    "total_tokens": 30
  }
}

Next steps