快速上手:無審查 API
將此無審查 LLM 接入您現有的 OpenAI 相容技術堆疊,即可立即開始生成文字。我們提供直接的 API 端點與透明的令牌計費邏輯,讓您清楚知道每一筆費用。
身份驗證與基礎 URL
首先將您的客戶端指向我們特定的基礎 URL,並使用您獨特的 API 金鑰。我們採用簡單的驗證模型,您的金鑰授予對 uncensored 端點的存取權。您可以透過我們的金鑰頁面使用 Google 登入或電子郵件即時產生此金鑰。基礎 URL 為 https://api.pricingopenrouter.com/v1. 此結構可確保與標準 OpenAI SDK 相容,無需自訂包裝函式。您無需管理多個供應商金鑰或處理複雜的路由邏輯。只需設定環境變數,即可開始發送請求。系統會在處理任何權杖之前驗證您的憑證。如果您的金鑰無效,API 會立即返回 401 錯誤。這種直接方法移除了通常會使標準聚合器複雜化的代理層。
傳送您的第一個聊天完成請求
發送標準聊天完成請求以從 uncensored 模型接收文本回應。模型 id 只是 uncensored. 此開放權重模型在我們的伺服器上運行,不會拒絕合法的成人或爭議性話題。您可以發送單一提示或對話歷史記錄。API 接受標準 JSON 載荷,其中包含 messages 陣列。請確保您包含 model field set to uncensored.系統處理您的輸入並返回生成的文字。這種直接互動允許對生成過程進行精確控制。您可以使用簡單的 curl 命令來測試並驗證連線。回應將包含 token 使用統計數據以供透明參考。
cURL
curl https://api.pricingopenrouter.com/v1/chat/completions \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "uncensored",
"messages": [{"role": "user", "content": "Set the budget limit to five dollars for this week."}]
}'Python
from openai import OpenAI
client = OpenAI(base_url="https://api.pricingopenrouter.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.pricingopenrouter.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。這就是完整的設定。