Felo API PlatformFelo API Platform

Felo APIs

Felo Search API

क्वेरी विश्लेषण, वेब संसाधनों और citations के साथ AI बातचीत खोज जोड़ें।

POST/v2/chat

प्रमाणीकरण

Bearer API key

कंटेंट टाइप

application/json

दर संबंधी नोट

Per API key and per user windows. Read X-RateLimit headers.

त्रुटियां, सीमाएं और पुनः प्रयास

यह पृष्ठ मौजूदा /v2 Felo APIs का दस्तावेज़ीकरण करता है, जो Felo account entitlements और Pro-credit rules का उपयोग करती हैं। Credits deduct होंगी या नहीं, यह operation पर निर्भर करता है। Platform-balance calls के लिए, समर्थित Felo OpenAPI endpoint चुनें; request और response shapes अलग हो सकती हैं।

Chat API आपको अपनी applications में AI-powered conversational search integrate करने की सुविधा देती है। एक natural language query भेजें और real-time web search results से generated एक intelligent answer प्राप्त करें।

AI एजेंटों के साथ उपयोग करें

जब आप चाहते हैं कि कोई Agent Search और हर अन्य उपलब्ध Felo Skill का उपयोग करे, तो पूरा felo-ai package install करें। Installer उन सभी package directories को dynamically discover करता है जिनमें SKILL.md हो, इसलिए यह fixed subset के बजाय future Skills को भी शामिल करता है। इन्हें अपने Agent की native directory में install करें: Codex ~/.codex/skills का उपयोग करता है, Claude Code ~/.claude/skills का, OpenClaw ~/.agents/skills का, और Hermes Agent ~/.hermes/skills का। प्रत्येक platform के लिए safe link, API key, और verification steps हेतु manual AI Agent setup guide देखें।

अवलोकन

Chat API निम्न operations करती है:

  1. आपकी query का analysis और optimization करती है
  2. संबंधित जानकारी के लिए web खोजती है
  3. Search results को rank और filter करती है
  4. Sources के आधार पर एक comprehensive AI answer generate करती है
  5. Answer को source citations के साथ लौटाती है

उपयोग के मामले:

  • Conversational AI assistants
  • Research और information retrieval tools
  • Web knowledge वाले customer support chatbots
  • Educational applications
  • Content creation tools

प्रमाणीकरण

Chat API के सभी requests के लिए API Key द्वारा authentication आवश्यक है। अपनी API Key को Authorization header में शामिल करें:

Authorization: Bearer YOUR_API_KEY

अपनी API Key प्राप्त करने और उपयोग करने के विवरण के लिए Authentication Guide देखें।

एंडपॉइंट

POST https://openapi.felo.ai/v2/chat

अनुरोध

हेडर

हेडरआवश्यकविवरण
Authorizationहाँआपकी API कुंजी इस प्रारूप में: Bearer YOUR_API_KEY
Content-Typeहाँapplication/json होना चाहिए

बॉडी पैरामीटर

पैरामीटरप्रकारआवश्यकविवरणबाधाएँ
querystringहाँउपयोगकर्ता का प्रश्न या खोज क्वेरी1-2000 वर्ण
accept_languagestringनहींपसंदीदा उत्तर भाषा, जैसे en, ja, zh-TWभाषा टैग, अधिकतम 64 वर्ण

जब आपकी application को किसी विशेष answer language की आवश्यकता हो, तब accept_language सेट करें। Service answer generator को भेजी जाने वाली query में एक explicit language instruction जोड़ती है। यदि इसे छोड़ा जाए, तो upstream service भाषा चुनती है। कोई fixed default answer language नहीं है। केवल English query होने से Chinese answer भी मिल सकती है। उदाहरण: {"query":"What is AI?","accept_language":"en"}। यह preference generated answer पर लागू होती है; source titles और excerpts अपनी original language बनाए रखते हैं।

उदाहरण अनुरोध

