Subscription API Guide
Subscriptions let you upgrade a specific API Key to a paid plan with higher RPM (requests per minute), a token quota, and exclusive models only available on that plan.
The subscription fee is deducted immediately from your account balance (Credits) when subscribing — no recurring automatic charges. Quotas reset automatically per the plan's configured period (daily / weekly / monthly).
Query Available Plans
Public endpoint, no authentication required. Returns all active subscription plans including price, rate limits, token quota, and available model list.
/api/v1/plansResponse
[
{
"slug": "standard",
"priceUsd": 20,
"rpmLimit": 60,
"tokenLimit": 2000000, // null = unlimited
"tokenLimitPeriod": "day", // "5h" | "day" | "week" | "month"
"dailyPoints": 3700,
"newAccountDailyPoints": 500,
"newAccountCooldownHrs": 72,
"models": [
{ "modelId": "openai/gpt-4o", "basePoints": 15 },
{ "modelId": "anthropic/claude-sonnet-4", "basePoints": 25 }
]
}
]Example
curl https://bazaarlink.ai/api/v1/plans
Subscribe an API Key
Upgrade a specific API Key to a plan. The subscription fee is deducted immediately from your account balance. The response includes the remaining balance after deduction (remainingCredits).
/api/v1/keys/:id/subscriptionRequest Body
Response
{
"ok": true,
"remainingCredits": 80.0000, // balance after deduction
"subscriptionPlan": {
"id": "clxxxxx",
"slug": "standard",
"priceUsd": 20,
"rpmLimit": 60,
"tokenLimit": 2000000,
"tokenLimitPeriod": "day"
}
}Error Codes
Example
# Login first to obtain a session cookie
curl -X POST https://bazaarlink.ai/api/v1/keys/KEY_ID/subscription \
-H "Content-Type: application/json" \
-H "Cookie: next-auth.session-token=YOUR_SESSION" \
-d '{"planSlug": "standard"}'Allowed Models
A subscription plan may include a set of "exclusive models" — only keys subscribed to that plan can call them. Retrieve the full list from the models array in GET /api/v1/plans.
If the plan's models array is empty ([]), the plan allows calling all standard models (models available to free accounts), bounded by the plan's RPM and token quota.
# List models included in the standard plan
curl https://bazaarlink.ai/api/v1/plans \
| jq '.[] | select(.slug == "standard") | .models[] | {modelId, basePoints}'Calling Subscription Models
Use the API Key subscribed to that plan to send requests — identical to regular API calls:
curl https://bazaarlink.ai/api/v1/chat/completions \
-H "Authorization: Bearer sk-bl-YOUR_SUBSCRIBED_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "openai/gpt-4o",
"messages": [{"role": "user", "content": "Hello!"}]
}'Check Remaining Balance
Account balance (Credits) is the shared pool for subscription fees and API usage. Query it in real time via:
/api/v1/creditsResponse
{
"data": {
"total_credits": 80.0000, // current remaining balance (USD)
"total_usage": 42.1234 // lifetime API spend since account creation
}
}Example
curl https://bazaarlink.ai/api/v1/credits \ -H "Authorization: Bearer sk-bl-YOUR_API_KEY"
Token Quota & Reset Schedule
Each plan has a token quota (tokenLimit) and reset period (tokenLimitPeriod). Resets are based on UTC time:
Query Plan Token Quota
# Query quota settings for all plans
curl https://bazaarlink.ai/api/v1/plans \
| jq '.[] | {slug, tokenLimit, tokenLimitPeriod}'
# Example output:
# {
# "slug": "standard",
# "tokenLimit": 2000000,
# "tokenLimitPeriod": "day"
# }Calculate Next Reset Time (Example)
from datetime import datetime, timezone, timedelta
def next_reset(period: str) -> datetime:
now = datetime.now(timezone.utc)
if period == "day":
return (now + timedelta(days=1)).replace(
hour=0, minute=0, second=0, microsecond=0)
elif period == "week":
days_ahead = 7 - now.weekday() # Monday = 0
return (now + timedelta(days=days_ahead)).replace(
hour=0, minute=0, second=0, microsecond=0)
elif period == "month":
if now.month == 12:
return now.replace(year=now.year+1, month=1, day=1,
hour=0, minute=0, second=0, microsecond=0)
return now.replace(month=now.month+1, day=1,
hour=0, minute=0, second=0, microsecond=0)
elif period == "5h":
current_block = now.hour // 5
next_block_hour = (current_block + 1) * 5
if next_block_hour >= 24:
next_day = (now + timedelta(days=1)).replace(
hour=0, minute=0, second=0, microsecond=0)
return next_day
return now.replace(hour=next_block_hour, minute=0,
second=0, microsecond=0)
plan_period = "day" # from GET /api/v1/plans
print(f"Next reset: {next_reset(plan_period).isoformat()}")Cancel Subscription
After cancellation, the API Key immediately reverts to the free plan (standard rate limits). Subscription fees are non-refundable.
/api/v1/keys/:id/subscriptionResponse
{ "ok": true }Example
curl -X DELETE https://bazaarlink.ai/api/v1/keys/KEY_ID/subscription \ -H "Cookie: next-auth.session-token=YOUR_SESSION"
Full Flow Example
// 1. Query available plans
const plans = await fetch("/api/v1/plans").then(r => r.json());
// 2. Check account balance
const { data: credits } = await fetch("/api/v1/credits", {
headers: { Authorization: "Bearer sk-bl-YOUR_KEY" },
}).then(r => r.json());
// 3. Confirm balance then subscribe
const plan = plans.find(p => p.slug === "standard");
if (credits.total_credits < plan.priceUsd) {
throw new Error(`Insufficient balance: need $${plan.priceUsd}, current $${credits.total_credits}`);
}
const sub = await fetch("/api/v1/keys/KEY_ID/subscription", {
method: "POST",
credentials: "include",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ planSlug: "standard" }),
}).then(r => r.json());
console.log("Subscribed! Remaining balance:", sub.remainingCredits);
console.log("Plan:", sub.subscriptionPlan.slug);
console.log("RPM:", sub.subscriptionPlan.rpmLimit);
console.log("Token quota:", sub.subscriptionPlan.tokenLimit, "/", sub.subscriptionPlan.tokenLimitPeriod);
// 4. Cancel subscription (optional)
// await fetch("/api/v1/keys/KEY_ID/subscription", {
// method: "DELETE", credentials: "include"
// });AI Points System
Each subscription plan includes a daily AI point allowance. Different models consume different points per request.
Daily points
Points Tier Rules
Models are classified into tiers based on their API pricing (input + output per 1M tokens). Each request deducts points equal to the model's tier value from your daily allowance.
Check Points Balance
/api/v1/points/balance// GET /api/v1/points/balance
// Authorization: Bearer sk-bl-xxx
{
"dailyLimit": 3700,
"dailyUsed": 1250,
"dailyRemaining": 2450,
"resetAt": "2026-03-18T00:00:00+08:00"
}curl https://bazaarlink.ai/api/v1/points/balance \ -H "Authorization: Bearer sk-bl-YOUR_API_KEY"
API Response Headers
Every chat completion response includes point usage headers:
# Example response headers: # x-points-used: 25 # x-points-remaining: 2425 # x-points-daily-limit: 3700