トークン一覧の取得
curl --request GET \
--url https://api.example.com/api/token/import requests
url = "https://api.example.com/api/token/"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.example.com/api/token/', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/api/token/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/api/token/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.example.com/api/token/")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/token/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_bodyAPI キー & コンソール管理
トークン一覧の取得
現在のユーザーの API トークン一覧をページング取得します
GET
/
api
/
token
/
トークン一覧の取得
curl --request GET \
--url https://api.example.com/api/token/import requests
url = "https://api.example.com/api/token/"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.example.com/api/token/', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/api/token/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/api/token/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.example.com/api/token/")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/token/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body内容更新日: 2026-07-20
インターフェース説明
現在のユーザーが作成したすべての API トークン(Token)を取得します。ページング機能をサポートします。この
/api/token/* インターフェース群は、Crazyrouter コンソールの API Key 管理自動化に主に使用されます。ユーザーの access token と New-Api-User リクエストヘッダーが必要です。通常の sk-xxx モデル呼び出しプロセス向けのインターフェースではありません。リクエストのベース URL には必ず https://crazyrouter.com を利用してください。https://api.crazyrouter.com はモデル API 専用入り口で、管理パスで呼び出すと 404 api_only_endpoint が返されます。認証方法
ユーザーの Access Token を利用して認証を行います。リクエストヘッダーに以下を含めてください:Authorization: Bearer {access_token}
New-Api-User: {user_id}
リクエストパラメータ
レスポンス形式
{
"success": true,
"message": "",
"data": {
"page": 1,
"page_size": 10,
"total": 1,
"items": [
{
"id": 1,
"user_id": 1,
"key": "sk-xxxxxxxxxxxxxxxx",
"status": 1,
"name": "我的令牌",
"created_time": 1706000000,
"accessed_time": 1706100000,
"expired_time": -1,
"remain_quota": 500000,
"unlimited_quota": false,
"model_limits_enabled": true,
"model_limits": "[\"gpt-5.5\",\"claude-opus-4-8\"]",
"allow_ips": "203.0.113.10",
"used_quota": 12345,
"group": "default"
}
]
}
}
フィールド説明
| フィールド | 型 | 説明 |
|---|---|---|
id | int | トークンID |
key | string | API Key(sk-xxx形式) |
status | int | 状態:1=有効、2=無効 |
name | string | トークン名称 |
expired_time | int | 有効期限のタイムスタンプ。-1 は期限なし |
remain_quota | int | 残り使用枠 |
unlimited_quota | bool | 無制限枠か否か |
used_quota | int | 使用済み枠 |
model_limits_enabled | bool | モデルのホワイトリストを有効にしているか |
model_limits | string | モデル制限設定文字列 |
allow_ips | string | IPホワイトリスト文字列 |
group | string | グループ |
コード例
import requests
headers = {
"Authorization": "Bearer your_access_token",
"New-Api-User": "1",
"User-Agent": "Mozilla/5.0"
}
response = requests.get(
"https://crazyrouter.com/api/token/?p=1&size=100",
headers=headers
)
page = response.json()["data"]
for token in page["items"]:
print(f"[{token['name']}] {token['key'][:10]}... 额度: {token['remain_quota']}")
curl "https://crazyrouter.com/api/token/?p=1&size=100" \
-H "Authorization: Bearer your_access_token" \
-H "New-Api-User: 1"