{
  "query": "What are the latest developments in quantum computing?"
}

प्रतिक्रिया

सफल प्रतिक्रिया (200 OK)

जब request सफल होती है, API निम्न structure के साथ JSON response लौटाती है:

{
  "status": 200,
  "code": "OK",
  "request_id": "req_example",
  "message": null,
  "data": {
    "id": "HabCj883yHLSXc8mWqu4Eq",
    "message_id": "18ea8517-5559-4f48-a355-1f8a79e73b71",
    "answer": "Recent developments in quantum computing include...",
    "query_analysis": {
      "queries": [
        "quantum computing latest developments 2025",
        "quantum computing breakthroughs"
      ]
    },
    "resources": [
      {
        "link": "https://example.com/quantum-news",
        "title": "Latest Quantum Computing Breakthroughs",
        "snippet": "Scientists have achieved a major milestone..."
      },
      {
        "link": "https://example.com/quantum-research",
        "title": "Quantum Computing Research 2025",
        "snippet": "New quantum algorithms show promise..."
      }
    ]
  }
}

प्रतिक्रिया फ़ील्ड

फ़ील्डप्रकारविवरण
statusintegerसंख्यात्मक HTTP-शैली स्थिति, सफलता के लिए 200
codestringसफलता के लिए OK; विफलता पर मशीन-पठनीय त्रुटि कोड
request_idstringसहायता और ट्रेसिंग के लिए अनुरोध पहचानकर्ता
messagestring | nullअतिरिक्त संदेश (सफल अनुरोधों के लिए null)
dataobjectसफल अनुरोधों के लिए प्रतिक्रिया डेटा
data.idstringइस चैट सत्र का अद्वितीय पहचानकर्ता
data.message_idstringइस विशिष्ट संदेश का अद्वितीय पहचानकर्ता
data.answerstringक्वेरी का AI-जनरेटेड उत्तर
data.query_analysisobjectउपयोगकर्ता की क्वेरी का विश्लेषण
data.query_analysis.queriesstring[]उपयोगकर्ता के इनपुट से प्राप्त अनुकूलित खोज क्वेरियाँ
data.resourcesarrayउत्तर जनरेट करने के लिए उपयोग किए गए वेब स्रोतों की सूची
data.resources[].linkstringस्रोत का URL
data.resources[].titlestringस्रोत पृष्ठ का शीर्षक
data.resources[].snippetstringस्रोत से प्रासंगिक अंश

त्रुटि प्रतिक्रिया

जब कोई error होती है, API error details के साथ JSON response लौटाती है:

{
  "status": 401,
  "code": "INVALID_API_KEY",
  "message": "The provided API Key is invalid or has been revoked",
  "request_id": "req_abc123xyz789"
}

त्रुटि प्रतिक्रिया फ़ील्ड

फ़ील्डप्रकारविवरण
statusintegerसंख्यात्मक त्रुटि स्थिति, जैसे अमान्य API Key के लिए 401
codestringत्रुटि का प्रकार पहचानने वाला त्रुटि कोड
messagestringमानव-पठनीय त्रुटि विवरण
request_idstringइस अनुरोध का अद्वितीय पहचानकर्ता (सहायता के लिए उपयोगी)

त्रुटि कोड

