시작하기 with the Uncensored API
몇 분 만에 비허용 API를 사용하세요. 이 빠른 시작 가이드는 인증, 첫 요청 보내기, 표준 OpenAI 호환 도구로 실시간 스트리밍 처리 방법을 안내합니다.
OpenAI SDK 설치
오픈 소스 SDK는 HTTP 세부 사항을 처리합니다. 프로젝트 환경에 공식 패키지를 설치하세요. 이 라이브러리는 재시도 및 JSON 파싱을 자동으로 관리합니다.
pip install openai
기본 URL 및 키 구성
클라이언트를 저희 특정 엔드포인트로 연결하세요. 베이스 URL은 프롬프트가 저희 uncensored 모델 클러스터에 도달하도록 보장합니다. 인증은 단순한 Bearer 토큰에 의존합니다.
- Base URL:
https://api.aimodelswithnorestrictions.com/v1 - Key: 생성된 API 키
from openai import OpenAI
client = OpenAI(base_url="https://api.aimodelswithnorestrictions.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)
기본 채팅 완료 보내기
표준 메시지 페이로드를 보내세요. 모델은 성인 또는 논쟁적인 주제에 대한 필터링 없이 원시 텍스트를 반환합니다. 오류와 거부는 선불 토큰을 소모하지 않습니다.
curl https://api.aimodelswithnorestrictions.com/v1/chat/completions \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "uncensored",
"messages": [{"role": "user", "content": "Summarize the current weather conditions in Tokyo"}]
}'
실시간 출력을 위한 스트리밍 활성화
생성되는 대로 토큰을 받습니다. 이는 긴 응답에 대한 지각 지연을 줄입니다. 스트림을 구문 분석하여 애플리케이션에서 텍스트를 단계별로 표시할 수 있습니다.
import OpenAI from "openai";
const client = new OpenAI({ baseURL: "https://api.aimodelswithnorestrictions.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);
파라미터 설정: Temperature 및 Top P
창의성과 무작위성을 제어하십시오. 낮은 값은 응답을 더 결정론적으로 만듭니다. 높은 값은 다양하고 다양한 어구를 장려합니다.
temperature: 무작위성을 조정합니다.top_p: 확률에 따라 어휘 필터링.
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"} 엄격한 JSON. 함수 호출을 통해 모델이 도구를 동적으로 실행할 수 있습니다.
curl https://api.aimodelswithnorestrictions.com/v1/chat/completions \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "uncensored",
"messages": [{"role": "user", "content": "Summarize the current weather conditions in Tokyo"}]
}'자주 묻는 질문
context window와 rate limit은 어떻게 되나요?
컨텍스트 윈도우는 총 100,000개의 토큰을 지원합니다. 키당 분당 요청 수는 300개로 제한됩니다. 각 키당 최대 8개의 동시 요청이 가능합니다.
402 오류가 발생하는 이유는 무엇인가요?
402 상태는 사전 결제된 크레딧이 소진되었음을 나타냅니다. 토큰은 오류나 거부 요청이 아닌 실제 사용량에 대해서만 차감됩니다. 계속하려면 암호화폐로 충전하세요.
공식적인 OpenAI 서비스입니까?
아니요. 당사는 OpenAI API 형식과 호환되는 무검열 LLM을 제공합니다. 이 모델은 GPT, Claude 또는 기타 벤더의 모델이 아닙니다. 별도의 오픈 가중치 모델입니다.
API 키 보안
등록하고, 키를 복사한 후 엔드포인트를 업데이트하세요. 설정은 여기까지입니다.