인증 및 Base URL
대시보드에서 키를 생성하세요.
모든 요청에 이 기본 URL을 사용하세요:
HTTPS://api.nsfwia.com/v1
Authorization 헤더에 키를 전달하세요. 엔드포인트는 표준 OpenAI 호환 클라이언트를 허용합니다.
첫 요청 보내기
텍스트 응답을 받기 위해 /v1/chat/completions으로 POST 요청을 보내세요.
텍스트 생성에 모델 ID "uncensored"를 사용하세요.
입력은 텍스트이며 출력도 텍스트입니다. 이미지나 비디오는 없습니다.
기본 curl 예제입니다:
curl https://api.nsfwia.com/v1/chat/completions \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "uncensored",
"messages": [{"role": "user", "content": "List the API endpoints and their HTTP methods"}]
}'
스트리밍 응답
stream을 true로 설정하여 스트리밍을 활성화합니다.
생성되는 대로 토큰을 받습니다.
실시간 출력을 위해 SSE를 사용하세요.
이것은 롤플레이에 이상적입니다.
스트리밍 코드 예시:
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 모드
구조화된 출력을 위해 함수 호출을 사용하세요.
엄격한 JSON을 위해 response_format을 json_object로 설정합니다.
요청 본문에 도구를 정의하세요.
신뢰할 수 있는 파싱을 보장합니다.
Python SDK 예제:
from openai import OpenAI
client = OpenAI(base_url="https://api.nsfwia.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)
파라미터: temperature, top_p 및 기타
창의성을 위해 온도를 조정합니다.
nucleus sampling을 위해 top_p를 설정하세요.
생성을 종료하기 위해 stop 시퀀스를 사용하세요.
시드는 재현성을 보장합니다.
Node SDK 예제:
import OpenAI from "openai";
const client = new OpenAI({ baseURL: "https://api.nsfwia.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);
토큰 비용 이해
요금제는 입력 토큰 100만 개당 $0.15, 출력 토큰 100만 개당 $0.50입니다.
에러는 무료입니다. 거부도 무료입니다.
컨텍스트 창은 총 100,000 토큰입니다.
요청당 최대 출력은 16,000 토큰입니다.
제한 사항: 분당 300회 요청, 8개 동시 요청.
오류에는 401(잘못된 키), 402(크레딧 없음), 429(속도 제한 초과)가 포함됩니다.