> ## Documentation Index
> Fetch the complete documentation index at: https://docs.gravitex.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Model Pricing Query

> Query available models, group discounts, base prices, and supported endpoints

## Endpoint details

| Item | Details |
| - | - |
| Base URL | `https://maas.gravitex.ai/prod-api` |
| Data format | `application/json` |
| Character encoding | `UTF-8` |
| Protocol | `HTTPS` (required) |
| Currency | `USD` (US dollars) |

This endpoint takes no request parameters. Send the authorization header with each request.

## 1. Authentication

Send a Bearer credential in the HTTP header. **Use either of the following credentials.**

| Credential | Where to find it | Query scope |
| - | - | - |
| System access token | Console → Personal Settings → System Access Token | Entire account |
| API key | Console → Token Management. Keys usually start with `sk-`. | This key only |

| Header | Required | Description |
| - | - | - |
| `Authorization` | Yes | Use `Bearer <credential>` with either credential above. |

```http theme={null}
# Option 1. System access token
Authorization: Bearer <access_token>

# Option 2. API key
Authorization: Bearer sk-xxxxxxxxxxxxxxxxxxxx
```

Authentication fails if the credential is missing, invalid, deleted, or disabled, or if the account is disabled.

***

## 2. Common response structure

```json theme={null}
{
  "code": 200,
  "msg": "操作成功",
  "data": { }
}
```

| Field | Type | Description |
| - | - | - |
| `code` | integer | Application status code. `200` indicates success. |
| `msg` | string | Status message |
| `data` | object | Response data. Returns `null` on failure. |

### Application status codes

| Code | Description |
| - | - |
| 200 | Success |
| 401 | Authentication failed (missing, invalid, or disabled credential) |

> Check `code` in the response body to determine whether the request succeeded.

### Amount format

* All amounts are in **US dollars (USD)** and are returned as **strings** to avoid loss of floating-point precision.
* Balance amounts always have **four decimal places**, for example `"986.9275"`.
* Model unit prices have no zero padding, for example `"40"`, `"2.5"`, and `"0.00075"`.

***

## 3. Model pricing query

```
GET /api/account/pricing
```

### 3.1 Query scope by credential

| Credential | Groups returned | Models returned |
| - | - | - |
| System access token | All groups available to the account | All models in the groups available to the account |
| API key | The group assigned to the key | Models in the key's group. If the key has model restrictions, only allowed models are returned. |

### 3.2 Fields in `data`

| Field | Type | Description |
| - | - | - |
| `currency` | string | Always `USD` |
| `tokenUnit` | string | Always `million`. Token prices are per million tokens. |
| `groups` | object\[] | Available groups and discounts. See 3.3. |
| `supportedEndpoint` | object | Endpoint types and request paths supported by the returned models. See 3.4. |
| `models` | object\[] | Available models and prices. See 3.5. |
| `tokenName` | string | Name of the current API key. Returned only when an API key is used. |

### 3.3 `groups` (groups and discounts)

| Field | Type | Description |
| - | - | - |
| `group` | string | Group identifier |
| `desc` | string | Group description |
| `ratio` | number | Group price multiplier. For example, `0.86` means 86% of the base price. |

> For the `auto` group, billing uses the multiplier of the group that handles the request. The `auto` ratio is for reference only.

### 3.4 `supportedEndpoint` (endpoint types)

Each key is an endpoint type and each value provides its request method and path.

```json theme={null}
{
  "openai":          { "method": "POST", "path": "/v1/chat/completions" },
  "anthropic":       { "method": "POST", "path": "/v1/messages" },
  "openai-response": { "method": "POST", "path": "/v1/responses" },
  "gemini":          { "method": "POST", "path": "/v1beta/models/{model}:generateContent" }
}
```

This map contains only endpoint types used by the returned models. Look up the types listed in each model's `supportedEndpointTypes` to find their request paths.

