查询订阅状态
curl --request GET \
--url https://kaienapi.com/v1/dashboard/billing/subscription \
--header 'Authorization: Bearer <token>'import requests
url = "https://kaienapi.com/v1/dashboard/billing/subscription"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://kaienapi.com/v1/dashboard/billing/subscription', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://kaienapi.com/v1/dashboard/billing/subscription"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>"
}
}查询当前 Key 所属账号的订阅与账户状态。
何时调用
- 控制台展示账户状态。
- 客户端启动时检查当前 Key 是否有效。
- 展示余额、用量前确认账号可正常使用。
读取结果
响应字段会随账户状态变化而扩展,客户端按需读取已知字段,并保留未知字段。鉴权失败返回 401,通常表示 Key 缺失、格式错误或已经失效。
GET
/
v1
/
dashboard
/
billing
/
subscription
查询订阅状态
curl --request GET \
--url https://kaienapi.com/v1/dashboard/billing/subscription \
--header 'Authorization: Bearer <token>'import requests
url = "https://kaienapi.com/v1/dashboard/billing/subscription"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://kaienapi.com/v1/dashboard/billing/subscription', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://kaienapi.com/v1/dashboard/billing/subscription"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>"
}
}Authorizations
在请求头中传入:Authorization: Bearer sk-...
Response
订阅状态
The response is of type object.
⌘I