Quickstart with ModelMart

ModelMart is a unified AI API Gateway and intelligent router. With a single API key and one endpoint, you can access state-of-the-art AI models (Claude 3.5/5, GPT-4o/5, Gemini 1.5/3, DeepSeek V3/R1, Qwen 2.5...) with low latency and zero-downtime smart routing.


1. Get Your API Key

  1. Log in to the ModelMart Dashboard.
  2. Navigate to API Keys and click Create Key (Keys start with mm_...).
  3. Safely store the key in your system environment variables.
export MODELMART_API_KEY="mm_live_xxxxxxxxxxxxxxxxxxxxxxxx"
export MODELMART_BASE_URL="https://api.modelmart.io.vn/v1"

2. API Usage with Official OpenAI SDKs (100% Compatible)

ModelMart is fully compatible with the standard OpenAI API specification. You do not need to install any new libraries—just configure baseURL and apiKey.

Python

pip install openai
from openai import OpenAI
import os

client = OpenAI(
    api_key=os.environ.get("MODELMART_API_KEY"),
    base_url="https://api.modelmart.io.vn/v1"
)

response = client.chat.completions.create(
    model="claude-3-7-sonnet",
    messages=[
        {"role": "system", "content": "You are a professional AI assistant."},
        {"role": "user", "content": "Explain Smart Routing in distributed systems concisely."}
    ],
    temperature=0.7,
    max_tokens=1000
)

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

Node.js / TypeScript

npm install openai
import OpenAI from 'openai';

const client = new OpenAI({
  apiKey: process.env.MODELMART_API_KEY,
  baseURL: 'https://api.modelmart.io.vn/v1',
});

async function main() {
  const completion = await client.chat.completions.create({
    model: 'deepseek-r1',
    messages: [
      { role: 'system', content: 'You are a senior TypeScript engineer.' },
      { role: 'user', content: 'Write a generic debounce function in TS.' },
    ],
  });

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

main();

Vercel AI SDK (Next.js / React)

import { createOpenAI } from '@ai-sdk/openai';
import { generateText } from 'ai';

const modelmart = createOpenAI({
  baseURL: 'https://api.modelmart.io.vn/v1',
  apiKey: process.env.MODELMART_API_KEY,
});

export async function POST(req: Request) {
  const { prompt } = await req.json();

  const { text } = await generateText({
    model: modelmart('gpt-4o'),
    prompt: prompt,
  });

  return Response.json({ text });
}

cURL

curl https://api.modelmart.io.vn/v1/chat/completions \
  -H "Authorization: Bearer $MODELMART_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gemini-2.5-flash",
    "messages": [
      {"role": "user", "content": "Hello! What can you help me with?"}
    ]
  }'

3. Next Steps