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 }}
Sendet eine Anfrage für eine Modellantwort für die gegebene Chat-Konversation. Unterstützt sowohl Streaming- als auch Nicht-Streaming-Modi. Kompatibel mit dem OpenAI Chat Completions API-Format.
Sampling-Temperatur zwischen 0 und 2. Höhere Werte wie 0.8 machen die Ausgabe zufälliger, niedrigere Werte wie 0.2 machen sie fokussierter und deterministischer.
Nucleus-Sampling-Parameter (0-1). Eine Alternative zum Temperatur-Sampling, bei der das Modell die Tokens mit der top_p-Wahrscheinlichkeitsmasse berücksichtigt.
Zahl zwischen -2.0 und 2.0. Positive Werte bestrafen neue Tokens basierend auf ihrer bestehenden Häufigkeit im bisherigen Text und verringern die Wahrscheinlichkeit, dass das Modell dieselbe Zeile wörtlich wiederholt.
Zahl zwischen -2.0 und 2.0. Positive Werte bestrafen neue Tokens basierend darauf, ob sie im bisherigen Text vorkommen, und erhöhen die Wahrscheinlichkeit, dass das Modell über neue Themen spricht.