필수 조건 및 인증
계정을 생성하고 API 키를 생성하는 것으로 시작하세요. 사용 Google로 계속하기 또는 이메일과 비밀번호를 제공하세요. API 키 받기 페이지. 키가 즉시 표시됩니다. 전화번호는 필요하지 않습니다. OPENAI_API_KEY 이 값으로 환경 변수를 설정합니다. 모든 요청에 이 base URL을 사용하십시오: https://api.uncensoredaiplatform.com/v1.
curl https://api.uncensoredaiplatform.com/v1/chat/completions \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "uncensored",
"messages": [{"role": "user", "content": "set max tokens to 2048 and temperature to 0.7"}]
}'
첫 번째 요청 보내기
POSTリクエストを送信 /v1/chat/completions 모델 ID uncensored본문에 messages 배열을 포함하세요. API는 텍스트 응답을 반환합니다. 이는 모든 OpenAI 호환 클라이언트와 함께 작동합니다. 구성에서 기본 URL과 API 키를 변경하세요. 이 간단한 구조를 사용하여 연결성을 테스트하세요.
from openai import OpenAI
client = OpenAI(base_url="https://api.uncensoredaiplatform.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.uncensoredaiplatform.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)