API Reference

OpenAI-compatible

Drop-in replacement for the OpenAI API with three public model IDs. Change base_url and your key — everything else stays the same.

Quick Start

Get running in under 2 minutes:

Cursor / Windsurf

Settings → Models → OpenAI-compatible provider
Base URL:  https://gateway.fair-price.ai/v1
API Key:   fp-sk-your_key_here
Model:     qwen3-235b

Cline

API Configuration → OpenAI Compatible
API Provider:   OpenAI Compatible
Base URL:       https://gateway.fair-price.ai/v1
API Key:        fp-sk-your_key_here
Model ID:       qwen3-235b
Custom Headers: leave empty

Python

pip install openai
from openai import OpenAI

client = OpenAI(
    base_url="https://gateway.fair-price.ai/v1",
    api_key="fp-sk-your_key_here",
)

response = client.chat.completions.create(
    model="qwen3-235b",
    messages=[{"role": "user", "content": "Hello!"}],
)
print(response.choices[0].message.content)

Authentication

Pass your API key as a Bearer token in the Authorization header. Create keys in Dashboard → API Keys.

HTTP header
Authorization: Bearer fp-sk-your_key_here
Keep your API key secret. Never expose it in client-side code or public repos. Keys can be revoked from the dashboard at any time.

Models

Use the public model ID in your request. qwen3-235b is the default route and automatically falls back to Kimi K2.6 and MiniMax M2.7 during provider overloads.

Model IDDescriptionBest for
qwen3-235bQwen3-235B-A22B, with Kimi and MiniMax fallbackCoding, reasoning, automatic failover
kimi-k2.6Kimi K2.6Long-context and agentic workflows
minimax-m2.7MiniMax M2.7Fast fallback and general chat

Full model list via API: GET https://gateway.fair-price.ai/v1/models

Direct upstream IDs also work when your client prefers provider-native names: moonshotai/Kimi-K2.6 and MiniMaxAI/MiniMax-M2.7.

Chat Completions

POST
/v1/chat/completions

Identical to OpenAI Chat Completions. All standard parameters are supported.

Request body

application/json
{
  "model": "qwen3-235b",
  "messages": [
    { "role": "system", "content": "You are a helpful assistant." },
    { "role": "user",   "content": "Explain async/await in Python." }
  ],
  "temperature": 0.7,   // optional, 0–2
  "max_tokens": 2048,   // optional
  "stream": false       // set true for streaming
}

Response

200 OK
{
  "id": "chatcmpl-abc123",
  "object": "chat.completion",
  "created": 1748000000,
  "model": "qwen3-235b",
  "choices": [
    {
      "index": 0,
      "message": { "role": "assistant", "content": "..." },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 42,
    "completion_tokens": 120,
    "total_tokens": 162
  }
}

Streaming

stream: true — server-sent events
data: {"id":"chatcmpl-abc","object":"chat.completion.chunk","choices":[{"delta":{"content":"Hello"},"index":0}]}

data: [DONE]

Examples

curl

shell
curl https://gateway.fair-price.ai/v1/chat/completions \
  -H "Authorization: Bearer fp-sk-your_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "qwen3-235b",
    "messages": [{"role": "user", "content": "Hello!"}]
  }'

Node.js / TypeScript

npm install openai
import OpenAI from "openai";

const client = new OpenAI({
  baseURL: "https://gateway.fair-price.ai/v1",
  apiKey: "fp-sk-your_key_here",
});

const res = await client.chat.completions.create({
  model: "qwen3-235b",
  messages: [{ role: "user", content: "Hello!" }],
});
console.log(res.choices[0].message.content);

Streaming (Python)

python
from openai import OpenAI

client = OpenAI(
    base_url="https://gateway.fair-price.ai/v1",
    api_key="fp-sk-your_key_here",
)

with client.chat.completions.stream(
    model="qwen3-235b",
    messages=[{"role": "user", "content": "Write a quicksort in Python."}],
) as stream:
    for text in stream.text_stream:
        print(text, end="", flush=True)

Aider

shell
aider --openai-api-base https://gateway.fair-price.ai/v1 \
      --openai-api-key fp-sk-your_key_here \
      --model qwen3-235b

Errors

Standard HTTP status codes. Error body follows OpenAI format.

StatusCauseFix
401Invalid or missing API keyCheck Authorization header
402Insufficient credit balanceTop up at fair-price.ai/dashboard/topup
429Rate limit exceededSlow down requests or contact support
500Upstream inference errorRetry with exponential backoff
Error response body
{
  "error": {
    "message": "Insufficient credit balance",
    "type": "insufficient_quota",
    "code": 402
  }
}

Pricing

Pre-purchase credits. No subscriptions. Credits are shared across all models.

Starter:$50.85B credits
Pro:$203.5B credits
Scale:$5010B credits

Crypto payments receive +10% bonus credits. See all packages →