문서

빠른 시작

PingToken은 여러 AI 모델에 액세스할 수 있는 통합 API 엔드포인트를 제공합니다. 모든 요청은 다음 URL로 전송됩니다: 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

인증

콘솔의 토큰 관리 페이지에서 API 토큰을 생성하세요. 각 토큰은 특정 모델 및 속도 제한으로 제한할 수 있습니다. 모든 API 요청의 Authorization 헤더에 토큰을 포함해야 합니다.

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.

채팅 완성

AI 모델에 메시지를 보내고 응답을 받습니다. 스트리밍 및 비스트리밍 모드를 모두 지원합니다.

Endpoint

POST https://pingtoken.cn/api/v1/chat/completions

Request Body

FieldTypeRequiredDescription
modelstringYesModel ID (e.g. deepseek-v4-pro)
messagesarrayYesArray of message objects with role and content
streambooleanNoEnable streaming (default: false)
temperaturenumberNoSampling temperature (0-2)
max_tokensintegerNoMaximum 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);
    }
  }
}

사용 가능한 모델

모델 광장에서 모든 지원 모델과 상세 가격을 확인하세요.

Note: PingToken only supports domestic Chinese AI models. Foreign models (Claude, OpenAI/GPT, Gemini, etc.) are not supported.

Popular models include:

Model IDProvider
qwen3-maxAlibaba Cloud
qwen3-plusAlibaba Cloud
deepseek-v4-proDeepSeek
deepseek-r1DeepSeek
ernie-5.0Baidu
kimi-k2Moonshot AI
glm-5Zhipu AI
doubao-proByteDance
spark-4.0iFLYTEK

View the complete list at the Model Plaza.

가격

각 모델은 1,000 토큰당 가격이 책정되며 입력과 출력에 다른 요금이 적용됩니다. Pro 사용자는 할인된 요금이 적용됩니다. 구체적인 가격은 모델 광장을 확인하세요.

Usage costs are deducted from your wallet balance automatically. You can top up your balance from the Console → Wallet page.

속도 제한

무료 사용자: 분당 60회 요청. Pro 사용자: 분당 600회 요청. 더 높은 제한이 필요하시면 문의하세요.

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.

클라이언트 설정

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 工具已有独立文档页面,包含完整的安装和配置说明:

查看完整 Agent 工具列表 →

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"
}

도움말 문서

欢迎使用 PingToken 帮助文档。这里提供详细的使用指南和操作说明,帮助您快速上手平台功能。

과금 규칙

费用计算方式

API 调用按 Token 用量计费,包括输入 Token 和输出 Token。每个模型有独立的输入/输出价格(每百万 Token),费用从用户账户余额实时扣除。

计算公式:总费用 = (输入 Token × 输入价格 + 输出 Token × 输出价格) / 1百万

扣费优先级
  1. Token 余额:直接按 Token 数量抵扣,优先级最高
  2. 订阅额度:购买订阅套餐获得的额度
  3. 钱包余额:充值获得,允许为负数

API 사용 규칙

认证方式

所有 API 请求必须在 Authorization 请求头中携带令牌:

Authorization: Bearer YOUR_API_TOKEN
请求限制
用户类型请求频率上下文限制
免费用户60 次/分钟5K tokens
Pro 用户600 次/分钟无限制
错误处理
错误码说明
401未授权 - 检查 Authorization 头
402余额不足 - 充值或等待奖励
429请求超限 - 降低请求频率

도구 사용 규칙

通用规则
  • 必须使用 PingToken 提供的 API 端点
  • 必须配置正确的 Authorization 令牌
  • 建议设置合理的速率限制
  • 不要在公共仓库中提交令牌
支持的工具

OpenClaw、Claude-Code、Codex、Qoder、Cursor、Cherry Studio、Dify 等

지갑, 구독, 토큰 보너스 사용법

余额类型获取方式使用场景是否可负
Token 余额注册奖励、邀请奖励免费 API 调用
订阅额度购买订阅套餐API 调用消费
钱包余额充值订阅支付、API 消费

토큰 관리 흐름

创建令牌
  1. 登录控制台,进入"令牌管理"页面
  2. 填写令牌名称、过期时间
  3. 可选:绑定特定模型、设置速率限制
  4. 保存并复制令牌(仅显示一次)
使用令牌

在 API 请求头中携带令牌进行认证。建议为不同用途创建独立令牌,便于追踪和管理。

吊销令牌

在令牌管理页面点击"吊销"按钮,令牌立即失效。

모델 테스트

  1. 登录控制台,进入"模型测试"页面
  2. 选择令牌和模型
  3. 设置温度、响应风格等参数
  4. 输入消息并发送

注意:测试对话使用付费模型会正常计费,消耗您的账户余额。

Postman API 테스트

配置步骤
  1. 创建 POST 请求:https://pingtoken.cn/api/v1/chat/completions
  2. 添加请求头:Authorization: Bearer YOUR_API_TOKEN
  3. 设置请求体(JSON 格式)
  4. 发送请求并查看响应

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"])

도구 테스트 가이드

通用配置步骤
  1. 找到工具的 API 设置页面
  2. 设置 API 端点为 https://pingtoken.cn/api/v1
  3. 配置 Authorization 令牌
  4. 测试连接确保配置正确
常见工具配置
  • Cursor: 在 ~/.cursor/settings.json 中配置
  • Claude Code: 在 ~/.claude/settings.json 中配置
  • OpenClaw: 在插件设置中配置