Chat Completions
/v1/chat/completions — OpenAI-compatible chat endpoint। model, messages, stream, temperature params। SSE streaming। curl, Python (openai) और Node में request और response के उदाहरण।
OpenAI-compatible chat endpoint। किसी भी OpenAI SDK के साथ काम करता है — बस base_url को https://getvibeapi.com/v1 में बदलें।
अनुरोध बॉडी पैरामीटर
GetVibe एक compatible Chat Completions contract लागू करता है, byte-for-byte passthrough नहीं: यह access जाँचता है, public model id resolve करता है, limits लागू करता है और supported request fields को normalize कर सकता है। Responses और errors भी normalize किए जाते हैं और upstream-specific fields या headers की गारंटी नहीं देते। अधिकांश कार्यों के लिए पहले तीन — model, messages और stream — पर्याप्त हैं।
| Parameter | Type | विवरण |
|---|---|---|
modelreq. | string | catalog से एक model नाम, उदाहरण के लिए gpt-6.1-sol या claude-opus-5.5। |
messagesreq. | array | messages का array { role, content }। Roles: system, user, assistant। |
stream | boolean | true — response को SSE पर stream करें। |
max_tokens | integer | response में अधिकतम tokens। हम कम से कम 64 की सलाह देते हैं: बहुत छोटा मान (उदाहरण के लिए ≤ 16) होने पर मॉडल पहले दिखने वाले token से पहले ही सीमा (finish_reason: length) तक पहुँच सकता है और खाली response लौटा सकता है। यदि आपको छोटा परिणाम चाहिए — तो prompt में उसके लिए कहें, और max_tokens को headroom के साथ रखें। |
temperature | number | आउटपुट की यादृच्छिकता, 0–2। डिफ़ॉल्ट 1। |
| Parameter | Type | विवरण |
|---|---|---|
top_p | numbermodel-dependent | Nucleus sampling (0–1)। temperature का विकल्प; दोनों को एक साथ बदलना अनुशंसित नहीं है। |
top_k | numberClaude | Top-K sampling। केवल Anthropic models। |
seed | integerGPT | परिणाम को reproducibility के लिए पिन करता है। GPT श्रृंखला; अन्यत्र अनदेखा किया जाता है। |
stop | string | arraymodel-dependent | Stop sequence: एक string या अधिकतम 4 strings की list। |
frequency_penalty | numberGPT · Claude | frequency के आधार पर repeating tokens के लिए penalty (-2 से 2). |
presence_penalty | numberGPT · Claude | पहले से देखे गए tokens के लिए penalty (-2 से 2). |
logprobs | boolean— | कोई भी वर्तमान रूट लॉग-प्रायिकताएँ नहीं लौटाता: प्रेषण से पहले पैरामीटर हटा दिया जाता है और इसकी सूचना x-getvibe-warnings हेडर (param_dropped:logprobs) में दी जाती है; अनुरोध अस्वीकार नहीं किया जाता। |
top_logprobs | integer— | logprobs के साथ हटा दिया जाता है और इसकी सूचना x-getvibe-warnings में दी जाती है। |
logit_bias | objectGPT | Token-ID → logit bias (-100 to 100)। |
user | stringmodel-dependent | End-user identifier (rate-limit tracking के लिए upstream भेजा जाता है)। |
response_format | objectGPT · Claude | output को JSON पर force करें। और जानें → |
tools / tool_choice | array / stringGPT · Claude | Function calling। और जानें → |
“Support” कॉलम में badges: GPT — केवल GPT श्रृंखला, Claude — केवल Anthropic models, GPT · Claude — दोनों families, model पर निर्भर — उस model के docs देखें।
Route variant के अनुसार parameter support
एक ही model अलग-अलग routes (variants :1, :2, …) द्वारा serve किया जा सकता है। Routes कीमत, गति और समर्थित parameters के सेट में भिन्न होते हैं।
| Parameter | Type | विवरण |
|---|---|---|
Default variant (:1) | basic | पूरा OpenAI parameter set: temperature, top_p, seed, stop, penalties, logprobs, tools, response_format, usage chunk के साथ streaming। |
Subscription variants (:2, :3…) | advanced | Parameter set बुनियादी वाले से match करता है, पर route अलग infrastructure इस्तेमाल करता है। कुछ individual parameters unsupported हो सकते हैं — ऐसा हम variant description में बताते हैं। |
or-* variants | or-* | request को एक अलग aggregator के ज़रिए proxy करता है। Parameter support विशिष्ट provider पर निर्भर करता है। tool_choice: "required" और कुछ sampling parameters काम नहीं कर सकते। |
:1 (default) variant का उपयोग करें या Models page पर variant description में support देखें।अनुरोध उदाहरण
curl https://getvibeapi.com/v1/chat/completions \
-H "Authorization: Bearer $GETVIBE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-6.1-sol",
"messages": [
{"role": "user", "content": "Hello! Who are you?"}
]
}'प्रतिक्रिया उदाहरण
{
"id": "chatcmpl-...",
"object": "chat.completion",
"model": "gpt-6.1-sol",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "Hi! I'm an assistant available through GetVibe API."
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 12,
"completion_tokens": 14,
"total_tokens": 26
}
}Streaming (SSE)
"stream": true के साथ response Server-Sent Events की stream के रूप में आता है: deltas वाले data: … events, जो data: [DONE] पर समाप्त होते हैं।
curl https://getvibeapi.com/v1/chat/completions \
-H "Authorization: Bearer $GETVIBE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-6.1-sol",
"stream": true,
"messages": [{"role": "user", "content": "Count to three"}]
}'usage के साथ अंतिम chunk
data: [DONE] से पहले वाले आख़िरी chunk में choices: [] खाली होता है और token stats के साथ usage field होता है। इसे billing के लिए इस्तेमाल करें — deltas को हाथ से जोड़ें नहीं।
data: {"id":"chatcmpl-...","choices":[],"usage":{"prompt_tokens":42,"completion_tokens":87,"total_tokens":129},"model":"gpt-6.1-sol","object":"chat.completion.chunk"}
data: [DONE]हर non-stream response, जिसकी cost estimate हो सकती है, में x-pv-cost-rub response header शामिल होता है। Streaming bodies में default रूप से कोई pv_cost_rub नहीं होता; उस protocol के final usage event में cost जोड़ने के लिए x-pv-cost: 1 भेजें। यह best-effort estimate है; actual debit के लिए request history GET /v1/generations देखें।
Compatibility
Endpoint OpenAI SDKs (Python, Node और अन्य), Codex CLI और Claude Code के साथ compatible है। Claude Code x-api-key header के साथ /v1/messages के ज़रिए काम करता है — देखें Messages and Responses।