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 }}
Verilen sohbet konuşması için bir model yanıtı isteği gönderir. Hem akış hem de akış dışı modları destekler. OpenAI Chat Completions API formatıyla uyumludur.
-2.0 ile 2.0 arasında bir sayı. Pozitif değerler, yeni tokenleri metindeki mevcut sıklıklarına göre cezalandırarak modelin aynı satırı kelimesi kelimesine tekrarlama olasılığını azaltır.
-2.0 ile 2.0 arasında bir sayı. Pozitif değerler, yeni tokenleri metinde daha önce görünüp görünmediklerine göre cezalandırarak modelin yeni konular hakkında konuşma olasılığını artırır.