无审查 API 快速入门指南
将我们的 OpenAI 兼容 API 接入您的现有代码库,生成文本且无内容审查。您只需按 token 使用量付费,无月费或隐藏费用。
前提条件与基础 URL
首先将请求发送至我们的专用基础 URL。我们提供单个无过滤模型 ID,可与标准 OpenAI SDK 配合使用。
- 基础 URL:
https://api.chatgptapipricing.com/v1 - 模型 ID:
uncensored
您需要从仪表板获取 API 密钥。该端点仅支持标准的聊天补全功能。
Auth 标头配置
将你的 API 密钥包含在 Authorization 每次请求时的请求头。使用 Bearer 方案以认证您的账户。
- 标头:
Authorization: Bearer YOUR_API_KEY
妥善保管此密钥。您可以随时在账户设置中生成新密钥。
发送你的第一次聊天补全
向...发起 POST 请求 /v1/chat/completions 附带您的系统和用户消息。API 根据您的提示返回文本响应。
输入令牌成本 $0.15 每 1M 令牌。输出令牌成本 $0.50 每 1M 令牌。错误不消耗信用。
curl https://api.chatgptapipricing.com/v1/chat/completions \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "uncensored",
"messages": [{"role": "user", "content": "Calculate the total tokens for this input string"}]
}'
处理流式响应
通过将 stream: true 在你的请求中。API 通过服务器发送事件 (SSE) 进行实时 token 传输。
每个块包含部分文本。最后一个块包含用于计费透明度的总 token 用量。
stream = client.chat.completions.create(
model="uncensored",
messages=[{"role": "user", "content": "Tell the story in second person."}],
stream=True,
)
for chunk in stream:
if chunk.choices and chunk.choices[0].delta.content:
print(chunk.choices[0].delta.content, end="", flush=True)Python
from openai import OpenAI
client = OpenAI(base_url="https://api.chatgptapipricing.com/v1", api_key="YOUR_KEY")
resp = client.chat.completions.create(
model="uncensored",
messages=[{"role": "user", "content": "Summarise this thread without softening it."}],
)
print(resp.choices[0].message.content)Node.js
import OpenAI from "openai";
const client = new OpenAI({ baseURL: "https://api.chatgptapipricing.com/v1", apiKey: process.env.API_KEY });
const resp = await client.chat.completions.create({
model: "uncensored",
messages: [{ role: "user", content: "Draft a villain monologue for my game." }],
});
console.log(resp.choices[0].message.content);