कोडHTTP स्थितिविवरणसमाधान
INVALID_API_KEY401API Key अमान्य, विकृत, या निरस्त हैसत्यापित करें कि आपकी API Key सही और सक्रिय है
MISSING_AUTHORIZATION401Authorization header गायब हैअपने अनुरोध में Authorization header शामिल करें
MALFORMED_AUTHORIZATION401Authorization header प्रारूप गलत हैप्रारूप का उपयोग करें: Authorization: Bearer YOUR_API_KEY
MISSING_PARAMETER400आवश्यक पैरामीटर गायब हैसुनिश्चित करें कि अनुरोध बॉडी में query पैरामीटर शामिल है
INVALID_PARAMETER400पैरामीटर मान अमान्य हैजाँचें कि query एक गैर-रिक्त स्ट्रिंग है (1-2000 वर्ण)
QUERY_TOO_LONG400क्वेरी अधिकतम लंबाई से अधिक हैअपनी क्वेरी को 2000 वर्ण या उससे कम करें
RATE_LIMITED429कम समय में बहुत अधिक अनुरोधअपने अनुरोध दर को धीमा करें या सहायता से संपर्क करें
CHAT_FAILED502आंतरिक सेवा त्रुटिअनुरोध पुनःप्रयास करें; समस्या बनी रहे तो सहायता से संपर्क करें
SERVICE_UNAVAILABLE503सेवा अस्थायी रूप से अनुपलब्ध हैप्रतीक्षा करें और पुनःप्रयास करें; अपडेट के लिए स्थिति पृष्ठ देखें

उदाहरण

cURL

curl -X POST https://openapi.felo.ai/v2/chat \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "query": "What are the benefits of renewable energy?"
  }'

Response:

{
  "status": 200,
  "code": "OK",
  "request_id": "req_example",
  "message": null,
  "data": {
    "id": "HabCj883yHLSXc8mWqu4Eq",
    "message_id": "18ea8517-5559-4f48-a355-1f8a79e73b71",
    "answer": "Renewable energy offers numerous benefits including reduced greenhouse gas emissions, decreased air pollution, energy independence, job creation, and long-term cost savings. Solar, wind, and hydroelectric power are sustainable alternatives to fossil fuels that help combat climate change while providing reliable electricity.",
    "query_analysis": {
      "queries": [
        "renewable energy benefits",
        "advantages of renewable energy sources"
      ]
    },
    "resources": [
      {
        "link": "https://example.com/renewable-benefits",
        "title": "Top Benefits of Renewable Energy",
        "snippet": "Renewable energy sources provide clean, sustainable power..."
      }
    ]
  }
}

Python

import requests
import os

# Get API key from environment variable
api_key = os.environ.get('FELO_API_KEY')

url = 'https://openapi.felo.ai/v2/chat'
headers = {
    'Authorization': f'Bearer {api_key}',
    'Content-Type': 'application/json'
}
data = {
    'query': 'What are the benefits of renewable energy?'
}

try:
    response = requests.post(url, headers=headers, json=data)
    response.raise_for_status()  # Raise exception for HTTP errors

    result = response.json()

    if result['status'] == 200 and result['code'] == 'OK':
        print('Answer:', result['data']['answer'])
        print('\nSources:')
        for resource in result['data']['resources']:
            print(f"- {resource['title']}: {resource['link']}")
    else:
        print(f"Error: {result['code']} - {result['message']}")

except requests.exceptions.RequestException as e:
    print(f'Request failed: {e}')

JavaScript (Node.js)

const fetch = require('node-fetch');

const apiKey = process.env.FELO_API_KEY;
const url = 'https://openapi.felo.ai/v2/chat';

const headers = {
  'Authorization': `Bearer ${apiKey}`,
  'Content-Type': 'application/json'
};

const body = JSON.stringify({
  query: 'What are the benefits of renewable energy?'
});

fetch(url, { method: 'POST', headers, body })
  .then(response => {
    if (!response.ok) {
      throw new Error(`HTTP error! status: ${response.status}`);
    }
    return response.json();
  })
  .then(data => {
    if (data.status === 200 && data.code === 'OK') {
      console.log('Answer:', data.data.answer);
      console.log('\nSources:');
      data.data.resources.forEach(resource => {
        console.log(`- ${resource.title}: ${resource.link}`);
      });
    } else {
      console.error(`Error: ${data.code} - ${data.message}`);
    }
  })
  .catch(error => {
    console.error('Request failed:', error);
  });

JavaScript (Browser/Fetch API)

const apiKey = 'YOUR_API_KEY'; // In production, get this from your backend