### 3.5 `models` (models and prices)

| Field | Type | Description |
| - | - | - |
| `modelName` | string | Model name to pass as the `model` parameter |
| `vendorName` | string | Model provider |
| `billingType` | integer | Billing type. See 3.8. |
| `enableGroups` | string\[] | Groups that can call the model |
| `supportedEndpointTypes` | string\[] | Supported endpoint types, mapped in `supportedEndpoint` |
| `billingMode` | string | Always `tiered_expr` for tiered models. Returned only for tiered models. |
| `tierBasis` | string\[] | Criteria used to select a tier. Returned only for tiered models. See 3.7. |
| `prices` | object | Model base prices, keyed by price item. See 3.6. |
| `pricingConfig` | object | Detailed billing configuration returned for some image, video, and omnimodal models. See 3.8. |

### 3.6 `prices` (price items)

**Token-based billing** (USD per million tokens)

| Price item | Description |
| - | - |
| `textInputTokens` | Text input |
| `textOutputTokens` | Text output |
| `cacheTokens` | Cache reads (cache hits) |
| `cacheCreationTokens5m` | Cache writes (5 minutes) |
| `cacheCreationTokens1h` | Cache writes (1 hour) |
| `imageInputTokens` | Image input |
| `imageOutputTokens` | Image output |
| `audioInputTokens` | Audio input |
| `audioOutputTokens` | Audio output |
| `videoInputTokens` | Video input |
| `videoOutputTokens` | Video output |

**Billing per request, second, or image**

| Price item | Unit |
| - | - |
| `perRequest` | USD per request |
| `seconds` | USD per second |
| `imageCount` | USD per image |

**Tiered price items** append a tier suffix to these keys. For text input, the tiered key uses `inputTokens` without the `text` prefix.

| Suffix | Meaning | Example |
| - | - | - |
| `Lte` | Less than or equal to | `inputTokensLte272K` applies to input of 272K or less |
| `Lt` | Less than | `inputTokensLt200K` |
| `Gte` | Greater than or equal to | `inputTokensGte200K` |
| `Gt` | Greater than | `textOutputTokensGt272K` is the output rate for the tier above 272K |
| Range | Lower bound first, then upper bound | `inputTokensGt32KLte128K` covers more than 32K and up to 128K |
| `Peak` / `OffPeak` | Peak / off-peak hours | `inputTokensPeak`, `inputTokensOffPeak` |

`K` means a thousand tokens and `M` means a million. For example, `272K` is 272,000 tokens and `1M` is 1,000,000 tokens.

### 3.7 `tierBasis` (tier selection criteria)

Models can use different criteria for the same suffix, such as `Lte272K`. Check `tierBasis` to see which criteria apply.

| tierBasis | Basis | What determines the tier |
| - | - | - |
| `context` | Context length | Total input context length, including cache hits |
| `input` | Input | Text input tokens, excluding cache, images, audio, and other separately priced items |
| `output` | Output | Output tokens for the request |
| `time` | Time of day | Request time (Beijing time) |

**Billing rules**

1. **One tier applies to the whole request.** Determine the tier from the request's usage. Input, output, cache, and other items all use rates from that tier, with no progressive billing across tiers.
   * For a model with `tierBasis = ["context"]`, a 300K context falls in `Gt272K`. Input, output, and cache use their corresponding `xxxGt272K` rates.
2. **Context length includes cache hits.** Text input excludes them.
   * With 200K new input tokens and 100K cache hits, context length is 300K (`Gt272K`) and text input is 200K (`Lte272K`).
3. **All listed criteria must match** when multiple criteria appear, such as `["input", "output"]`.
4. **Time-based pricing** takes two forms.
   * `prices` lists both `xxxPeak` and `xxxOffPeak` rates for peak and off-peak hours.
   * `prices` lists the base rate only. A multiplier applies during peak hours. Contact your account manager for hours and multipliers.

