Skip to content
Halaman ini belum tersedia dalam bahasa anda, jadi kandungannya dipaparkan dalam bahasa Inggeris.

Model Pricing API

GET /api/pricing/model for display rates

Semua dokumentasi
  • Read only data.pricing; effective_rates is what users pay
  • Tool prices must be multiplied by price_factor
  • Contract is generic for TokenPricingV2 models

Examples use qwen3.8-max, but the data.pricing shape is shared by all TokenPricingV2 models.

http
GET /api/pricing/model?model=qwen3.8-max

Model behavior and billing rules: qwen3.8-max guide.

Note

This endpoint does not require authentication. Do not send Authorization.

Request parameters

modelstringrequired

Model ID, e.g. qwen3.8-max. Required; omitting it returns 400 Missing model parameter.

Read only data.pricing

The response may include several overlapping price blocks — frontends should only use data.pricing:

BlockPurposeFrontend
data.pricingFlat, self-describing display view✅ Use this
data.token_priceLegacy flat copy❌ Compatibility only; missing fields
data.token_pricingInternal snapshot❌ Implementation details

token_price may omit fields like explicit_cached_input, so estimates run high. New billing dimensions are added only under pricing.

json
{
  "token_price": {
    "input": 1.714286,
    "cached_input": 0.214286,
    "cache_write": 2.142857,
    "output": 5.142857
  },
  "pricing": {
    "rates": {
      "input": 1.714286,
      "cached_input": 0.214286,
      "cache_write": 2.142857,
      "explicit_cached_input": 0.142857,
      "output": 5.142857
    }
  }
}

rates vs effective_rates

FieldMeaning
ratesList / strikethrough price
effective_ratesWhat to display as payable (discounts applied)
discount_rateModel discount (1 = none)
group_ratioGroup multiplier
price_factordiscount_rate × group_ratio
json
{
  "discount_rate": 1,
  "group_ratio": 0.8,
  "price_factor": 0.8,
  "rates": { "input": 1.714286, "output": 5.142857 },
  "effective_rates": { "input": 1.3714288, "output": 4.1142856 }
}

Use effective_rates for UI prices — do not multiply yourself. Use rates only when showing list price alongside.

Note

group is often default: public pricing pages quote default. A user’s real charge uses their group and may be lower than the displayed price.

rates / effective_rates use usd_per_million_tokens (USD per 1M tokens).

Tool prices: extras.tools is list price only

Asymmetry in the current API:

ListPayable
Tokensrateseffective_rates (precomputed)
Built-in toolsextras.tools[x].priceNo effective field — multiply by price_factor yourself
js
const listed = pricing.extras.tools.web_search.price;
const actual = listed * pricing.price_factor; // display this

Respect unit — do not hardcode “per 1k calls”:

unitMeaningCost
usd_per_1000_queriesPer 1000 callsprice / 1000 × count
usd_per_pagePer pageprice × pages (do not divide by 1000)

Three-state field semantics

CaseJSONMeaning
Present"explicit_cached_input": 0.142857Bill at this rate
Key missing—Dimension not applicable (not zero, not free)
Explicit 0"price": 0Actually free — show as free

Examples:

  • Missing output_thinking → single output rate; do not render “thinking is free”. For qwen3.8-max, thinking cannot be disabled and there is one output price.
  • Missing extras.google_web_search → Vertex-only; Bailian-style search is under extras.tools.web_search.
  • Tool with price: 0 → explicit free (e.g. promo); show free.

Multi-tier: only tier_count

json
{
  "billing_type": "tiered_token",
  "tier_count": 1
}
CheckBehavior
tier_count === 1Do not render a tier table; use rates / effective_rates
tier_count > 1tiers[] present; up_to_input_tokens is inclusive upper bound; missing key = uncapped (usually last tier)

Tier rule: pick one tier from total input tokens of the request, then price the whole request at that tier (not progressive). Values in tiers are list prices — multiply by price_factor.

Warning

Do not use billing_type === "tiered_token" to detect multi-tier pricing — single-tier models can still use that value. Only trust tier_count.

limits (not prices)

json
{
  "limits": {
    "max_input_tokens": 983616,
    "max_output_tokens": 131072,
    "supports_cache_read": true,
    "supports_cache_write": true
  }
}
  • supports_cache_*: capability flags; if false, do not present cache rates as available even if present in rates.
  • max_output_tokens: pre-charge style cap when max_tokens is omitted — not a price.

TypeScript types

ts
type ToolItem = {
  unit: "usd_per_1000_queries" | "usd_per_page";
  price: number; // list price; × price_factor for display
  precharge_queries?: number;
};

type Rates = {
  input?: number;
  cached_input?: number;
  explicit_cached_input?: number;
  cache_write?: number;
  cache_write_5m?: number;
  cache_write_1h?: number;
  output?: number;
  output_thinking?: number;
  text_input?: number;
  cached_text_input?: number;
  image_input?: number;
  cached_image_input?: number;
  text_output?: number;
  image_output?: number;
};

type ModelPricing = {
  billing_type: string;
  source: "v1" | "v2";
  unit: "usd_per_million_tokens";
  pricing_mode: "standard" | "image_modalities";
  discount_rate: number;
  group: string;
  group_ratio: number;
  price_factor: number;
  resolved_from?: string;
  rates?: Rates;
  effective_rates?: Rates;
  tier_count: number;
  tiers?: (Rates & { up_to_input_tokens?: number })[];
  limits?: {
    max_input_tokens?: number;
    max_output_tokens?: number;
    supports_cache_read: boolean;
    supports_cache_write: boolean;
  };
  extras?: {
    tools?: Record<string, ToolItem>;
    google_web_search?: ToolItem;
  };
};

Tool row helper

js
const toolRows = Object.entries(pricing.extras?.tools ?? {}).map(
  ([tool, item]) => ({
    tool,
    actual: item.price * pricing.price_factor,
    suffix: item.unit === "usd_per_page" ? "/ page" : "/ 1k calls",
    free: item.price === 0,
  }),
);

Common mistakes

WrongRight
Read token_priceRead pricing.rates / pricing.effective_rates
Multiply rates yourselfUse effective_rates
Show raw extras.tools[x].priceMultiply by price_factor
Hardcode “per 1k calls”Branch on item.unit
Treat missing keys as 0 / freeMissing = N/A; only explicit 0 is free
Use billing_type for tiersUse tier_count > 1
Read tiers for single-tierUse rates
Mix pricing_mode fieldsstandard vs image_modalities are exclusive

Request examples

bash
curl --request GET \
  --url 'https://api.apisea.ai/api/pricing/model?model=qwen3.8-max' \
  --header 'Accept: application/json'
python
import requests

url = "https://api.apisea.ai/api/pricing/model"
params = {"model": "qwen3.8-max"}
headers = {"Accept": "application/json"}
print(requests.get(url, params=params, headers=headers).json())

Menemui masalah dalam dokumentasi ini? E-mel support@apisea.ai.