无需绑卡。注册后,一键领取 $0.50免费试用额度(每人限领一次)。
获取 API 密钥简短说明
无审查 LLM API 是一个托管模型接口,针对合法成人用途进行优化,可无内容拒绝地回答。这里是一个由独立提供商运行的单一开放权重模型,通过 POST /v1/chat/completions 和 GET /v1/models 暴露。如果你的代码已经与 OpenAI 风格的接口通信,只需将 base URL 更改为 https://api.claudensfw.cc/v1,在 Bearer 头中放入密钥,并将模型设置为 uncensored。
这就是整个集成过程。本页面的其余部分是详细信息:三种语言的首次请求、支持的功能、限制行为以及每次请求的美元成本。如果你想要最短路径,文档中的快速入门在五分钟内涵盖相同内容。
获取密钥并测试
使用 Google 或电子邮件和密码注册。在 API 密钥页面,你可以一键领取 $0.50 的免费试用额度。每人限领一次,有效期 7 天,无需支付。打开 密钥页面 创建密钥并复制一次。
将密钥保留在源代码之外。将其导出为环境变量并从那里读取:
export API_KEY="paste-your-key-here"试用密钥限制为 2 个并发请求和每分钟 60 个请求。完整密钥(在充值后获得)允许 8 个并发请求和每分钟 300 个请求。这对于测试和大多数单应用程序工作负载来说已经足够。
curl、Python 和 Node 的首次请求
从 curl 开始,因为它消除了所有其他变量。如果这有效,任何客户端都会有效。
curl https://api.claudensfw.cc/v1/chat/completions \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "uncensored",
"messages": [
{"role": "system", "content": "You are a blunt, helpful writing partner."},
{"role": "user", "content": "Draft a tense opening scene for a noir story."}
]
}'回复具有通常的形状:choices[0].message.content 保存文本,usage 保存 token 计数。响应头还包含 X-Request-Id、X-Balance-USD 和两个速率限制头,这使得在每次调用时轻松记录剩余余额变得容易。
Python
import os
from openai import OpenAI
client = OpenAI(
base_url="https://api.claudensfw.cc/v1",
api_key=os.environ["API_KEY"],
)
resp = client.chat.completions.create(
model="uncensored",
messages=[
{"role": "system", "content": "You are a blunt, helpful writing partner."},
{"role": "user", "content": "Draft a tense opening scene for a noir story."},
],
temperature=0.8,
)
print(resp.choices[0].message.content)
print(resp.usage)Node
官方的 openai 包以相同的方式工作。示例使用 ES 模块,因此将其保存为 .mjs 文件或在 package.json 中设置 "type": "module"。
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://api.claudensfw.cc/v1",
apiKey: process.env.API_KEY,
});
const resp = await client.chat.completions.create({
model: "uncensored",
messages: [{ role: "user", content: "Give me three names for a harbor town." }],
});
console.log(resp.choices[0].message.content);流式输出、JSON 模式和工具
设置 stream: true,服务器会在生成文本时发送 Server-Sent Events,并在末尾包含 usage 块。对于长篇创意输出,这是实时填充页面与一分钟空白之间的区别。
# client = OpenAI(base_url="https://api.claudensfw.cc/v1", ...) as in the first example
stream = client.chat.completions.create(
model="uncensored",
messages=[{"role": "user", "content": "Write a short monologue for a retired smuggler."}],
stream=True,
stream_options={"include_usage": True},
)
for chunk in stream:
if chunk.choices and chunk.choices[0].delta.content:
print(chunk.choices[0].delta.content, end="", flush=True)
if chunk.usage:
print("\n", chunk.usage)通过 response_format 开启 JSON 模式。在提示词中说明你想要哪些键,因为该标志保证有效的 JSON 语法,但不保证你的模式。
# client = OpenAI(base_url="https://api.claudensfw.cc/v1", ...) as in the first example
resp = client.chat.completions.create(
model="uncensored",
messages=[
{"role": "system", "content": "Reply with a JSON object with keys name, role and backstory."},
{"role": "user", "content": "Create a side character for a space western."},
],
response_format={"type": "json_object"},
)工具调用遵循 OpenAI 格式:传递 tools 和 tool_choice,从回复中读取 tool_calls,自己运行函数,然后以 role: "tool" 消息发送结果。流式响应将 tool_calls 作为 delta 携带。
# client = OpenAI(base_url="https://api.claudensfw.cc/v1", ...) as in the first example
tools = [{
"type": "function",
"function": {
"name": "roll_dice",
"description": "Roll a die with the given number of sides",
"parameters": {
"type": "object",
"properties": {"sides": {"type": "integer"}},
"required": ["sides"],
},
},
}]
resp = client.chat.completions.create(
model="uncensored",
messages=[{"role": "user", "content": "Roll a d20 for the lockpicking check."}],
tools=tools,
tool_choice="auto",
)
print(resp.choices[0].message.tool_calls)采样设置如 temperature、top_p、stop、seed 和惩罚项将传递给模型。上下文窗口为 100,000 个 token,提示词和补全内容合计,max_tokens 是可选的。
限制以及 429 状态码的含义
实际上有两个限制:每分钟请求数和同时请求数。当你超过第一个时,API 返回 HTTP 429,错误代码为 rate_limited。当你超过第二个时,它返回 429,代码为 concurrency。在临时过载时,你还会收到 429,带有 Retry-After: 5 头,因此等待五秒是正确的响应。
一个细节让人措手不及:流式请求在流结束前保持其并发槽位。八个用户读取八个长流将阻塞第九个请求,即使每分钟计数很低。在客户端前面添加一个小队列或信号量可以解决此问题。
# client = OpenAI(base_url="https://api.claudensfw.cc/v1", ...) as in the first example
import time
from openai import RateLimitError
def ask(messages, tries=4):
for attempt in range(tries):
try:
return client.chat.completions.create(model="uncensored", messages=messages)
except RateLimitError:
time.sleep(5 * (attempt + 1))
raise RuntimeError("still rate limited after retries; base URL: https://api.claudensfw.cc/v1")最大请求体为 8 MB。这远高于 100,000 个 token 提示词所需,因此只有在文本中嵌入大型编码文件时才会达到此限制。
模型将做和不会做什么
该模型是开放权重的,经过调校,不会因内容原因而拒绝,适合小说、角色扮演、伴侣应用、敏感主题研究和成人审核工具。它不是 Meta、Mistral、Qwen、DeepSeek、OpenAI、xAI、Google、Anthropic 或任何其他供应商的官方 API,也不是跨供应商的路由器。你正在与一个模型对话。
三个边界是固定的。涉及未成年人的性内容永远不允许。服务仅限文本,因此没有图像、音频或视频生成,没有嵌入和微调。合法使用由你负责:移除拒绝并不移除法律或你部署的平台规则。提示词不用于训练。
成本和加密货币支付
价格为每 100 万输入 token $0.15,每 100 万输出 token $0.50,从预付额度中扣费,无订阅。失败或被拒的请求不收费,且额度永不失效。一次典型的对话轮次包含 2,000 个输入 token 和 500 个输出 token,输入费用为 $0.0003,输出费用为 $0.00025,总计 $0.00055。$0.50 的试用额度可覆盖约 900 次该规模的请求。
充值金额为 $20 至 $500 的整数金额,通过 TRC20 上的 USDT 或 Base 上的 USDC 支付。$50 起赠 5%,$100 起赠 10%,$200 起赠 15%,即充值 $100 获得 $110 额度,充值 $200 获得 $230 额度。详情和示例见 定价页面。请留意响应头中的 X-Balance-USD 字段,以便在需要时进行充值。
如果你遇到本页面未解释的问题,支持页面 列出了如何联系我们,引用失败响应中的 X-Request-Id 可以加快处理速度。
