中文 ▾
创建键

API 文档:uncensored 聊天补全

集成你的 OpenAI 兼容客户端,立即使用我们的无审查模型生成文本。我们提供专用端点,接受标准参数,同时移除对合法成人主题的内容拒绝。

认证与基础 URL

每次请求需要在 Authorization 标题。我们的基础 URL 为 https://api.deepseekopenaicompatibleapi.com/v1. 您会在通过 Google 或电子邮件注册后立即获得此密钥。不需要电话号码。该密钥标识您的账户并跟踪预付费信用额度的使用。错误和拒绝不会消耗 Token,因此您只为成功的完成付费。

聊天完成端点

发送消息至 POST /v1/chat/completions 生成文本响应。模型 ID 始终为 uncensored. 此端点处理带有 system、user 和 assistant 角色的标准聊天格式。它不支持嵌入、图像或微调。使用所需的模型参数和内容配置您的请求。响应返回生成的文本以及 token 使用统计信息。

流式响应(SSE)

通过将 stream: true 在您的请求正文中。服务器返回用于实时 Token 传输的服务器发送事件 (SSE)。Token 使用数据仅出现在流的最后一个数据块中。这种方法降低了长输出的感知延迟。在客户端缓冲传入的事件以重建完整消息。

cURL

curl https://api.deepseekopenaicompatibleapi.com/v1/chat/completions \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "uncensored",
    "messages": [{"role": "user", "content": "Summarize the release notes of the last stable build"}]
  }'

Python

from openai import OpenAI

client = OpenAI(base_url="https://api.deepseekopenaicompatibleapi.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.deepseekopenaicompatibleapi.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);

流式传输

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)

获取您的 API 密钥

注册,获取你的密钥,并更新基础 URL。这就是你需要做的全部。

创建键