RouteMarket 文档

Quickstart

Make your first RouteMarket request in a few minutes.

This page assumes one goal: make a working request as fast as possible.

Prerequisites

You need:

  • a RouteMarket API key
  • the gateway URL https://api.routemarket.ai
  • a logical model name such as gpt-5.4

1. Set your API key

export ROUTELAB_API_KEY="your_key_here"

2. Make your first request

curl https://api.routemarket.ai/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $ROUTELAB_API_KEY" \
  -d '{
    "model": "gpt-5.4",
    "messages": [
      { "role": "user", "content": "Say hello from RouteMarket." }
    ]
  }'

3. Use an OpenAI-compatible SDK

import OpenAI from "openai";

const client = new OpenAI({
  apiKey: process.env.ROUTELAB_API_KEY,
  baseURL: "https://api.routemarket.ai/v1"
});

const completion = await client.chat.completions.create({
  model: "gpt-5.4",
  messages: [{ role: "user", content: "Explain RouteMarket in one sentence." }]
});

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

4. Add routing control when you need it

The default request can stay simple.

When you need more control, RouteMarket also supports fields like:

  • provider
  • route
  • routing_preference
  • source_policy

Example:

{
  "model": "gpt-5.4",
  "messages": [
    { "role": "user", "content": "hello" }
  ],
  "routing_preference": "highest_reliability"
}

5. Know what model means

In RouteMarket, model usually means a logical model name.

That is not always the same thing as the final upstream provider model chosen at runtime.

If you need the deeper explanation, continue with Models and Routing.

Local docs preview

corepack pnpm --filter @route-lab/docs dev

The docs app starts on port 3004.

Next step