# खोज-आधारित चैट

platform balance का उपयोग करके वेब स्रोतों के साथ उत्तर तैयार करें।

एक प्रश्न भेजें और एक ही response में web sources के साथ generated answer प्राप्त करें।

सभी examples [overview](https://openapi.felo.ai/hi/docs/data-api/guides/felo-overview.md) से `FELO_API_KEY` का उपयोग करते हैं। Calls **platform balance** का उपयोग करती हैं, Felo Pro credits का नहीं। Response examples केवल illustrative हैं; live content और optional fields बदलते रहते हैं।

## एंडपॉइंट

`POST /api/v1/data/chat`

यह platform-balance endpoint है। `/v2/chat` पर [Felo Search API](https://openapi.felo.ai/hi/docs/api-reference/chat.md) Pro credits का उपयोग करती है और उसका response envelope अलग है।

## अनुरोध

| फ़ील्ड | प्रकार | आवश्यक | अर्थ |
| --- | --- | --- | --- |
| `query` | string | हाँ | प्रश्न, 1–2,000 वर्ण |
| `accept_language` | string | नहीं | पसंदीदा उत्तर भाषा, जैसे `en`, `ja`, या `zh-CN`; अधिकतम 64 वर्ण |
| `stream` | boolean | नहीं | `false` होना चाहिए; डिफ़ॉल्ट `false` |

ऐसा language tag उपयोग करें जिसमें 2–8 letters का language code और वैकल्पिक hyphen-separated subtags हों, जैसे `zh-TW`। Service इस preference को generation request में जोड़ती है। यदि यह छोड़ा जाए, तो upstream service भाषा चुनती है; कोई fixed default नहीं है, और English question English answer की गारंटी नहीं देता। यह preference generated answer पर लागू होती है; source titles और excerpts अपनी मूल भाषा बनाए रखते हैं।

यह endpoint non-streaming JSON लौटाता है। यह `stream: true`, SSE, `messages` array या model selection को support नहीं करता।

```bash
curl -sS --request POST "https://openapi.felo.ai/api/v1/data/chat" \
  -H "Authorization: Bearer $FELO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"query":"Explain retrieval augmented generation and cite sources.","accept_language":"en","stream":false}'
```

## प्रतिक्रिया

HTTP 200 `status: "ok"` और एक `data` object लौटाता है:

```json
{
  "status": "ok",
  "data": {
    "id": "example-chat-id",
    "message_id": "example-message-id",
    "answer": "Retrieval augmented generation adds retrieved context to a model request...",
    "resources": [
      {"title":"Example reference","link":"https://example.com/guide","snippet":"An overview of retrieval augmented generation."}
    ],
    "query_analysis": {"queries":["retrieval augmented generation"]}
  }
}
```

| फ़ील्ड | अर्थ |
| --- | --- |
| `data.answer` | जनरेट किया गया उत्तर |
| `data.resources` | शीर्षक, लिंक और अंश सहित स्रोत पृष्ठ |
| `data.query_analysis` | वैकल्पिक क्वेरी विश्लेषण; यह null हो सकता है |
| `data.id`, `data.message_id` | प्रतिक्रिया पहचानकर्ता |

पहले HTTP status जाँचें, फिर answer और sources पढ़ें। `/v2/chat` की तरह numeric `status: 200` की जाँच न करें।

## बिलिंग

`chat` का बिल प्रति request लगता है, model tokens के अनुसार नहीं। [current prices](https://openapi.felo.ai/api/v1/data/prices) और [Billing and Errors](https://openapi.felo.ai/hi/docs/data-api/guides/felo-billing.md) देखें।