### 3.8 `billingType` (billing types)

| billingType | Description | prices | pricingConfig |
| - | - | - | - |
| 0 | Per token | Token price items, with tier suffixes for tiered models | None |
| 1 | Per request | `perRequest` | None |
| 2 | Image billing per token | Empty | Image token rates (USD per million tokens) |
| 3 | Video billing per second | `seconds` when a flat rate applies | Rates that vary by resolution, audio inclusion, and other factors |
| 4 | Omnimodal billing | Empty | Rates for text, images, audio, and other modalities |
| 5 | Per image | `imageCount` when a flat rate applies | Rates that vary by reference image count, output size, and other factors |
| 6 | Video billing per token | Token price items, including `videoOutputTokens` | Rates that vary by resolution, video input inclusion, and other factors |

> The `pricingConfig` structure varies by model. Refer to the API response for the actual configuration.

### 3.9 Effective unit price

```
Effective unit price = base price in prices × group ratio
```

For a model with `textInputTokens` of `"8"` used in a group with `ratio = 0.86`, the effective input price is 8 × 0.86 = **\$6.88 per million tokens**.

### 3.10 Example response

This example shows part of the response.

```json theme={null}
{
  "code": 200,
  "msg": "操作成功",
  "data": {
    "currency": "USD",
    "tokenUnit": "million",
    "groups": [
      { "group": "default",   "desc": "默认分组",  "ratio": 1.0 },
      { "group": "auto",      "desc": "自动",      "ratio": 1.0 },
      { "group": "Anthropic", "desc": "Anthropic", "ratio": 0.86 }
    ],
    "supportedEndpoint": {
      "openai":          { "method": "POST", "path": "/v1/chat/completions" },
      "anthropic":       { "method": "POST", "path": "/v1/messages" },
      "openai-response": { "method": "POST", "path": "/v1/responses" }
    },
    "models": [
      {
        "modelName": "claude-fable-5-2",
        "vendorName": "Anthropic",
        "billingType": 0,
        "enableGroups": ["Anthropic", "default"],
        "supportedEndpointTypes": ["openai", "anthropic"],
        "prices": {
          "textInputTokens": "8",
          "textOutputTokens": "40",
          "cacheTokens": "0.2",
          "cacheCreationTokens5m": "10"
        }
      },
      {
        "modelName": "gpt-5.4",
        "vendorName": "OpenAI",
        "billingType": 0,
        "enableGroups": ["default"],
        "supportedEndpointTypes": ["openai", "openai-response"],
        "billingMode": "tiered_expr",
        "tierBasis": ["context"],
        "prices": {
          "inputTokensLte272K": "2.5",
          "textOutputTokensLte272K": "15",
          "cacheTokensLte272K": "0.25",
          "inputTokensGt272K": "5",
          "textOutputTokensGt272K": "22.5",
          "cacheTokensGt272K": "0.5"
        }
      },
      {
        "modelName": "grok-imagine-image",
        "vendorName": "xAI",
        "billingType": 1,
        "enableGroups": ["default"],
        "supportedEndpointTypes": ["openai-images"],
        "prices": { "perRequest": "0.02" }
      }
    ]
  }
}
```

When you use an API key, `groups` contains only the key's group and `models` contains only the models available to that group. The response also includes `tokenName`.

***

## 4. Request examples

```bash theme={null}
# Query model prices
curl -s "https://maas.gravitex.ai/prod-api/api/account/pricing" \
  -H "Authorization: Bearer <access_token>"
```

***

## 5. Notes

1. **Refresh interval.** Price changes take effect within about one minute.
2. **Base prices.** Multiply the model's base price in `prices` by the applicable group's `ratio` to calculate the effective rate.
3. **Final charges.** Use the endpoint for queries and estimates. Refer to your bill for final charges.
4. **Credential security.** Keep system access tokens private because they provide access to account-wide information. To query one key's quota, use that API key.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.