Documenti
Avvio rapido
PingToken fornisce un endpoint API unificato per accedere a più modelli di IA. Tutte le richieste vanno a https://pingtoken.cn/api/v1
curl https://pingtoken.cn/api/v1/chat/completions \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"model": "deepseek-v4-pro",
"messages": [{"role": "user", "content": "Hello"}]
}'
Base URL: https://pingtoken.cn/api/v1
Autenticazione
Crea token API dalla pagina Console → Gestione Token. Ogni token può essere limitato a modelli specifici e limiti di frequenza. Includi il tuo token nell'intestazione Authorization di ogni richiesta API.
Include your token in the Authorization header as a Bearer token:
Authorization: Bearer YOUR_API_TOKEN
Tokens are created from the Console → Token Management page. The raw token value is shown only once upon creation — store it securely.
Completamenti Chat
Invia messaggi ai modelli di IA e ricevi risposte. Supporta le modalità streaming e non streaming.
Endpoint
POST https://pingtoken.cn/api/v1/chat/completions
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
model | string | Yes | Model ID (e.g. deepseek-v4-pro) |
messages | array | Yes | Array of message objects with role and content |
stream | boolean | No | Enable streaming (default: false) |
temperature | number | No | Sampling temperature (0-2) |
max_tokens | integer | No | Maximum tokens in the response |
Response
{
"id": "chatcmpl-abc123",
"model": "deepseek-v4-pro",
"choices": [{
"index": 0,
"message": {
"role": "assistant",
"content": "Hello! How can I help you today?"
},
"finish_reason": "stop"
}],
"usage": {
"prompt_tokens": 10,
"completion_tokens": 9,
"total_tokens": 19
}
}
Code Examples
import requests
url = "https://pingtoken.cn/api/v1/chat/completions"
headers = {
"Authorization": "Bearer YOUR_API_TOKEN",
"Content-Type": "application/json"
}
data = {
"model": "deepseek-v4-pro",
"messages": [
{"role": "user", "content": "Hello, how are you?"}
]
}
response = requests.post(url, headers=headers, json=data)
result = response.json()
# Print the assistant's reply
print(result["choices"][0]["message"]["content"])
print(f"Tokens used: {result['usage']['total_tokens']}")
# Streaming example
data["stream"] = True
with requests.post(url, headers=headers, json=data, stream=True) as r:
for line in r.iter_lines():
if line:
line = line.decode("utf-8")
if line.startswith("data: ") and line != "data: [DONE]":
import json
chunk = json.loads(line[6:])
content = chunk["choices"][0].get("delta", {}).get("content", "")
if content:
print(content, end="", flush=True)
import java.net.URI;
import java.net.http.*;
import java.io.*;
import com.google.gson.*;
public class ChatExample {
public static void main(String[] args) throws Exception {
HttpClient client = HttpClient.newHttpClient();
JsonObject data = new JsonObject();
data.addProperty("model", "deepseek-v4-pro");
JsonArray messages = new JsonArray();
JsonObject msg = new JsonObject();
msg.addProperty("role", "user");
msg.addProperty("content", "Hello, how are you?");
messages.add(msg);
data.add("messages", messages);
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://pingtoken.cn/api/v1/chat/completions"))
.header("Authorization", "Bearer YOUR_API_TOKEN")
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(data.toString()))
.build();
HttpResponse<String> response = client.send(request,
HttpResponse.BodyHandlers.ofString());
JsonObject result = JsonParser.parseString(response.body())
.getAsJsonObject();
String content = result.getAsJsonArray("choices")
.get(0).getAsJsonObject()
.getAsJsonObject("message")
.get("content").getAsString();
System.out.println(content);
int totalTokens = result.getAsJsonObject("usage")
.get("total_tokens").getAsInt();
System.out.println("Tokens used: " + totalTokens);
}
}
// Requires: JDK 11+ (HttpClient), Gson for JSON parsing
// Add to pom.xml:
// <dependency>
// <groupId>com.google.code.gson</groupId>
// <artifactId>gson</artifactId>
// <version>2.10.1</version>
// </dependency>
// Node.js 18+ (built-in fetch)
// For older Node.js, install: npm install node-fetch
const url = "https://pingtoken.cn/api/v1/chat/completions";
const headers = {
"Authorization": "Bearer YOUR_API_TOKEN",
"Content-Type": "application/json"
};
const body = {
model: "deepseek-v4-pro",
messages: [
{ role: "user", content: "Hello, how are you?" }
]
};
// Non-streaming request
const response = await fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body)
});
const result = await response.json();
console.log(result.choices[0].message.content);
console.log(`Tokens used: ${result.usage.total_tokens}`);
// Streaming request
body.stream = true;
const streamResp = await fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body)
});
const reader = streamResp.body.getReader();
const decoder = new TextDecoder();
let buffer = "";
while (true) {
const { done, value } = await reader.read();
if (done) break;
buffer += decoder.decode(value, { stream: true });
const lines = buffer.split("\n");
buffer = lines.pop() || "";
for (const line of lines) {
if (line.startsWith("data: ") && line !== "data: [DONE]") {
const chunk = JSON.parse(line.slice(6));
const content = chunk.choices[0]?.delta?.content;
if (content) process.stdout.write(content);
}
}
}
Modelli disponibili
Sfoglia la Piazza dei Modelli per vedere tutti i modelli supportati con prezzi dettagliati.
Note: PingToken only supports domestic Chinese AI models. Foreign models (Claude, OpenAI/GPT, Gemini, etc.) are not supported.
Popular models include:
| Model ID | Provider |
|---|---|
qwen3-max | Alibaba Cloud |
qwen3-plus | Alibaba Cloud |
deepseek-v4-pro | DeepSeek |
deepseek-r1 | DeepSeek |
ernie-5.0 | Baidu |
kimi-k2 | Moonshot AI |
glm-5 | Zhipu AI |
doubao-pro | ByteDance |
spark-4.0 | iFLYTEK |
View the complete list at the Model Plaza.
Prezzi
Ogni modello viene fatturato per 1.000 token, con tariffe diverse per input e output. Gli abbonati Pro godono di tariffe scontate. Consulta la Piazza dei Modelli per i prezzi specifici.
Usage costs are deducted from your wallet balance automatically. You can top up your balance from the Console → Wallet page.
Limiti di frequenza
Utenti gratuiti: 60 richieste/minuto. Utenti Pro: 600 richieste/minuto. Contattaci per limiti più elevati.
Rate limits are applied per API token. When the limit is exceeded, the API returns a 429 Too Many Requests response. Each token can have its own rate limit configured during creation.
Configurazione Client
Configure your PingToken model in various client tools. Replace MODEL_ID with the actual model ID and YOUR_API_TOKEN with your PingToken API key.
Base URL: https://pingtoken.cn/api/v1
Cursor
File: ~/.cursor/settings.json
{
"chat.model": "MODEL_ID",
"chat.openAiApiOverride": "https://pingtoken.cn/api/v1",
"chat.openAiApiKeyOverride": "YOUR_API_TOKEN"
}
Cherry Studio
在 Cherry Studio 的模型提供商配置中添加 OpenAI 兼容提供商:
{
"type": "openai",
"name": "PingToken",
"apiKey": "YOUR_API_TOKEN",
"apiUrl": "https://pingtoken.cn/api/v1",
"models": ["MODEL_ID"]
}
Cline (VS Code Extension)
File: cline_mcp_settings.json
{
"apiProvider": "openai",
"openAiApiKey": "YOUR_API_TOKEN",
"openAiBaseUrl": "https://pingtoken.cn/api/v1",
"openAiModelId": "MODEL_ID"
}
Dify
在 Dify 的模型提供商中选择「OpenAI API Compatible」:
{
"provider": "openai_api_compatible",
"model": "MODEL_ID",
"api_key": "YOUR_API_TOKEN",
"base_url": "https://pingtoken.cn/api/v1"
}
Claude Code Router
File: ~/.claude-code-router/config.json
{
"Providers": [
{
"name": "pingtoken",
"api_base_url": "https://pingtoken.cn/api/v1/chat/completions",
"api_key": "YOUR_API_TOKEN",
"models": ["MODEL_ID"]
}
],
"Router": {
"default": "pingtoken,MODEL_ID"
}
}
Codex CLI
通过环境变量或配置文件设置:
# 环境变量方式
export CODEX_API_BASE="https://pingtoken.cn/api/v1"
export CODEX_MODEL="MODEL_ID"
export CODEX_API_KEY="YOUR_API_TOKEN"
# codex_config.json 方式:
# {
# "apiBase": "https://pingtoken.cn/api/v1",
# "model": "MODEL_ID",
# "apiKey": "YOUR_API_TOKEN"
# }
更多 Agent 工具配置:
以下 Agent 工具已有独立文档页面,包含完整的安装和配置说明:
- Claude Code - 终端 AI 编程助手
- OpenClaw - 开源个人 AI 助手
- OpenCode - 开源 AI 编程助手
- Kilo Code - AI 编程助手
- GitHub Copilot - VS Code 插件
- WorkBuddy/CodeBuddy - AI Agent 编程助手
- Codex - OpenAI 终端 AI 编程助手
- Claude Code Router - Claude Code 请求路由工具
Qwen Code
File: qwen_code_config.json
{
"api_base": "https://pingtoken.cn/api/v1",
"api_key": "YOUR_API_TOKEN",
"model": "MODEL_ID"
}
Lingma
File: lingma_config.json
{
"apiKey": "YOUR_API_TOKEN",
"baseUrl": "https://pingtoken.cn/api/v1",
"model": "MODEL_ID"
}
Documentazione di Aiuto
欢迎使用 PingToken 帮助文档。这里提供详细的使用指南和操作说明,帮助您快速上手平台功能。
Regole di Fatturazione
费用计算方式
API 调用按 Token 用量计费,包括输入 Token 和输出 Token。每个模型有独立的输入/输出价格(每百万 Token),费用从用户账户余额实时扣除。
计算公式:总费用 = (输入 Token × 输入价格 + 输出 Token × 输出价格) / 1百万
扣费优先级
- Token 余额:直接按 Token 数量抵扣,优先级最高
- 订阅额度:购买订阅套餐获得的额度
- 钱包余额:充值获得,允许为负数
Regole di Utilizzo API
认证方式
所有 API 请求必须在 Authorization 请求头中携带令牌:
Authorization: Bearer YOUR_API_TOKEN
请求限制
| 用户类型 | 请求频率 | 上下文限制 |
|---|---|---|
| 免费用户 | 60 次/分钟 | 5K tokens |
| Pro 用户 | 600 次/分钟 | 无限制 |
错误处理
| 错误码 | 说明 |
|---|---|
| 401 | 未授权 - 检查 Authorization 头 |
| 402 | 余额不足 - 充值或等待奖励 |
| 429 | 请求超限 - 降低请求频率 |
Regole di Utilizzo Strumenti
通用规则
- 必须使用 PingToken 提供的 API 端点
- 必须配置正确的 Authorization 令牌
- 建议设置合理的速率限制
- 不要在公共仓库中提交令牌
支持的工具
OpenClaw、Claude-Code、Codex、Qoder、Cursor、Cherry Studio、Dify 等
Portafoglio, Abbonamento e Bonus Token
| 余额类型 | 获取方式 | 使用场景 | 是否可负 |
|---|---|---|---|
| Token 余额 | 注册奖励、邀请奖励 | 免费 API 调用 | 否 |
| 订阅额度 | 购买订阅套餐 | API 调用消费 | 否 |
| 钱包余额 | 充值 | 订阅支付、API 消费 | 是 |
Flusso di Gestione Token
创建令牌
- 登录控制台,进入"令牌管理"页面
- 填写令牌名称、过期时间
- 可选:绑定特定模型、设置速率限制
- 保存并复制令牌(仅显示一次)
使用令牌
在 API 请求头中携带令牌进行认证。建议为不同用途创建独立令牌,便于追踪和管理。
吊销令牌
在令牌管理页面点击"吊销"按钮,令牌立即失效。
Test Modello
- 登录控制台,进入"模型测试"页面
- 选择令牌和模型
- 设置温度、响应风格等参数
- 输入消息并发送
注意:测试对话使用付费模型会正常计费,消耗您的账户余额。
Test API Postman
配置步骤
- 创建 POST 请求:
https://pingtoken.cn/api/v1/chat/completions - 添加请求头:
Authorization: Bearer YOUR_API_TOKEN - 设置请求体(JSON 格式)
- 发送请求并查看响应
Test Codice Python
import requests
url = "https://pingtoken.cn/api/v1/chat/completions"
headers = {
"Authorization": "Bearer YOUR_API_TOKEN",
"Content-Type": "application/json"
}
data = {
"model": "deepseek-v4-pro",
"messages": [{"role": "user", "content": "Hello"}]
}
response = requests.post(url, headers=headers, json=data)
print(response.json()["choices"][0]["message"]["content"])
Guida di Test Strumenti
通用配置步骤
- 找到工具的 API 设置页面
- 设置 API 端点为
https://pingtoken.cn/api/v1 - 配置 Authorization 令牌
- 测试连接确保配置正确
常见工具配置
- Cursor: 在
~/.cursor/settings.json中配置 - Claude Code: 在
~/.claude/settings.json中配置 - OpenClaw: 在插件设置中配置