无限制/OpenAI-Compatible API 文档
OpenAI-Compatible API 文档
在几分钟内开始使用我们的无审查 LLM API。向基础 URL 发送请求,接收原始文本,并在没有订阅费的情况下扩展。
https://api.unrestrictedaichatgpt.com/v1uncensored
认证与基础 URL
使用提供的 base URL 和 API 密钥访问服务。您的密钥对所有请求进行身份验证。
- 基础 URL:
https://api.unrestrictedaichatgpt.com/v1 - 标头:
Authorization: Bearer YOUR_API_KEY
从仪表板即时获取您的密钥。
curl https://api.unrestrictedaichatgpt.com/v1/chat/completions \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "uncensored",
"messages": [{"role": "user", "content": "Run python script to sum column in csv file"}]
}'
聊天完成端点
发送至 /v1/chat/completions 端点。模型 ID 是 uncensored.
请求返回文本响应。您可以通过 max_tokens.
from openai import OpenAI
client = OpenAI(base_url="https://api.unrestrictedaichatgpt.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)
流式响应(SSE)
通过将 stream: true. 通过服务器发送事件实时接收 Token。
Token 用量详情出现在最后一个 chunk 中。
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)
参数:温度、Top P 和 JSON 模式
调整 temperature 和 top_p 控制创造性。使用 response_format: {"type": "json_object"} 用于结构化输出。
设置 max_tokens 限制响应长度。
函数调用 & 工具
在请求中定义工具。模型会返回结构化的工具调用。
使用 tool_choice 用于强制执行特定行为。
import OpenAI from "openai";
const client = new OpenAI({ baseURL: "https://api.unrestrictedaichatgpt.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);
速率限制与约束
限制:每分钟 300 次请求,8 个并发请求。最大主体:8 MB。上下文窗口:100,000 个令牌。错误免费。不退款。
常见问题
上下文窗口大小是多少?
该模型支持 100,000 token 的上下文窗口,结合输入和输出。您可以为每次请求的输出指定最多 16,000 个 token。
如何处理错误?
常见错误包括 401(无效密钥)、402(无余额)和 429(速率限制)。错误不会消耗您的预付费余额。
这是官方的 OpenAI API 吗?
不是。这是一个 OpenAI 兼容 API,使用不同的无审查模型。使用相同的 SDK,但需更改基础 URL 和密钥。
生成您的密钥
注册,获取你的密钥,并更新端点。完成。