การตั้งค่าการตรวจสอบสิทธิ์
เริ่มต้นด้วยการสร้างคีย์ของคุณบน รับ API key หน้าเว็บ คุณสามารถลงชื่อเข้าใช้ด้วย Google หรือใช้อีเมลและรหัสผ่าน ไม่ต้องใช้หมายเลขโทรศัพท์ คีย์ของคุณปรากฏทันที ใช้ใน Authorization header สำหรับการร้องขออนุญาตให้ใช้คีย์ที่ใช้งานอยู่ได้หนึ่งคีย์ต่อบัญชี คีย์ใหม่จะแทนที่คีย์เก่าทันที
POST /v1/chat/completions
ส่งคำขอข้อความไปยัง endpoint chat completions URL พื้นฐานคือ HTTPS://api.proxyclaudecode.com/v1 ใช้ ID โมเดล "uncensored" สำหรับการเข้าถึงโดยตรง endpoint นี้จัดการข้อความเข้าและออก ไม่รองรับ embeddings รูปภาพ หรือ fine-tuning คุณสามารถปรับพารามิเตอร์เช่น temperature และ top_p ข้อผิดพลาดและการปฏิเสธไม่ใช้เครดิต
cURL
curl https://api.proxyclaudecode.com/v1/chat/completions \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "uncensored",
"messages": [{"role": "user", "content": "Parse this CSV and return JSON"}]
}'Python
from openai import OpenAI
client = OpenAI(base_url="https://api.proxyclaudecode.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.proxyclaudecode.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)