BazaarLinkBazaarLink
Sign in
DocsAPI ReferenceSDK ReferenceAgentic UsageAI Skills

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).

AI Skill File
Paste the link below into any AI assistant (Claude, Cursor, Copilot…) to give it full context on the BazaarLink Subscription API: bazaarlink.ai/subscriptionskill.md
Standard
$10 USD/mo
60 req/min2.0M tokens / daily0 pts/day

Query Available Plans

Public endpoint, no authentication required. Returns all active subscription plans including price, rate limits, token quota, and available model list.

GET/api/v1/plans

Response

json
[
  {
    "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

bash
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).

POST/api/v1/keys/:id/subscription
Authentication
This endpoint requires a user Session Cookie (automatically included after logging in at the account portal). Bearer API Key authentication is not accepted.

Request Body

planSlugrequired
string
Plan identifier, e.g. "standard", "pro", "max". Obtain from GET /api/v1/plans.

Response

json
{
  "ok": true,
  "remainingCredits": 80.0000,   // balance after deduction
  "subscriptionPlan": {
    "id": "clxxxxx",
    "slug": "standard",
    "priceUsd": 20,
    "rpmLimit": 60,
    "tokenLimit": 2000000,
    "tokenLimitPeriod": "day"
  }
}

Error Codes

400
planSlug is empty or malformed
401
Not logged in
402
Insufficient account balance — response includes a required field showing the amount needed
404
Key does not exist or does not belong to this account, or planSlug has no matching plan
400
Plan is not active (active: false)

Example

bash
# 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.

bash
# 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:

bash
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:

GET/api/v1/credits

Response

json
{
  "data": {
    "total_credits": 80.0000,   // current remaining balance (USD)
    "total_usage": 42.1234      // lifetime API spend since account creation
  }
}

Example

bash
curl https://bazaarlink.ai/api/v1/credits \
  -H "Authorization: Bearer sk-bl-YOUR_API_KEY"
Confirm Balance Before Subscribing
Check your balance before calling POST /api/v1/keys/:id/subscription. When balance is insufficient, the API returns a 402 error with a required field showing the amount needed.

Token Quota & Reset Schedule

Each plan has a token quota (tokenLimit) and reset period (tokenLimitPeriod). Resets are based on UTC time:

Period
Reset Time
5hEvery 5 hours on the hour (00:00, 05:00, 10:00, 15:00, 20:00 UTC)
dayDaily at 00:00 UTC
weekEvery Monday at 00:00 UTC
month1st of each month at 00:00 UTC

Query Plan Token Quota

bash
# 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)

python
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()}")
Token Count Notes
tokenLimit counts actual tokens consumed (input + output), not USD credit value. Requests exceeding the quota receive a 429 Token quota exceeded error.

Cancel Subscription

After cancellation, the API Key immediately reverts to the free plan (standard rate limits). Subscription fees are non-refundable.

DELETE/api/v1/keys/:id/subscription

Response

json
{ "ok": true }

Example

bash
curl -X DELETE https://bazaarlink.ai/api/v1/keys/KEY_ID/subscription \
  -H "Cookie: next-auth.session-token=YOUR_SESSION"

Full Flow Example

typescript
// 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

Standard
0 pts/day
$10 USD/mo
Daily Reset
Points reset daily at 00:00 UTC+8. Unused points do not carry over. Long responses are charged dynamically based on actual token usage.
New Account
New accounts (first 72 hours) receive reduced 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.

Tier
pts/call
Input ≤ ($/1M)
Output ≤ ($/1M)
Budget
1pt
$0.30
$1.00
Mid
2pt
$0.50
$1.50
Mid
3pt
$1.20
$2.50
Premium
5pt
$1.00
$3.50
Premium
8pt
$2.00
$6.00
Flagship
15pt
$3.00
$12.00
Flagship
25pt
Points Tier Rules
Tier brackets are also available via GET /api/v1/tier-brackets for programmatic use.
Claude Opus 4.6
Claude Opus 4.6 is not included in subscription plans. Use pay-as-you-go credits (1.5× markup).

Check Points Balance

GET/api/v1/points/balance
json
// GET /api/v1/points/balance
// Authorization: Bearer sk-bl-xxx

{
  "dailyLimit": 3700,
  "dailyUsed": 1250,
  "dailyRemaining": 2450,
  "resetAt": "2026-03-18T00:00:00+08:00"
}
bash
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:

x-points-used
number
Points consumed by this request.
x-points-remaining
number
Remaining daily points after this request.
x-points-daily-limit
number
Total daily point allowance for the current plan.
bash
# Example response headers:
# x-points-used: 25
# x-points-remaining: 2425
# x-points-daily-limit: 3700
Support
Support
Hi! How can we help you?
Send a message and we'll get back to you soon.