Configurazione autenticazione URL Base
Le tue richieste iniziano da https://api.grokified.cc/v1. Passa la tua chiave API nel Authorization header. Ricevi una chiave attiva per account, mostrata immediatamente dopo la registrazione con Google o email.
Prima richiesta
Invia una richiesta POST a /v1/chat/completions con il modello uncensored. Il sistema elabora il tuo input e restituisce testo grezzo senza filtri aziendali.
- Usa
temperatureper la creatività. - Imposta
max_tokensper controllare la lunghezza dell'output.
curl https://api.grokified.cc/v1/chat/completions \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "uncensored",
"messages": [{"role": "user", "content": "get the last modified date of index html"}]
}'
Integrazione SDK Python
Installa la libreria ufficiale di OpenAI. Imposta l'URL base sul nostro endpoint. Passa la tua chiave come valore della chiave API. Questo garantisce la compatibilità con il codice client esistente.
from openai import OpenAI
client = OpenAI(base_url="https://api.grokified.cc/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)
Configurazione SDK Node.js
Importa il pacchetto OpenAI. Inizializza il client con la tua chiave e l'URL di base. Chiama chat.completions.create con il tuo prompt. La risposta contiene il testo generato.
import OpenAI from "openai";
const client = new OpenAI({ baseURL: "https://api.grokified.cc/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);
Risposte in streaming e utilizzo dei token
Abilita lo streaming impostando stream: true. Ricevi Server-Sent Events (SSE). L'ultimo chunk include i dati sull'utilizzo dei token. Questo ti aiuta a tracciare i costi in tempo reale.
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)
Limiti di frequenza, errori e finestra di contesto
Ricevi 300 richieste al minuto e 8 richieste concorrenti. La finestra di contesto è di 100.000 token. Errori come 401 o 402 non consumano credito. Anche i rifiuti sono gratuiti.