fetch('https://openapi.felo.ai/v2/chat', {
  method: 'POST',
  headers: {
    'Authorization': `Bearer ${apiKey}`,
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    query: 'What are the benefits of renewable energy?'
  })
})
  .then(response => {
    if (!response.ok) {
      throw new Error(`HTTP error! status: ${response.status}`);
    }
    return response.json();
  })
  .then(data => {
    if (data.status === 200 && data.code === 'OK') {
      console.log('Answer:', data.data.answer);

      // Display sources
      const sourcesList = data.data.resources.map(resource =>
        `<li><a href="${resource.link}">${resource.title}</a></li>`
      ).join('');

      document.getElementById('answer').innerHTML = data.data.answer;
      document.getElementById('sources').innerHTML = sourcesList;
    } else {
      console.error(`Error: ${data.code} - ${data.message}`);
    }
  })
  .catch(error => {
    console.error('Request failed:', error);
  });

Go

package main

import (
    "bytes"
    "encoding/json"
    "fmt"
    "io"
    "net/http"
    "os"
)

type ChatRequest struct {
    Query string `json:"query"`
}

type ChatResponse struct {
    Status  int `json:"status"`
    Message string `json:"message,omitempty"`
    Data    struct {
        ID            string `json:"id"`
        MessageID     string `json:"message_id"`
        Answer        string `json:"answer"`
        QueryAnalysis struct {
            Queries []string `json:"queries"`
        } `json:"query_analysis"`
        Resources []struct {
            Link    string `json:"link"`
            Title   string `json:"title"`
            Snippet string `json:"snippet"`
        } `json:"resources"`
    } `json:"data,omitempty"`
    Code      string `json:"code,omitempty"`
    RequestID string `json:"request_id,omitempty"`
}

func main() {
    apiKey := os.Getenv("FELO_API_KEY")
    url := "https://openapi.felo.ai/v2/chat"

    requestBody := ChatRequest{
        Query: "What are the benefits of renewable energy?",
    }

    jsonData, err := json.Marshal(requestBody)
    if err != nil {
        fmt.Printf("Error marshaling request: %v\n", err)
        return
    }

    req, err := http.NewRequest("POST", url, bytes.NewBuffer(jsonData))
    if err != nil {
        fmt.Printf("Error creating request: %v\n", err)
        return
    }

    req.Header.Set("Authorization", "Bearer "+apiKey)
    req.Header.Set("Content-Type", "application/json")

    client := &http.Client{}
    resp, err := client.Do(req)
    if err != nil {
        fmt.Printf("Error making request: %v\n", err)
        return
    }
    defer resp.Body.Close()

    body, err := io.ReadAll(resp.Body)
    if err != nil {
        fmt.Printf("Error reading response: %v\n", err)
        return
    }

    var chatResp ChatResponse
    err = json.Unmarshal(body, &chatResp)
    if err != nil {
        fmt.Printf("Error unmarshaling response: %v\n", err)
        return
    }

    if chatResp.Status == 200 && chatResp.Code == "OK" {
        fmt.Println("Answer:", chatResp.Data.Answer)
        fmt.Println("\nSources:")
        for _, resource := range chatResp.Data.Resources {
            fmt.Printf("- %s: %s\n", resource.Title, resource.Link)
        }
    } else {
        fmt.Printf("Error: %s - %s\n", chatResp.Code, chatResp.Message)
    }
}

दर-सीमांकन

जिन उपयोगकर्ताओं के पास effective paid Felo subscription (enterprise subscriptions सहित) है, वे API Key और OAuth authentication दोनों के लिए सभी /v2/chat rate limits से exempt हैं। Exempt responses में X-RateLimit-* headers शामिल नहीं होते।

