Precondiții și autentificare
Începeți prin a crea un cont și generați cheia API. Utilizați Continuă cu Google sau furnizați un email și o parolă pe Obține cheie API pagina. Cheia apare imediat. Nu este necesar un număr de telefon. Setează-ți OPENAI_API_KEY variabilă de mediu cu această valoare. Utilizați acest URL de bază pentru toate cererile: 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"}]
}'
Trimiterea primei cereri
Trimite o cerere POST la /v1/chat/completions cu ID-ul modelului uncensored. Include your messages array in the body. The API returns a text response. This works with any OpenAI-compatible client. Change the base URL and API key in your configuration. Use this simple structure to test connectivity.
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);Streaming
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)