获取账户剩余积分
curl --request GET \
--url https://api.nanobananaapi.ai/api/v1/common/credit \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.nanobananaapi.ai/api/v1/common/credit"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.nanobananaapi.ai/api/v1/common/credit', 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.nanobananaapi.ai/api/v1/common/credit",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$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.nanobananaapi.ai/api/v1/common/credit"
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))
}HttpResponse<String> response = Unirest.get("https://api.nanobananaapi.ai/api/v1/common/credit")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.nanobananaapi.ai/api/v1/common/credit")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"code": 200,
"msg": "success",
"data": 100
}通用API
获取剩余积分
GET
/
api
/
v1
/
common
/
credit
获取账户剩余积分
curl --request GET \
--url https://api.nanobananaapi.ai/api/v1/common/credit \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.nanobananaapi.ai/api/v1/common/credit"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.nanobananaapi.ai/api/v1/common/credit', 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.nanobananaapi.ai/api/v1/common/credit",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$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.nanobananaapi.ai/api/v1/common/credit"
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))
}HttpResponse<String> response = Unirest.get("https://api.nanobananaapi.ai/api/v1/common/credit")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.nanobananaapi.ai/api/v1/common/credit")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"code": 200,
"msg": "success",
"data": 100
}查询您账户中当前可用的积分余额。
使用指南
- 使用此接口检查您当前的积分余额
- 监控使用情况以确保有足够的积分继续使用服务
- 根据您的使用模式规划积分充值
开发者注意事项
- 所有生成服务都需要积分余额
- 当积分耗尽时,服务访问将受到限制
- 积分消耗基于具体服务和使用量
授权
所有 API 都需要通过 Bearer Token 进行身份验证。
获取 API Key:
- 访问 API Key 管理页面 获取您的 API Key
使用方法: 在请求头中添加: Authorization: Bearer YOUR_API_KEY
注意:
- 请保护您的 API Key 安全,不要与他人分享
- 如果您怀疑 API Key 已泄露,请立即在管理页面重置
响应
请求成功
响应状态码
| 状态码 | 说明 |
|---|---|
| 200 | 成功 - 请求已成功处理 |
| 401 | 未授权 - 身份验证凭据缺失或无效 |
| 402 | 积分不足 - 账户没有足够的积分来执行操作 |
| 404 | 未找到 - 请求的资源或端点不存在 |
| 422 | 验证错误 - 请求参数未通过验证检查 |
| 429 | 请求限制 - 此资源的请求限制已超出 |
| 455 | 服务不可用 - 系统当前正在进行维护 |
| 500 | 服务器错误 - 处理请求时发生意外错误 |
| 505 | 功能已禁用 - 请求的功能当前已禁用 |
可用选项:
200, 401, 402, 404, 422, 429, 455, 500, 505 当 code != 200 时的错误消息
示例:
"success"
剩余积分数量
示例:
100
⌘I