जिन उपयोगकर्ताओं के पास paid subscription नहीं है, वे तीन dimensions पर rate limits के अधीन हैं। यदि subscription status verify नहीं किया जा सके, तब भी ये limits लागू होती हैं:

  • Per API Key — 1-minute window के भीतर एक single API Key से की गई requests को limit करता है।
  • Per User (minute) — 1-minute window के भीतर किसी user के स्वामित्व वाली सभी API Keys पर aggregate requests को limit करता है।
  • Per User (hour) — 1-hour window के भीतर किसी user के स्वामित्व वाली सभी API Keys पर aggregate requests को limit करता है।

किसी भी एक dimension के exceed होने पर 429 Too Many Requests response trigger होती है।

Exact numeric limits समय के साथ बदल सकती हैं। इन्हें हमेशा नीचे दिए गए response headers से पढ़ें, documentation snapshots से नहीं।

Response headers (वे responses जो rate limiting के अधीन हैं, 429 सहित):

हेडरअर्थ
X-RateLimit-Limitवर्तमान में प्रभावी सबसे कड़े आयाम की सीमा
X-RateLimit-Remainingतीन आयामों में न्यूनतम शेष कोटा
X-RateLimit-Resetवर्तमान विंडो के रीसेट होने का Unix timestamp (seconds)

429 पर, अतिरिक्त रूप से:

हेडरअर्थ
Retry-Afterअनुशंसित पुनःप्रयास विलंब (seconds)

Example 429 body (message request time पर current configured limits को दर्शाती है):

{
  "status": 429,
  "code": "RATE_LIMITED",
  "message": "Too many requests. Limit: <N>/min per API key, <M>/min per user, <H>/hour per user.",
  "request_id": "..."
}

Recommended client behavior:

  1. जहाँ मौजूद हो, success responses पर X-RateLimit-Remaining पढ़ें; 0 के पास आते ही proactively back off करें।
  2. 429 पर, retry करने से पहले कम से कम Retry-After seconds (या X-RateLimit-Reset तक) प्रतीक्षा करें।
  3. Limit values hardcode न करें — API contract बदले बिना इन्हें tune किया जा सकता है।

यदि आपको higher rate limits चाहिए, तो [email protected] से संपर्क करें।

श्रेष्ठ अभ्यास

1. त्रुटियों को शालीनता से संभालें

हमेशा response status जाँचें और errors को उचित रूप से handle करें:

if result['status'] == 200 and result['code'] == 'OK':
    # Process successful response
    answer = result['data']['answer']
else:
    # Handle error
    error_code = result['code']
    error_message = result['message']
    # Log error, show user-friendly message, etc.

2. पुनःप्रयास तर्क लागू करें

Transient errors (5xx status codes) के लिए exponential backoff लागू करें:

import time

max_retries = 3
retry_delay = 1  # seconds

for attempt in range(max_retries):
    response = requests.post(url, headers=headers, json=data)

    if response.status_code < 500:
        break  # Success or client error, don't retry

    if attempt < max_retries - 1:
        time.sleep(retry_delay * (2 ** attempt))  # Exponential backoff

3. प्रतिक्रियाएँ कैश करें

API calls कम करने और response times बेहतर करने के लिए identical queries के लिए responses cache करने पर विचार करें।

4. इनपुट सत्यापित करें

API को भेजने से पहले user input validate करें:

  • सुनिश्चित करें कि query empty न हो
  • Query length जाँचें (1-2000 characters)
  • Injection attacks रोकने के लिए input sanitize करें

5. उपयोग की निगरानी करें

Rate limits के भीतर रहने और costs optimize करने के लिए अपनी API usage track करें:

  • Request counts और response times log करें
  • Error rates monitor करें
  • Unusual patterns के लिए alerts सेट करें

सहायता

Chat API के लिए सहायता चाहिए?

परिवर्तन-सूची

v2.0.0 (वर्तमान)

  • Chat API का initial release
  • Natural language queries के लिए support
  • Real-time web search integration
  • Source citations के साथ AI-generated answers

मदद चाहिए?