curl -X POST https://api-llm.sunra.ai/v1/chat/completions \ -H "Authorization: Bearer <SUNRA_KEY>" \ -H "Content-Type: application/json" \ -d '{ "model": "openai/gpt-4o", "messages": [ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "What is the capital of France?" } ] }'
Copy
{ "id": "chatcmpl-abc123", "object": "chat.completion", "created": 1677652288, "model": "openai/gpt-4o", "choices": [ { "index": 0, "message": { "role": "assistant", "content": "The capital of France is Paris." }, "finish_reason": "stop" } ], "system_fingerprint": "fp_44709d6fcb", "usage": { "prompt_tokens": 25, "completion_tokens": 8, "total_tokens": 33 }}
Chat
Create a chat completion
POST
/
v1
/
chat
/
completions
Copy
curl -X POST https://api-llm.sunra.ai/v1/chat/completions \ -H "Authorization: Bearer <SUNRA_KEY>" \ -H "Content-Type: application/json" \ -d '{ "model": "openai/gpt-4o", "messages": [ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "What is the capital of France?" } ] }'
Copy
{ "id": "chatcmpl-abc123", "object": "chat.completion", "created": 1677652288, "model": "openai/gpt-4o", "choices": [ { "index": 0, "message": { "role": "assistant", "content": "The capital of France is Paris." }, "finish_reason": "stop" } ], "system_fingerprint": "fp_44709d6fcb", "usage": { "prompt_tokens": 25, "completion_tokens": 8, "total_tokens": 33 }}
Invia una richiesta per una risposta del modello per la conversazione chat specificata. Supporta sia la modalità streaming che non-streaming. Compatibile con il formato dell’API OpenAI Chat Completions.
Temperatura di campionamento tra 0 e 2. Valori più alti come 0.8 rendono l’output più casuale, valori più bassi come 0.2 lo rendono più focalizzato e deterministico.
Parametro di campionamento nucleus (0-1). Un’alternativa al campionamento per temperatura in cui il modello considera i token con massa di probabilità top_p.
Numero tra -2.0 e 2.0. I valori positivi penalizzano i nuovi token in base alla loro frequenza esistente nel testo finora, diminuendo la probabilità che il modello ripeta la stessa riga alla lettera.
Numero tra -2.0 e 2.0. I valori positivi penalizzano i nuovi token in base alla loro presenza nel testo finora, aumentando la probabilità che il modello parli di nuovi argomenti.