Anthropic Message बनाएँ
client.messages.create(params)/v1/messagesSandBase के Anthropic-compatible Messages endpoint के ज़रिए message बनाएँ। SandBase चुने गए provider के लिए model को map करता है और compatible request व response fields को बनाए रखता है।
Request headers
SandBase API key। Authorization: Bearer भी स्वीकार है; दोनों मौजूद होने पर x-api-key को प्राथमिकता मिलती है।
upstream को भेजा जाने वाला Anthropic API version। न भेजने पर SandBase 2023-06-01 इस्तेमाल करता है।
डिफ़ॉल्ट: 2023-06-01T00:00:00.000Z
comma से अलग किए गए beta feature identifiers, provider compatibility के अधीन।
Request body
MessageCreateParamsAnthropic-compatible model identifier।
text या typed content blocks वाले user और assistant messages।
output tokens की अधिकतम संख्या।
Top-level system instruction।
0 से 1 तक sampling temperature।
डिफ़ॉल्ट: 1
Nucleus sampling threshold।
sampling को top K tokens तक सीमित करें।
generation रोकने वाले custom sequences।
Anthropic-style Server-Sent Events लौटाएँ।
डिफ़ॉल्ट: false
Request metadata, जिसमें वैकल्पिक user_id शामिल है।
model के लिए उपलब्ध tool definitions।
tool चुनने के व्यवहार को नियंत्रित करता है।
समर्थित models के लिए extended thinking configuration।
Authentication
x-api-key या Authorization: Bearer इस्तेमाल करें। दोनों दिए जाने पर x-api-key को प्राथमिकता मिलती है।
Transparent protocol
model mapping और configured provider compatibility rules को छोड़कर, SandBase compatible request fields, non-stream responses और SSE events को बिना protocol translation के आगे भेजता है।
Beta features
anthropic-beta मौजूद होने पर आगे भेजा जाता है। किसी candidate के compatibility rules असमर्थित beta fields हटा सकते हैं या उस candidate को छोड़ सकते हैं।
त्रुटियाँ
अमान्य request body या असमर्थित feature।
API key मौजूद नहीं है या अमान्य है।
संगठन की खर्च सीमा पूरी हो गई।
API Key की खर्च सीमा या संगठन permission विफलता।
Model नहीं मिला या उपलब्ध नहीं है।
provider ने request को बहुत बड़ा मानकर अस्वीकार कर दिया।
Provider की rate limit पार हो गई।
Prediction lifecycle या provider error।
उपयोगी content मिलने से पहले upstream stream समाप्त हो गया।
Routing विफल हुई या सभी provider candidates अनुपलब्ध थे।