API Reference
Drop-in replacement for the OpenAI API. Change base_url and your key — everything else stays the same.
Quick Start
Get running in under 2 minutes:
Cursor / Windsurf / Cline
Base URL: https://fair-price.ai/api/v1 API Key: fp-sk-your_key_here Model: Qwen/Qwen3-235B-A22B-Instruct-2507-FP8
Python
from openai import OpenAI
client = OpenAI(
base_url="https://fair-price.ai/api/v1",
api_key="fp-sk-your_key_here",
)
response = client.chat.completions.create(
model="Qwen/Qwen3-235B-A22B-Instruct-2507-FP8",
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.
Authorization: Bearer fp-sk-your_key_here
Models
Two frontier models available. Pass the full model ID in your request.
| Model ID | Description | Best for |
|---|---|---|
| Qwen/Qwen3-235B-A22B-Instruct-2507-FP8 | 235B MoE, 22B active params | Coding, reasoning, agentic tasks |
| moonshotai/Kimi-K2-Instruct | 1T MoE, long-context | Long docs, multi-file codebases |
Full model list via API: GET https://fair-price.ai/api/v1/models
Chat Completions
/api/v1/chat/completionsIdentical to OpenAI Chat Completions. All standard parameters are supported.
Request body
{
"model": "Qwen/Qwen3-235B-A22B-Instruct-2507-FP8",
"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
{
"id": "chatcmpl-abc123",
"object": "chat.completion",
"created": 1748000000,
"model": "Qwen/Qwen3-235B-A22B-Instruct-2507-FP8",
"choices": [
{
"index": 0,
"message": { "role": "assistant", "content": "..." },
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 42,
"completion_tokens": 120,
"total_tokens": 162
}
}Streaming
data: {"id":"chatcmpl-abc","object":"chat.completion.chunk","choices":[{"delta":{"content":"Hello"},"index":0}]}
data: [DONE]Examples
curl
curl https://fair-price.ai/api/v1/chat/completions \
-H "Authorization: Bearer fp-sk-your_key_here" \
-H "Content-Type: application/json" \
-d '{
"model": "Qwen/Qwen3-235B-A22B-Instruct-2507-FP8",
"messages": [{"role": "user", "content": "Hello!"}]
}'Node.js / TypeScript
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://fair-price.ai/api/v1",
apiKey: "fp-sk-your_key_here",
});
const res = await client.chat.completions.create({
model: "Qwen/Qwen3-235B-A22B-Instruct-2507-FP8",
messages: [{ role: "user", content: "Hello!" }],
});
console.log(res.choices[0].message.content);Streaming (Python)
from openai import OpenAI
client = OpenAI(
base_url="https://fair-price.ai/api/v1",
api_key="fp-sk-your_key_here",
)
with client.chat.completions.stream(
model="Qwen/Qwen3-235B-A22B-Instruct-2507-FP8",
messages=[{"role": "user", "content": "Write a quicksort in Python."}],
) as stream:
for text in stream.text_stream:
print(text, end="", flush=True)Aider
aider --openai-api-base https://fair-price.ai/api/v1 \
--openai-api-key fp-sk-your_key_here \
--model Qwen/Qwen3-235B-A22B-Instruct-2507-FP8Errors
Standard HTTP status codes. Error body follows OpenAI format.
| Status | Cause | Fix |
|---|---|---|
| 401 | Invalid or missing API key | Check Authorization header |
| 402 | Insufficient token balance | Top up at fair-price.ai/dashboard/topup |
| 429 | Rate limit exceeded | Slow down requests or contact support |
| 500 | Upstream inference error | Retry with exponential backoff |
{
"error": {
"message": "Insufficient token balance",
"type": "insufficient_quota",
"code": 402
}
}Pricing
Pre-purchase token bundles. No subscriptions. Tokens shared across all models.
Crypto payments receive +10% bonus tokens. See all packages →