LogoMeivan

Getting started

The Meivan API marketplace exposes provider capabilities through one consistent surface. Use your API key to list services, run inference, and manage usage — without juggling separate dashboards per vendor.

Overview

Base URL for all requests is https://api.meivan.example/v1. Responses are JSON with predictable error shapes so you can handle retries and rate limits in one place.

Environment
MEIVAN_API_KEY=mk_live_...
MEIVAN_BASE_URL=https://api.meivan.example/v1

Authentication

Send your secret key in the Authorization header as a Bearer token. Keys are scoped to a workspace; rotate them from the console without downtime.

cURL
curl -sS "$MEIVAN_BASE_URL/services" \
  -H "Authorization: Bearer $MEIVAN_API_KEY" \
  -H "Content-Type: application/json"

First request

List available marketplace services, then invoke one by service_id. The example below uses the generative completion surface; swap the body for vision or embeddings as needed.

Node (fetch)
const res = await fetch(`${process.env.MEIVAN_BASE_URL}/complete`, {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.MEIVAN_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    service_id: "llm.general.v1",
    messages: [{ role: "user", content: "Summarize this doc in 3 bullets." }],
    max_tokens: 256,
  }),
});

if (!res.ok) {
  const err = await res.json();
  throw new Error(err.error?.message ?? res.statusText);
}

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

SDKs & examples

Official TypeScript and Python SDKs wrap retries, timeouts, and typed request builders. For quick experiments, the REST examples in this guide are sufficient — see the API reference for every field and enum.

TypeScript (conceptual)
import { Meivan } from "@meivan/sdk";

const client = new Meivan({ apiKey: process.env.MEIVAN_API_KEY! });

const out = await client.complete({
  serviceId: "llm.general.v1",
  messages: [{ role: "user", content: "Hello!" }],
});

console.log(out.text);