← Home

API reference

Modelplex is OpenAI-compatible. Base URL https://api.modelplex.ai/v1, authenticate with Authorization: Bearer mk_live_. Create keys in the console. You're billed in credits, only for successful requests.

Chat (curl)

curl https://api.modelplex.ai/v1/chat/completions \
  -H "Authorization: Bearer mk_live_…" \
  -H "Content-Type: application/json" \
  -d '{"model":"claude-opus-4-8","messages":[{"role":"user","content":"Hello"}]}'

Chat (OpenAI SDK — drop-in)

import OpenAI from "openai";

const client = new OpenAI({
  baseURL: "https://api.modelplex.ai/v1",
  apiKey: process.env.MODELPLEX_API_KEY, // mk_live_…
});

const res = await client.chat.completions.create({
  model: "deepseek-v3.2",
  messages: [{ role: "user", content: "Hello" }],
});

Images (async submit → poll)

# 1) submit (async) → returns a job id
curl https://api.modelplex.ai/v1/images/generations \
  -H "Authorization: Bearer mk_live_…" -H "Content-Type: application/json" \
  -d '{"model":"z-image-turbo","prompt":"a red fox","n":1}'
# → { "id": "…", "status": "queued" }

# 2) poll status (or stream /events) until succeeded → signed asset URLs
curl https://api.modelplex.ai/v1/images/generations/<id> \
  -H "Authorization: Bearer mk_live_…"

More