API संदर्भ
OpenAI Chat Completions API गाइड
पूर्ण request URL, Bearer API Key, curl, Python और JavaScript उदाहरण के साथ BetterToken का OpenAI-compatible Chat Completions API उपयोग करें। उदाहरण सहित।
POST
cURL
OpenAI-compatible Chat Completions को
POST https://bettertoken.ai/v1/chat/completions से कॉल करें। अधिकतर external tools Base URL https://bettertoken.ai/v1 लेते हैं और /chat/completions स्वयं जोड़ते हैं।
मुख्य सेटिंग्स
आवश्यकताएं
- BetterToken API Key बनाएं
- model plaza या key Setup dialog से Model ID कॉपी करें
curlया Python 3 / Node.js वाला terminal तैयार रखें
इंस्टॉल करें
- curl
- Python
- JavaScript
curl के लिए SDK नहीं चाहिए। पुष्टि करें कि curl --version आपके terminal में चलता है।मैन्युअल सेटअप
curl
Python SDK
JavaScript SDK
कनेक्शन सत्यापित करें
दाईं ओर Playground में:- Authorization के अंतर्गत
YOUR_API_KEYभरें। modelकोYOUR_MODEL_IDसे बदलें।messagesसंपादित करें और अनुरोध भेजें।
https://bettertoken.ai/v1/chat/completions उपयोग करता है।
मॉडल output के साथ 200 response का choices[0].message.content में होना कनेक्शन की पुष्टि करता है।
मॉडल बदलें
YOUR_MODEL_ID को model plaza या Setup dialog की पूरी Model ID से बदलें। display name के आधार पर Model ID को छोटा न करें।
सामान्य त्रुटियां
उन्नत सेटअप
समर्थित provider
ये स्थितियां केवल इस पेज पर बताए गए BetterToken सेटअप पर लागू होती हैं।
सेटअप के तरीकों का अर्थ
सेटअप के तरीकों का अर्थ
- मैन्युअल सेटअप: API Key, Base URL और Model दर्ज करें।
- समर्थित नहीं: सीधे सेटअप का कोई सत्यापित तरीका अभी उपलब्ध नहीं है।
तकनीकी विवरण
Base URL और पूर्ण request URL
Base URL और पूर्ण request URL
पूरा request URL मांगने वाले tool, जैसे GitHub Copilot और TRAE,
https://bettertoken.ai/v1/chat/completions उपयोग करते हैं। path स्वयं जोड़ने वाले tool, जैसे Cursor, Cline, OpenCode, n8n और Dify, केवल https://bettertoken.ai/v1 उपयोग करते हैं।प्राधिकरण
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
बॉडी
application/json
A model ID currently available from a GPT provider. Check the model plaza for the latest options.
उदाहरण:
"YOUR_MODEL_ID"
Conversation messages. Each item should contain role and content.
Minimum array length:
1Whether to request a streaming response.
प्रतिक्रिया
The Chat Completions result from the selected model.

