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

# 獲取定價

> 獲取模型的定價資訊

## 概覽

使用此端點可以列出目前對外可見的活躍模型定價資訊。

如需查看某個模型的完整定價詳細資料，包括結構化定價與溯源資訊，請優先使用 [取得模型定價](/api-reference/models/get-model)。

## 查詢參數

<ParamField query="provider" type="string">
  選填的供應商篩選，例如 `openai`、`anthropic` 或 `google`。
</ParamField>

<ParamField query="tag" type="string">
  選填的模型標籤篩選，例如 `chat`、`image`、`video`、`embedding` 或 `translation`。
</ParamField>

## 回應

<ResponseField name="object" type="string">
  始終為 `pricing`。
</ResponseField>

<ResponseField name="updated_at" type="string">
  回應中包含的最新定價條目的 ISO 時間戳。
</ResponseField>

<ResponseField name="currency" type="string">
  始終為 `USD`。
</ResponseField>

<ResponseField name="data" type="array">
  定價條目陣列。每一項都包含 `model`、`provider`、`is_lock_price`、`capabilities`、`aliases`，以及上方互動式 schema 回傳的公開純量或結構化定價摘要欄位。
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  curl "https://api.tokenlab.sh/v1/pricing?provider=openai&tag=chat" \
    -H "Authorization: Bearer sk-your-api-key"
  ```

  ```python Python theme={null}
  import requests

  response = requests.get(
      "https://api.tokenlab.sh/v1/pricing",
      headers={"Authorization": "Bearer sk-your-api-key"},
      params={"provider": "openai", "tag": "chat"}
  )

  print(response.json())
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch(
    'https://api.tokenlab.sh/v1/pricing?provider=openai&tag=chat',
    {
      headers: { 'Authorization': 'Bearer sk-your-api-key' }
    }
  );

  const data = await response.json();
  console.log(data);
  ```

  ```go Go theme={null}
  package main

  import (
      "encoding/json"
      "fmt"
      "net/http"
  )

  func main() {
      req, _ := http.NewRequest("GET", "https://api.tokenlab.sh/v1/pricing?provider=openai&tag=chat", nil)
      req.Header.Set("Authorization", "Bearer sk-your-api-key")

      client := &http.Client{}
      resp, _ := client.Do(req)
      defer resp.Body.Close()

      var result map[string]interface{}
      json.NewDecoder(resp.Body).Decode(&result)
      fmt.Println(result)
  }
  ```

  ```php PHP theme={null}
  <?php
  $ch = curl_init('https://api.tokenlab.sh/v1/pricing?provider=openai&tag=chat');

  curl_setopt_array($ch, [
      CURLOPT_RETURNTRANSFER => true,
      CURLOPT_HTTPHEADER => [
          'Authorization: Bearer sk-your-api-key'
      ]
  ]);

  $response = curl_exec($ch);
  curl_close($ch);

  $data = json_decode($response, true);
  print_r($data);
  ```
</RequestExample>

<ResponseExample>
  ```json Response theme={null}
  {
    "object": "pricing",
    "updated_at": "2026-04-20T00:00:00.000Z",
    "currency": "USD",
    "data": [
      {
        "model": "gpt-4o",
        "provider": "openai",
        "is_lock_price": false,
        "capabilities": ["chat"],
        "aliases": ["gpt-4o-latest"],
        "pricing": {
          "input_per_1m": "2.50",
          "output_per_1m": "10.00",
          "per_request": null,
          "is_lock_price": false,
          "currency": "USD"
        }
      }
    ]
  }
  ```
</ResponseExample>

<Note>
  請使用上方的互動式 OpenAPI 面板取得確切的回應 schema。公開定價條目也可能暴露 `lock_price_per_request`、`has_complex_pricing`、`supported_operations`、`pricing_summary` 與 `pricing_provenance`。
</Note>
