ベースURLと認証
すべてのリクエストは、クライアントを https://api.nofilteraichatbot.com/v1 認証ヘッダーにAPIキーを含めてください。
Googleまたはメールの資格情報を使用してダッシュボード経由でキーを生成し、 Bearer YOUR_API_KEY 各呼び出しの認証に使用します。
最初のリクエスト
チャット完了エンドポイントに最初のプロンプトを送信して、接続性とモデルの動作を検証してください。
この例は uncensored モデルです。
curl https://api.nofilteraichatbot.com/v1/chat/completions \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "uncensored",
"messages": [{"role": "user", "content": "Get the temperature in Tokyo"}]
}'
Python統合
コアロジックを変更せずにAPIと対話するために、公式のOpenAI Pythonライブラリを使用します。
ベースURLを当社の uncensored 推論エンジンに向けてください。
from openai import OpenAI
client = OpenAI(base_url="https://api.nofilteraichatbot.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 の統合
JavaScript環境でSDKを初期化して、テキスト生成をシームレスに処理します。
デフォルトのベースURLを上書きし、トラフィックを当社の専用エンドポイントに送信してください。
import OpenAI from "openai";
const client = new OpenAI({ baseURL: "https://api.nofilteraichatbot.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をtrueに設定してストリーミングを有効にする stream: true リアルタイムで部分的な応答を受信します。
最終チャンクには、正確な請求追跡のためのトークン使用量の概要が含まれます。
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キーは1分あたり300リクエスト、同時に8リクエストの並列をサポートします。
コンテキストウィンドウは100,000トークンをサポートし、リクエストボディは8 MB未満である必要があります。