正在启动平台

访问量计数器 API 接入文档visits-counter

SVG/JSON访问量计数器,支持多套动效主题卡片(咒纹夜/术式蓝焰/五条悟风/无量空处/宿傩咒印等),可嵌入GitHub README或网站。按站点隔离计数。

1. 基本信息

接口地址https://v1.apizero.cn/api/visits-counter
请求方法GET
分类dev
提供方极数本源
计费模式免费试用
单次消耗0 积分
起步价
QPS 限制10 req/s
每日免费额度1000 次(已认证用户)
匿名每日额度500 次(无 API Key)
VIP 免费
调用次数

2. 认证

匿名调用 500 次/天,登录后 1000 次/天,API Key 按你的额度计算。

获取 API Key:登录 https://apizero.cn/account/keys

3. 请求参数

参数名类型必填说明示例
sitestring站点标识,用于区分不同来源(建议传你的域名)。不传时全局共享一个计数器。apizero.cn
namestring计数器名称,同一站点下可挂多个不同位置(首页/产品页/文章页等)。默认 demo。home
modestring计数模式:daily=每日清零 / total=累计不清零。默认 daily。total
themestring主题:默认 gojo_board(像素角色举牌+数字 GIF 动画)。可选 gojo_board/hoops_board/zero_board/jjk_infinity/rule34/moebooru/gelbooru/cursed_night/seal_blue/talisman_red/void_gold/gojo_satoru/infinity_void/sukuna_mark。前 7 个为像素牌主题(角色帧动画),后 7 个为 SVG 渐变主题。gojo_board
formatstring输出格式:svg(默认,可直接 <img> 嵌入网页)/ png(静态图,scale=1~4)/ json(原始 JSON 数据,便于自集成)。svg
lengthint数字位数 4~12,默认 7(前导补 0)。7
no_incrementint只读模式:1=只查询不递增(适合预览/调试)。默认 0。0

5. 请求示例

以下 5 种语言示例都是可直接运行的,只需把 YOUR_API_KEY 替换为实际 Key。

cURL

curl "https://v1.apizero.cn/api/visits-counter?site=apizero.cn&name=home&mode=total&theme=gojo_board&format=svg&length=7&no_increment=0&key=YOUR_API_KEY"

Python

import requests

resp = requests.get(
    "https://v1.apizero.cn/api/visits-counter",
    params={
    "site": "apizero.cn",
    "name": "home",
    "mode": "total",
    "theme": "gojo_board",
    "format": "svg",
    "length": "7",
    "no_increment": "0",
    "key": "YOUR_API_KEY",
},
    timeout=15,
)
resp.raise_for_status()
print(resp.json())

JavaScript (Node.js)

// Node.js 18+ / 浏览器原生 fetch
const params = new URLSearchParams({
  "site": "apizero.cn",
  "name": "home",
  "mode": "total",
  "theme": "gojo_board",
  "format": "svg",
  "length": "7",
  "no_increment": "0",
  "key": "YOUR_API_KEY",
});

const res = await fetch(`https://v1.apizero.cn/api/visits-counter?${params}`);
if (!res.ok) throw new Error(`HTTP ${res.status}`);
const data = await res.json();
console.log(data);

Go

package main

import (
	"fmt"
	"io"
	"net/http"
)

func main() {
	req, _ := http.NewRequest("GET", "https://v1.apizero.cn/api/visits-counter", nil)
	q := req.URL.Query()
	q.Set("site", "apizero.cn")
	q.Set("name", "home")
	q.Set("mode", "total")
	q.Set("theme", "gojo_board")
	q.Set("format", "svg")
	q.Set("length", "7")
	q.Set("no_increment", "0")
	q.Set("key", "YOUR_API_KEY")
	req.URL.RawQuery = q.Encode()

	resp, err := http.DefaultClient.Do(req)
	if err != nil { panic(err) }
	defer resp.Body.Close()
	body, _ := io.ReadAll(resp.Body)
	fmt.Println(string(body))
}

PHP

<?php
$url = "https://v1.apizero.cn/api/visits-counter?" . http_build_query([
    "site" => "apizero.cn",
    "name" => "home",
    "mode" => "total",
    "theme" => "gojo_board",
    "format" => "svg",
    "length" => "7",
    "no_increment" => "0",
    "key" => "YOUR_API_KEY",
]);

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 15);
$body = curl_exec($ch);
curl_close($ch);

$data = json_decode($body, true);
print_r($data);

6. 响应字段

字段类型说明示例
codestring业务码:200 成功,4xxx/5xxx 错误
descstring业务描述(success / 错误原因)
dataobject业务数据(仅 format=json 时返回;format=svg/png 时直接返回图片二进制)
data.namestring计数器名称(与请求参数 name 一致)
data.modestring计数模式:daily / total
data.themestring生效的主题键(不识别会回退 gojo_board)
data.theme_namestring主题中文名(前端可直接显示)
data.valueint当前计数值(按 mode 取 daily 或 total)
data.display_valuestring前导补 0 的展示值,与 SVG 上数字一致
data.recordobject完整计数记录
data.record.totalint历史累计计数
data.record.dailyint今日计数
data.record.daystring今日日期(YYYY-MM-DD)
data.record.updated_atstring记录最近更新时间(ISO8601)
data.incrementedbool本次调用是否已自增
data.stepint本次自增步长
data.lengthint生效的数字位数
data.formatstring生效的输出格式
tipsstring提供方提示

7. 响应示例

{
  "code": "200",
  "desc": "success",
  "data": {
    "name": "home",
    "mode": "daily",
    "theme": "gojo_board",
    "theme_name": "像素牌-苍空",
    "value": 42,
    "display_value": "0000042",
    "record": {
      "total": 1024,
      "daily": 42,
      "day": "2026-05-09",
      "updated_at": "2026-05-09T21:48:52+08:00"
    },
    "incremented": true,
    "step": 1,
    "length": 7,
    "format": "json"
  },
  "tips": "极数本源 · https://apizero.cn"
}

8. 错误码

codestatus说明
200成功
4015API Key 缺失或非法(v1 网关层)
4029触发 QPS 限频(v1 网关层)
4030触发当日免费/付费配额(v1 网关层)
4044接口已下线(v1 网关层)
5021本地渲染服务异常:server.py 不可达 / 超时 / 返回非预期 MIME

9. 变更日志

  • 1.0.0(2026-05-08)
    • 首次上线
    • 支持7套动效主题
    • 按站点隔离计数

常见问题

访问量计数器 接口怎么免费使用?

未登录用户每个 IP 每天 500 次免费。登录用户创建 API Key 后每天 1000 次免费,超额部分按点数计费(0 点/次)。

访问量计数器 支持哪些调用方式?

接口使用 GET 请求。文档提供 cURL、Python、JavaScript (Node.js)、Go、PHP 五种语言的可运行示例。也可以下载 /openapi.json 导入 Postman / Insomnia / Apifox 反向生成 SDK。

调用不限额么? QPS 是多少?

本接口 QPS 限制 10 req/s,每个 API Key 每日免费 1000 次。需要更高额度可升级 VIP 套餐或联系售后提高 QPS。

这个接口跟自己直连上游有什么区别?

极数本源 作为中间层提供:统一鉴权(一个 Key 调所有接口)、统一计费(点数制)、统一限流、统一错误码、多上游自动切换。免去逐个对接上游、维护 Key、统计调用量的运维成本。