中文 ▾

unrestrictedgemini.com无审查 API。零拒绝。直接。

无限制 Gemini
获取您的密钥

集成 Uncensored LLM API

使用标准 OpenAI SDK 代码集成无审查 LLM API。本指南涵盖身份验证、聊天补全、流式传输和工具使用,适用于您的下一代 AI 应用。

认证和基础 URL

首先设置基础 URL 和 API 密钥。API 位于 https://api.unrestrictedgemini.com/v1. 在仪表板上生成您的密钥,并将其传入 Authorization 。

  • 基础 URL: https://api.unrestrictedgemini.com/v1
  • 标头: Authorization: Bearer YOUR_API_KEY
curl https://api.unrestrictedgemini.com/v1/chat/completions \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "uncensored",
    "messages": [{"role": "user", "content": "list the top ten python libraries"}]
  }'

聊天完成端点

发送至 /v1/chat/completions 端点。使用模型 ID uncensored 用于无限制输出。API 接受标准的 OpenAI 聊天格式。

from openai import OpenAI

client = OpenAI(base_url="https://api.unrestrictedgemini.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 使用数据。

import OpenAI from "openai";

const client = new OpenAI({ baseURL: "https://api.unrestrictedgemini.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);

函数调用与工具

在请求中定义工具。API 支持标准函数调用参数。传递你的工具定义并让模型决定何时调用它们。

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)

JSON 模式配置

通过设置 response_format 到 {"type": "json_object"}. 这确保了你的后端服务的解析一致性。非常适合自动化工作流。

Token 限制与参数

上下文窗口总共支持 100,000 个 token。最大输出为 16,000 个 token。适当处理 401、402 和 429 错误。速率限制为每分钟 300 次请求。

常见问题

无限制 gemini API 的基础 URL 是什么?

基础 URL 为 HTTPS://api.unrestrictedgemini.com/v1。您必须更新 SDK 配置,使其指向此地址,而不是默认的 OpenAI 端点。

如何处理流式传输响应?

在请求中将 stream 参数设置为 true。API 返回包含 token chunks 的服务器发送事件。解析这些事件以向用户显示实时输出。

如果我超出速率限制会怎样?

您将收到 429 请求过多错误。限制为每个密钥每分钟 300 次请求。在客户端代码中实现指数退避,以优雅地处理这些重试。

生成您的 API 密钥

注册,获取令牌,并更新端点。这就是整个过程。

获取您的密钥查看文档