Quickstart

MagicAI exposes an OpenAI-compatible API at https://magicai.lol/v1. Any OpenAI SDK or tool works by changing the base URL and API key.

1. Create an API key

Sign up, add credits, then create a key under Dashboard → API Keys.

2. Make a request

curl https://magicai.lol/v1/chat/completions \
  -H "Authorization: Bearer $MAGICAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"gpt-6-luna","messages":[{"role":"user","content":"Hello"}]}'

Python

from openai import OpenAI
client = OpenAI(base_url="https://magicai.lol/v1", api_key="sk-...")
r = client.chat.completions.create(model="claude-sonnet-5-5", messages=[{"role":"user","content":"Hi"}])
print(r.choices[0].message.content)

Node.js

import OpenAI from "openai";
const client = new OpenAI({ baseURL: "https://magicai.lol/v1", apiKey: process.env.MAGICAI_API_KEY });
const r = await client.chat.completions.create({ model: "gpt-6.1-sol", messages: [{ role: "user", content: "Hi" }] });

Streaming

Set "stream": true to receive server-sent events, identical to the OpenAI format.

Endpoints

Errors & limits

Insufficient credits returns HTTP 403/429 with an explanatory message. Contact us for higher rate limits.