curl -X POST https://api-llm.sunra.ai/v1/responses \
-H "Authorization: Bearer <SUNRA_KEY>" \
-H "Content-Type: application/json" \
-d '{
"model": "openai/gpt-4o",
"input": [
{
"type": "message",
"role": "user",
"content": "Hello, how are you?"
}
]
}'
import requests
response = requests.post(
"https://api-llm.sunra.ai/v1/responses",
headers={
"Authorization": "Bearer <SUNRA_KEY>",
"Content-Type": "application/json"
},
json={
"model": "openai/gpt-4o",
"input": [
{
"type": "message",
"role": "user",
"content": "Hello, how are you?"
}
]
}
)
print(response.json())
const response = await fetch("https://api-llm.sunra.ai/v1/responses", {
method: "POST",
headers: {
"Authorization": "Bearer <SUNRA_KEY>",
"Content-Type": "application/json"
},
body: JSON.stringify({
model: "openai/gpt-4o",
input: [
{
type: "message",
role: "user",
content: "Hello, how are you?"
}
]
})
});
const data = await response.json();
console.log(data);
{
"id": "resp-abc123",
"object": "response",
"created_at": 1704067200,
"status": "completed",
"model": "openai/gpt-4o",
"output": [
{
"type": "message",
"id": "msg_abc123",
"role": "assistant",
"status": "completed",
"content": [
{
"type": "output_text",
"text": "Hello! I'm doing well, thank you for asking. How can I help you today?",
"annotations": []
}
]
}
],
"temperature": 1.0,
"top_p": 1.0,
"max_output_tokens": null,
"usage": {
"input_tokens": 15,
"output_tokens": 18,
"total_tokens": 33,
"input_tokens_details": {
"cached_tokens": 0
},
"output_tokens_details": {
"reasoning_tokens": 0
}
},
"error": null
}
LLM
Create a response
POST
/
v1
/
responses
curl -X POST https://api-llm.sunra.ai/v1/responses \
-H "Authorization: Bearer <SUNRA_KEY>" \
-H "Content-Type: application/json" \
-d '{
"model": "openai/gpt-4o",
"input": [
{
"type": "message",
"role": "user",
"content": "Hello, how are you?"
}
]
}'
import requests
response = requests.post(
"https://api-llm.sunra.ai/v1/responses",
headers={
"Authorization": "Bearer <SUNRA_KEY>",
"Content-Type": "application/json"
},
json={
"model": "openai/gpt-4o",
"input": [
{
"type": "message",
"role": "user",
"content": "Hello, how are you?"
}
]
}
)
print(response.json())
const response = await fetch("https://api-llm.sunra.ai/v1/responses", {
method: "POST",
headers: {
"Authorization": "Bearer <SUNRA_KEY>",
"Content-Type": "application/json"
},
body: JSON.stringify({
model: "openai/gpt-4o",
input: [
{
type: "message",
role: "user",
content: "Hello, how are you?"
}
]
})
});
const data = await response.json();
console.log(data);
{
"id": "resp-abc123",
"object": "response",
"created_at": 1704067200,
"status": "completed",
"model": "openai/gpt-4o",
"output": [
{
"type": "message",
"id": "msg_abc123",
"role": "assistant",
"status": "completed",
"content": [
{
"type": "output_text",
"text": "Hello! I'm doing well, thank you for asking. How can I help you today?",
"annotations": []
}
]
}
],
"temperature": 1.0,
"top_p": 1.0,
"max_output_tokens": null,
"usage": {
"input_tokens": 15,
"output_tokens": 18,
"total_tokens": 33,
"input_tokens_details": {
"cached_tokens": 0
},
"output_tokens_details": {
"reasoning_tokens": 0
}
},
"error": null
}
OpenAI Responses API प्रारूप का उपयोग करके स्ट्रीमिंग या नॉन-स्ट्रीमिंग प्रतिक्रिया बनाता है।
प्रमाणीकरण
string
आवश्यक
Bearer टोकन। Authorization हेडर में अपनी API कुंजी को bearer टोकन के रूप में उपयोग करें।प्रारूप:
Bearer <SUNRA_KEY>अनुरोध
यह एंडपॉइंट एक ऑब्जेक्ट स्वीकार करता है।string
आवश्यक
प्रतिक्रिया उत्पन्न करने के लिए उपयोग किया जाने वाला मॉडल ID। उपलब्ध मॉडल sunra.ai/models पर देखें।
string | object[]
प्रतिक्रिया अनुरोध के लिए इनपुट। एक स्ट्रिंग या इनपुट आइटम की एक सरणी हो सकती है।
दिखाएं properties (when array)
दिखाएं properties (when array)
string
इनपुट आइटम का प्रकार। समर्थित मान:
message, item_reference।string
संदेश लेखक की भूमिका। समर्थित मान:
user, assistant, system।string | object[]
इनपुट संदेश की सामग्री। एक स्ट्रिंग या सामग्री भागों की सरणी हो सकती है।
string
आइटम का ID। वार्तालाप इतिहास में
assistant संदेशों के लिए आवश्यक।string
आइटम की स्थिति। वार्तालाप इतिहास में
assistant संदेशों के लिए आवश्यक।string | null
मॉडल के संदर्भ में पहले आइटम के रूप में एक सिस्टम (या डेवलपर) संदेश सम्मिलित करता है।
input के साथ उपयोग करने पर, निर्देश इनपुट की शुरुआत में डाले जाते हैं।boolean
डिफ़ॉल्ट:false
यदि
true पर सेट किया जाता है, तो प्रतिक्रिया server-sent events (SSE) का उपयोग करके स्ट्रीम की जाएगी।integer
आउटपुट टोकन की संख्या के लिए एक ऊपरी सीमा, जिसमें दृश्य आउटपुट टोकन और तर्क टोकन शामिल हैं।
number
डिफ़ॉल्ट:1
0 और 2 के बीच सैंपलिंग तापमान। उच्च मान यादृच्छिकता बढ़ाते हैं।
number
डिफ़ॉल्ट:1
न्यूक्लियस सैंपलिंग पैरामीटर। तापमान के साथ सैंपलिंग का एक विकल्प।
number
डिफ़ॉल्ट:0
-2.0 और 2.0 के बीच की संख्या। सकारात्मक मान नए टोकन को पाठ में उनकी मौजूदा आवृत्ति के आधार पर दंडित करते हैं।
number
डिफ़ॉल्ट:0
-2.0 और 2.0 के बीच की संख्या। सकारात्मक मान नए टोकन को इस आधार पर दंडित करते हैं कि वे पहले से पाठ में दिखाई दिए हैं या नहीं।
object[]
उन टूल की सरणी जिन्हें मॉडल कॉल कर सकता है।
string | object
टूल चयन व्यवहार को नियंत्रित करता है। समर्थित स्ट्रिंग मान:
none, auto, required। एक विशेष फ़ंक्शन भी निर्दिष्ट कर सकते हैं।boolean
डिफ़ॉल्ट:true
मॉडल को समानांतर में टूल कॉल चलाने की अनुमति देनी है या नहीं।
object
टेक्स्ट प्रतिक्रिया प्रारूप के लिए कॉन्फ़िगरेशन।
दिखाएं properties
दिखाएं properties
object
तर्क आउटपुट के लिए कॉन्फ़िगरेशन।
दिखाएं properties
दिखाएं properties
string
तर्क पर प्रयास को सीमित करता है। समर्थित मान:
low, medium, high।boolean
डिफ़ॉल्ट:true
बाद में पुनर्प्राप्ति के लिए उत्पन्न प्रतिक्रिया को संग्रहीत करना है या नहीं।
object
16 कुंजी-मान जोड़े का सेट जो प्रतिक्रिया से जोड़ा जा सकता है। कुंजियां अधिकतम 64 वर्णों वाली स्ट्रिंग हैं। मान अधिकतम 512 वर्णों वाली स्ट्रिंग हैं।
string
आपके अंतिम-उपयोगकर्ता का प्रतिनिधित्व करने वाला एक अद्वितीय पहचानकर्ता। अधिकतम 128 वर्ण।
प्रतिक्रिया
सफल प्रतिक्रिया ऑब्जेक्ट।string
अद्वितीय प्रतिक्रिया पहचानकर्ता।
string
ऑब्जेक्ट प्रकार। हमेशा
response।number
प्रतिक्रिया बनाए जाने का Unix टाइमस्टैम्प (सेकंड में)।
string
प्रतिक्रिया की स्थिति। संभावित मान:
completed, failed, in_progress, cancelled।string
प्रतिक्रिया उत्पन्न करने के लिए उपयोग किया गया मॉडल।
object[]
मॉडल द्वारा उत्पन्न सामग्री आइटम की सरणी।
दिखाएं properties
दिखाएं properties
string
आउटपुट आइटम का प्रकार। जैसे,
message।string
आउटपुट आइटम का अद्वितीय ID।
string
भूमिका। हमेशा
assistant।string
संदेश की स्थिति। जैसे,
completed।object
number
उपयोग किया गया सैंपलिंग तापमान।
number
उपयोग किया गया न्यूक्लियस सैंपलिंग मान।
integer | null
उपयोग की गई अधिकतम आउटपुट टोकन सेटिंग।
object | null
यदि जनरेशन विफल हुआ तो एक त्रुटि ऑब्जेक्ट।
curl -X POST https://api-llm.sunra.ai/v1/responses \
-H "Authorization: Bearer <SUNRA_KEY>" \
-H "Content-Type: application/json" \
-d '{
"model": "openai/gpt-4o",
"input": [
{
"type": "message",
"role": "user",
"content": "Hello, how are you?"
}
]
}'
import requests
response = requests.post(
"https://api-llm.sunra.ai/v1/responses",
headers={
"Authorization": "Bearer <SUNRA_KEY>",
"Content-Type": "application/json"
},
json={
"model": "openai/gpt-4o",
"input": [
{
"type": "message",
"role": "user",
"content": "Hello, how are you?"
}
]
}
)
print(response.json())
const response = await fetch("https://api-llm.sunra.ai/v1/responses", {
method: "POST",
headers: {
"Authorization": "Bearer <SUNRA_KEY>",
"Content-Type": "application/json"
},
body: JSON.stringify({
model: "openai/gpt-4o",
input: [
{
type: "message",
role: "user",
content: "Hello, how are you?"
}
]
})
});
const data = await response.json();
console.log(data);
{
"id": "resp-abc123",
"object": "response",
"created_at": 1704067200,
"status": "completed",
"model": "openai/gpt-4o",
"output": [
{
"type": "message",
"id": "msg_abc123",
"role": "assistant",
"status": "completed",
"content": [
{
"type": "output_text",
"text": "Hello! I'm doing well, thank you for asking. How can I help you today?",
"annotations": []
}
]
}
],
"temperature": 1.0,
"top_p": 1.0,
"max_output_tokens": null,
"usage": {
"input_tokens": 15,
"output_tokens": 18,
"total_tokens": 33,
"input_tokens_details": {
"cached_tokens": 0
},
"output_tokens_details": {
"reasoning_tokens": 0
}
},
"error": null
}
⌘I