हम cookies इस्तेमाल करते हैं. Cookies और ब्राउज़र स्टोरेज आपको साइन इन रखते हैं और आपकी प्राथमिकताएं याद रखते हैं। आपकी अनुमति से हम यह भी मापते हैं कि साइट कैसे इस्तेमाल होती है। आप कभी भी । हमारी cookie नीति देखें।

रीज़निंग

Endpoints

रीज़निंग

reasoning पैरामीटर से सोचने के प्रयास का स्तर नियंत्रित करें और रीज़निंग टोकन पढ़ें। समर्थित मॉडल और उपयोग के उदाहरण यहाँ मिलेंगे।

playground में आज़माएं

रीज़निंग मॉडल उत्तर देने से पहले सोचते हैं: OpenAI GPT-5 और o-सीरीज़, extended thinking वाले Claude, Gemini 2.5, DeepSeek R1, Qwen और अन्य। api14 एक ही reasoning पैरामीटर स्वीकार करता है और उसे हर प्रदाता की अपनी सेटिंग में बदल देता है। रीज़निंग टोकन को आउटपुट टोकन की तरह बिल किया जाता है।

अनुरोध पैरामीटर

पैरामीटरप्रकारविवरण
reasoning.effortstring"minimal", "low", "medium" या "high"। OpenAI और Grok मॉडल इसका उपयोग करते हैं, और बाकी मॉडलों के लिए यह टोकन बजट में बदल जाता है।
reasoning.max_tokensintegerसोच के लिए सटीक टोकन बजट। Anthropic, Gemini और Qwen इसका उपयोग करते हैं। इनमें से केवल एक का उपयोग करें, दोनों का नहीं।
reasoning.excludebooleanमॉडल फिर भी सोचता है, लेकिन सोच का पाठ उत्तर में शामिल नहीं होता।
reasoning.enabledbooleanडिफ़ॉल्ट सेटिंग्स के साथ रीज़निंग चालू करता है।
include_reasoningbooleanपुराना स्विच। यह reasoning: {} या reasoning.exclude: false के समान है।
{
  "model": "anthropic/claude-sonnet-4.5",
  "messages": [{ "role": "user", "content": "How many r's are in 'strawberry'? Think carefully." }],
  "reasoning": { "max_tokens": 2000 },
  "max_tokens": 4000
}

max_tokens, रीज़निंग बजट से बड़ा होना चाहिए, क्योंकि इसमें सोच और उत्तर दोनों शामिल हैं।

import OpenAI from "openai";

const client = new OpenAI({
  baseURL: "https://api14.com/api/v1",
  apiKey: process.env.API14_API_KEY,
});

const result = await client.chat.completions.create({
  "model": "openai/gpt-5-mini",
  "messages": [
    {
      "role": "user",
      "content": "Explain vector databases in two sentences."
    }
  ],
  "reasoning": {
    "effort": "high"
  }
});
console.log(result.choices[0].message.content);

प्रतिक्रिया

सोच का पाठ message.reasoning में लौटता है, उत्तर से अलग। कुछ मॉडल संरचित reasoning_details भी लौटाते हैं:

{
  "id": "gen-1760000000-think",
  "model": "anthropic/claude-sonnet-4.5",
  "choices": [
    {
      "index": 0,
      "finish_reason": "stop",
      "message": {
        "role": "assistant",
        "content": "There are 3 r's in \"strawberry\".",
        "reasoning": "s-t-r-a-w-b-e-r-r-y: r at position 3, 8 and 9..."
      }
    }
  ],
  "usage": {
    "prompt_tokens": 22,
    "completion_tokens": 312,
    "total_tokens": 334,
    "completion_tokens_details": { "reasoning_tokens": 290 },
    "cost": 0.004746
  }
}

स्ट्रीमिंग में, रीज़निंग delta.content चंक से पहले delta.reasoning चंक में आती है।

नोट्स

  • OpenAI की o-सीरीज़ और GPT-5 मॉडल अपना सोच का पाठ नहीं लौटाते, फिर भी reasoning_tokens का शुल्क लगता है।
  • Claude के साथ कई चरणों में टूल उपयोग करते समय, reasoning_details को असिस्टेंट संदेश में बिना बदले वापस भेजें, ताकि मॉडल अपनी सोच जारी रख सके।
  • कुछ मॉडल (जैसे deepseek/deepseek-r1) हमेशा सोचते हैं। इनके लिए effort लागू नहीं होता।
  • अधिक प्रयास की लागत अधिक होती है और समय भी ज़्यादा लगता है। completion_tokens_details.reasoning_tokens पर नज़र रखें।

त्रुटियाँ

वही जो Chat completions में हैं। किसी मॉडल के लिए बहुत छोटा या बहुत बड़ा बजट, प्रदाता की ओर से 400 लौटा सकता है। देखें त्रुटियाँ।