開發者的 API 文件
本指南協助您使用標準 OpenAI 相容客戶端執行 uncensored 模型的 API 金鑰。生成金鑰後,您即可立即發送請求。
驗證與 base URL 設定
首先使用正確的基础 URL 和金鑰配置您的客戶端。我們的 API 位於 HTTPS://api.llamaapikey.com/v1。此設定適用於官方 OpenAI SDK 及任何相容的客戶端。您只需更改基礎 URL 並提供金鑰即可。我們不使用模型路由或供應商鎖定。
- 基礎 URL:HTTPS://api.llamaapikey.com/v1
- 模型 ID:"uncensored"
- 驗證:標頭
Authorization: Bearer YOUR_API_KEY
curl https://api.llamaapikey.com/v1/chat/completions \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "uncensored",
"messages": [{"role": "user", "content": "Generate API key for llama model usage"}]
}'
發送請求至 /v1/chat/completions
發送標準 POST 請求至 chat completions 端點。模型 ID 為 "uncensored"。它高效處理文本輸入和輸出。您可以調整 temperature 或 top_p 等參數。錯誤不會消耗信用額度。標準內容的拒絕是免費的。
from openai import OpenAI
client = OpenAI(base_url="https://api.llamaapikey.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. 您將收到用於即時輸出的 Server-Sent Events (SSE)。最後一個區塊包含 token 使用詳情。此方法非常適合聊天介面。您可在等待完整回應之前獲得即時回饋。
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)
函式呼叫與工具使用
使用標準的工具格式進行函式呼叫。在 tools 陣列。該模型支援 tool_choice 用於強制或自動執行。您也可以強制使用 JSON 模式, response_format. 這可確保您的應用程式獲得結構化的輸出。
import OpenAI from "openai";
const client = new OpenAI({ baseURL: "https://api.llamaapikey.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);
JSON 模式與回應格式化
強制模型輸出有效的 JSON。設定 response_format 以 {"type": "json_object"}. 這可防止解析器中的格式錯誤的回應。它與函數呼叫配合使用。您為後端邏輯獲得可靠的資料結構。
curl https://api.llamaapikey.com/v1/chat/completions \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "uncensored",
"messages": [{"role": "user", "content": "Generate API key for llama model usage"}]
}'
了解 token 使用與計費
您為實際的 token 使用量付費。錯誤和拒絕請求免費。上下文視窗為 100,000 個 token。最大輸出為 16,000 個 token。速率限制為每分鐘 300 次請求。處理 401 表示無效金鑰。處理 402 表示無信用額度。處理 429 表示速率限制。
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)常見問題
您接受哪些付款方式?
僅限加密貨幣:TRC20 上的 USDT 或 Base 上的 USDC,任何整數金額從 $20 到 $500。從 $50 起享有額外餘額獎勵。
這是官方的 Llama 模型嗎?
不,我們運行自己的無審查模型。它不是 GPT、Claude 或 Llama。我們使用相同的 API 格式。請查看供應商's 的文件以獲取特定模型詳細資訊。
如果我觸及速率限制會發生什麼事?
您會收到 429 狀態碼。限制為每分鐘 300 次請求。您也可以擁有 8 個併發請求。等待幾秒後重試。
立即生成您的金鑰
註冊、複製金鑰、更新基礎網址。就是這樣。