Felo API PlatformFelo API Platform

गाइड

प्रोटोकॉल और SDK

OpenAI-compatible, Responses और Anthropic Messages प्रोटोकॉल इस्तेमाल करें, साथ में स्ट्रीमिंग, tool calls और माइग्रेशन।

Model API तीन wire protocols बोलती है। अपना existing SDK बनाए रखें और base URL, API key, तथा model ID बदलें।

एंडपॉइंट मैट्रिक्स

प्रोटोकॉलएंडपॉइंटसामान्य क्लाइंट
OpenAI Chat CompletionsPOST https://openapi.felo.ai/api/v1/chat/completionsOpenAI SDK, अधिकांश OpenAI-संगत टूल
OpenAI ResponsesPOST https://openapi.felo.ai/api/v1/responsesResponses API सुविधाओं के साथ OpenAI SDK
Anthropic MessagesPOST https://openapi.felo.ai/api/v1/messagesAnthropic SDK, Claude Code, Claude-नेटिव टूल

आधार URL

क्लाइंटआधार URLक्यों
OpenAI SDKhttps://openapi.felo.ai/api/v1SDK /chat/completions या /responses जोड़ता है
Anthropic SDKhttps://openapi.felo.ai/apiSDK /v1/messages जोड़ता है; /v1 स्वयं न जोड़ें

दोनों clients आपके Felo API key को SDK API key के रूप में उपयोग करते हैं।

import OpenAI from "openai";
import Anthropic from "@anthropic-ai/sdk";

const openai = new OpenAI({
  apiKey: process.env.FELO_API_KEY,
  baseURL: "https://openapi.felo.ai/api/v1",
});

const anthropic = new Anthropic({
  apiKey: process.env.FELO_API_KEY,
  baseURL: "https://openapi.felo.ai/api",
});

एक प्रोटोकॉल चुनें

  • Chat Completions का उपयोग तब करें जब आपका tool या SDK परिचित messages array और choices[0].message.content की अपेक्षा करता हो।
  • Responses का उपयोग तब करें जब आपको OpenAI का Responses object, input, instructions, या output_text चाहिए।
  • Messages का उपयोग तब करें जब आप Anthropic SDK या Claude-native tool उपयोग कर रहे हों।

यह मानने से पहले कि हर protocol काम करेगी, model जाँचें। Catalog supported_protocols, supported_parameters, और recommended_protocol प्रदान करती है। recommended_protocol client recommendation है, restriction नहीं; model कोई अन्य protocol भी स्वीकार कर सकती है।

स्ट्रीमिंग

Server-Sent Events प्राप्त करने के लिए stream: true सेट करें।

  • Chat Completions OpenAI-style chat chunks emit करती है।
  • Responses Responses SSE events emit करती है और completed response object के साथ समाप्त होती है।
  • Messages Anthropic message stream events emit करती है।

Event stream को incrementally पढ़ें और connection बंद करने से पहले terminal event handle करें। Dropped connection completed response के समान नहीं है।

टूल कॉल और संरचित आउटपुट

Protocol के native shape में tools पास करें। Support model के अनुसार बदलता है, इसलिए tool calls, JSON mode, या structured output पर निर्भर होने से पहले catalog में supported_parameters जाँचें। Model field स्वीकार कर सकती है और फिर भी unsupported option को ignore कर सकती है।

मॉडल फ़ाइलें अपलोड करें

Felo API Key और multipart/form-data body के साथ POST https://openapi.felo.ai/api/v1/files उपयोग करें। Accepted file types, purpose fields और returned identifiers target model और provider के file protocol पर निर्भर करते हैं; file input support सभी models में समान नहीं है।

POST https://openapi.felo.ai/api/v1/files
Authorization: Bearer YOUR_API_KEY
Content-Type: multipart/form-data; boundary=CLIENT_GENERATED_BOUNDARY

Body को SDK, FormData, या curl -F से बनाएँ, ताकि client matching multipart boundary generate कर सके। इन helpers का उपयोग करते समय file को JSON के रूप में न भेजें और Content-Type को manually override न करें। Successful upload के बाद, selected protocol के file reference format के अनुसार result का उपयोग करें।

Material को LiveDoc knowledge resource के रूप में store करने के लिए LiveDoc upload API का उपयोग करें। Model file uploads और LiveDoc resource uploads के अपने identifiers और follow-up workflows होते हैं।

चैनल रूटिंग

जब आपको किसी provider को pin करना हो, तो तीनों endpoints X-Felo-Channel स्वीकार करते हैं। Header rules और examples के लिए Why does the same model have different prices? देखें।

किसी आधिकारिक API से माइग्रेट करें

  1. Base URL को matching Felo URL में बदलें।
  2. API key को FELO_API_KEY से बदलें।
  3. Model name को public Felo model ID से बदलें।
  4. बाकी request shape वैसी ही रखें।
लक्षणसंभावित कारण
हर अनुरोध पर 404आधार URL में पहले से /v1 शामिल है, या Anthropic आधार URL में /v1 मैन्युअल रूप से जोड़ा गया है
401Felo कुंजी गायब है या क्लाइंट अभी भी पुरानी कुंजी भेज रहा है
400 model त्रुटिमॉडल ID सार्वजनिक नहीं है या चुने गए एंडपॉइंट का समर्थन नहीं करता
Messages अनुरोध अस्वीकृतMessages प्रोटोकॉल द्वारा max_tokens आवश्यक है
टूल कॉल अनदेखा किया गयामॉडल उस क्षमता की घोषणा नहीं करता

संबंधित

मदद चाहिए?