मुख्य सामग्री पर जाएं
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?"
      }
    ]
  }'
{
  "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 प्रारूप का उपयोग करके स्ट्रीमिंग या नॉन-स्ट्रीमिंग प्रतिक्रिया बनाता है।

प्रमाणीकरण

Authorization
string
आवश्यक
Bearer टोकन। Authorization हेडर में अपनी API कुंजी को bearer टोकन के रूप में उपयोग करें।प्रारूप: Bearer <SUNRA_KEY>

अनुरोध

यह एंडपॉइंट एक ऑब्जेक्ट स्वीकार करता है।
model
string
आवश्यक
प्रतिक्रिया उत्पन्न करने के लिए उपयोग किया जाने वाला मॉडल ID। उपलब्ध मॉडल sunra.ai/models पर देखें।
input
string | object[]
प्रतिक्रिया अनुरोध के लिए इनपुट। एक स्ट्रिंग या इनपुट आइटम की एक सरणी हो सकती है।
instructions
string | null
मॉडल के संदर्भ में पहले आइटम के रूप में एक सिस्टम (या डेवलपर) संदेश सम्मिलित करता है। input के साथ उपयोग करने पर, निर्देश इनपुट की शुरुआत में डाले जाते हैं।
stream
boolean
डिफ़ॉल्ट:false
यदि true पर सेट किया जाता है, तो प्रतिक्रिया server-sent events (SSE) का उपयोग करके स्ट्रीम की जाएगी।
max_output_tokens
integer
आउटपुट टोकन की संख्या के लिए एक ऊपरी सीमा, जिसमें दृश्य आउटपुट टोकन और तर्क टोकन शामिल हैं।
temperature
number
डिफ़ॉल्ट:1
0 और 2 के बीच सैंपलिंग तापमान। उच्च मान यादृच्छिकता बढ़ाते हैं।
top_p
number
डिफ़ॉल्ट:1
न्यूक्लियस सैंपलिंग पैरामीटर। तापमान के साथ सैंपलिंग का एक विकल्प।
frequency_penalty
number
डिफ़ॉल्ट:0
-2.0 और 2.0 के बीच की संख्या। सकारात्मक मान नए टोकन को पाठ में उनकी मौजूदा आवृत्ति के आधार पर दंडित करते हैं।
presence_penalty
number
डिफ़ॉल्ट:0
-2.0 और 2.0 के बीच की संख्या। सकारात्मक मान नए टोकन को इस आधार पर दंडित करते हैं कि वे पहले से पाठ में दिखाई दिए हैं या नहीं।
tools
object[]
उन टूल की सरणी जिन्हें मॉडल कॉल कर सकता है।
tool_choice
string | object
टूल चयन व्यवहार को नियंत्रित करता है। समर्थित स्ट्रिंग मान: none, auto, required। एक विशेष फ़ंक्शन भी निर्दिष्ट कर सकते हैं।
parallel_tool_calls
boolean
डिफ़ॉल्ट:true
मॉडल को समानांतर में टूल कॉल चलाने की अनुमति देनी है या नहीं।
text
object
टेक्स्ट प्रतिक्रिया प्रारूप के लिए कॉन्फ़िगरेशन।
reasoning
object
तर्क आउटपुट के लिए कॉन्फ़िगरेशन।
store
boolean
डिफ़ॉल्ट:true
बाद में पुनर्प्राप्ति के लिए उत्पन्न प्रतिक्रिया को संग्रहीत करना है या नहीं।
metadata
object
16 कुंजी-मान जोड़े का सेट जो प्रतिक्रिया से जोड़ा जा सकता है। कुंजियां अधिकतम 64 वर्णों वाली स्ट्रिंग हैं। मान अधिकतम 512 वर्णों वाली स्ट्रिंग हैं।
user
string
आपके अंतिम-उपयोगकर्ता का प्रतिनिधित्व करने वाला एक अद्वितीय पहचानकर्ता। अधिकतम 128 वर्ण।

प्रतिक्रिया

सफल प्रतिक्रिया ऑब्जेक्ट।
id
string
अद्वितीय प्रतिक्रिया पहचानकर्ता।
object
string
ऑब्जेक्ट प्रकार। हमेशा response
created_at
number
प्रतिक्रिया बनाए जाने का Unix टाइमस्टैम्प (सेकंड में)।
status
string
प्रतिक्रिया की स्थिति। संभावित मान: completed, failed, in_progress, cancelled
model
string
प्रतिक्रिया उत्पन्न करने के लिए उपयोग किया गया मॉडल।
output
object[]
मॉडल द्वारा उत्पन्न सामग्री आइटम की सरणी।
usage
object
प्रतिक्रिया के लिए टोकन उपयोग आँकड़े।
temperature
number
उपयोग किया गया सैंपलिंग तापमान।
top_p
number
उपयोग किया गया न्यूक्लियस सैंपलिंग मान।
max_output_tokens
integer | null
उपयोग की गई अधिकतम आउटपुट टोकन सेटिंग।
error
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?"
      }
    ]
  }'
{
  "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
}