रीज़निंग

रीज़निंग

रीज़निंग मॉडल उत्तर देने से पहले सोचते हैं। reasoning_effort पोर्टेबल नियंत्रण है: गेटवे इसे मॉडल के अपने डायल में अनुवादित करता है — एक स्तर, एक चालू/बंद स्विच या एक थिंकिंग-टोकन बजट — और नीचे दी गई तालिका में अन्य वर्तनी उसी तरह अनुवादित की जाती हैं, ताकि आप वह भेज सकें जिसे आपकी क्लाइंट लाइब्रेरी पहले से उपयोग करती है।

पैरामीटरटाइपआवश्यकविवरण
reasoning_effortstringवैकल्पिकमॉडल को कितना सोचना चाहिए। none उन मॉडलों पर सोचना बंद कर देता है जो सोचना बंद कर सकते हैं। इनमें से एक:noneminimallowmediumhighxhighmax उस लेवल पर मैप किया गया है जिसका इस्तेमाल मॉडल इसके लिए करता है जहाँ मॉडल के लेवल ज्ञात हैं (कभी-कभार मांगे गए शब्द से ज़्यादा लेवल पर, या बंद; जब यह अलग होता है, तो dropped_params इस्तेमाल किए गए लेवल का नाम बताता है); अन्यथा जैसे भेजा गया था वैसे ही पास कर दिया जाता है।
thinkingobjectवैकल्पिक{type: "enabled"|"adaptive"|"disabled", budget_tokens}। उन मॉडल द्वारा वैसे का वैसा ही लिया जाता है जिनकी अपनी API इसका उपयोग करती है, और अन्य सभी रीज़निंग मॉडल के लिए ट्रांसलेट किया जाता है: {type: "disabled"} या 0 का बजट थिंकिंग बंद कर देता है, और बजट एक एफर्ट लेवल बन जाता है जहाँ मॉडल लेवल लेता है।
reasoningobjectवैकल्पिक{effort, max_tokens, enabled, exclude}। जैसे ट्रांसलेट किया गया reasoning_effort: enabled: false, effort: "none" या max_tokens: 0 थिंकिंग बंद कर देता है। exclude: true पढ़ने योग्य रीज़निंग टेक्स्ट को रिस्पॉन्स से बाहर रखता है; साइन या एन्क्रिप्टेड रीज़निंग जिसे टूल लूप को वापस भेजना होगा, सुरक्षित रखी जाती है।
chat_template_kwargsobjectवैकल्पिक{enable_thinking: false} थिंकिंग बंद कर देता है, ठीक वैसे ही जैसे टॉप-लेवल enable_thinking: false और think: false करते हैं।
import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ["OXYY_API_KEY"],
    base_url="https://api.oxyy.ai/v1"
)

response = client.chat.completions.create(
    model="claude-opus-4-8",
    messages=[{"role": "user", "content": "Prove that sqrt(2) is irrational."}],
    reasoning_effort="high",  # none | minimal | low | medium | high | xhigh | max
)

msg = response.choices[0].message
print(msg.reasoning_content)   # the model's thinking, when it emits any
print(msg.content)
print(response.usage.completion_tokens_details.reasoning_tokens)
# A thinking budget works on any reasoning model; where the model takes
# effort levels instead, the budget is sent as the level the model uses for it.
curl https://api.oxyy.ai/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $OXYY_API_KEY" \
  -d '{
    "model": "claude-opus-4-8",
    "messages": [{"role": "user", "content": "Plan a migration."}],
    "max_tokens": 8000,
    "thinking": {"type": "enabled", "budget_tokens": 4000}
  }'
# Turn thinking off. Equivalent spellings are translated the same way:
#   "thinking": {"type": "disabled"}, "reasoning": {"enabled": false}, ...
# A model that always reasons answers at its lowest level instead, and
# provider_specific_fields.dropped_params on the response says so.
curl https://api.oxyy.ai/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $OXYY_API_KEY" \
  -d '{
    "model": "claude-opus-4-8",
    "messages": [{"role": "user", "content": "Summarise this in one line."}],
    "reasoning_effort": "none"
  }'
थिंकिंग बंद करना, और वे मॉडल जो ऐसा नहीं कर सकते। भेजें reasoning_effort: "none", or any off spelling above. Some models always reason: for them an off request is answered at the model's lowest effort level, or at its default when it has no levels. GET /v1/models/{id} बताता है कि कौन सा: इसका reasoning object रिपोर्ट करता है can_disable, always_on, the efforts जो उस मॉडल पर कुछ करते हैं, उसका default_effort और off_request जो थिंकिंग को बंद कर देता है। यह है null एक ऐसे model के लिए जो reasoning नहीं करता, और एक ऐसे model के लिए जिसके thinking controls अपने API के हैं (ऊपर बताए गए अनुसार अनुवादित)।
जो बदला है वह रिपोर्ट किया जाता है, छुपाया नहीं जाता। गेटवे आपके थिंकिंग नियंत्रणों में जो भी समायोजन करता है — मॉडल के निकटतम स्तर के रूप में भेजा गया स्तर, मॉडल द्वारा लिए जाने वाले स्विच द्वारा प्रतिस्थापित वर्तनी, दो वर्तनियाँ जो असहमत हैं, एक बंद अनुरोध जिसका मॉडल सम्मान नहीं कर सकता — वह इसके कारण के साथ सूचीबद्ध है provider_specific_fields.dropped_params response पर।
प्रतिक्रिया पर फ़ील्डयह क्या है
message.reasoning_contentजब model कोई भी चीज़ उत्सर्जित करता है, तो text के रूप में सोच
message.reasoning_detailsस्ट्रक्चर्ड रीज़निंग ब्लॉक। हस्ताक्षर और एन्क्रिप्टेड रीज़निंग को सुरक्षित रखने के लिए इन्हें टूल लूप में बिना बदले वापस भेजें।
usage.completion_tokens_details.reasoning_tokensथिंकिंग टोकन, जिनकी गिनती completion_tokens के भीतर की जाती है और आउटपुट रेट पर बिल किया जाता है
usage.completion_tokens_details.reasoning_tokens_source"estimate" जब मॉडल के प्रदाता ने कोई रीज़निंग काउंट नहीं बताया लेकिन रिस्पॉन्स में रीज़निंग टेक्स्ट मौजूद था: तब गेटवे द्वारा उस टेक्स्ट से reasoning_tokens की गिनती की गई। completion_tokens, total_tokens और शुल्क अपरिवर्तित हैं। जब गिनती प्रदाता की अपनी होती है, तब यह मौजूद नहीं होता।