# Grok Bot

Dùng kết quả Felo Data API trong Grok Bot. Agent vẫn giữ mô hình riêng.

Dùng kết quả Felo Data API trong Grok Bot. Agent vẫn giữ mô hình riêng.

## Chuẩn bị

Tạo API key và kiểm tra số dư. Ví dụ dùng Tavily Search; API khác có tham số và giá riêng.

- [API Keys](https://openapi.felo.ai/console/api-keys)
- [Data APIs](https://openapi.felo.ai/vi/apis)
- [Tavily](https://openapi.felo.ai/vi/apis/tavily)

## Cấu hình ứng dụng

**Grok Bot → cloud computer → terminal → Python tool → private Skill**

## Kết nối tìm kiếm

Lưu công cụ Python vào môi trường chạy của agent. Tự chạy configure ở đó rồi yêu cầu agent chạy search. Cần Python 3.9+ và mạng; key trên máy khác không tự chuyển sang.

[felo-data-search.py](https://openapi.felo.ai/docs-assets/integrations/felo-data-search.py)

```bash
python3 felo-data-search.py configure
python3 felo-data-search.py search "Felo API Platform documentation"
```

| Tool | Value |
| --- | --- |
| Name | `felo_data_search` |
| Command | `python3 /ABSOLUTE/PATH/felo-data-search.py search "QUERY"` |
| Output | `results[].title`, `results[].url`, `results[].content` |

## Yêu cầu Data API

| Field | Value |
| --- | --- |
| Method | `POST` |
| URL | `https://openapi.felo.ai/v1/beta/tavily/search` |
| Authorization | `Bearer YOUR_FELO_API_KEY` |
| OpenAPI credential | `X-API-Key: YOUR_FELO_API_KEY` |
| Content-Type | `application/json` |
| query | `Felo API Platform documentation` |
| max_results | `3` |
| Output | `results[].title`, `results[].url`, `results[].content` |

```json
{
  "query": "Felo API Platform documentation",
  "max_results": 3
}
```

```bash
export FELO_API_KEY='YOUR_FELO_API_KEY'
curl 'https://openapi.felo.ai/v1/beta/tavily/search' \
  -H "Authorization: Bearer $FELO_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
  "query": "Felo API Platform documentation",
  "max_results": 3
}'
```

## Kiểm tra

Kiểm tra title, url, content trong results; yêu cầu tóm tắt có URL nguồn và xem mức sử dụng Felo trên console. Mảng rỗng vẫn hợp lệ.

## Khắc phục lỗi

401: key và Authorization; 402: số dư; 400: JSON và query. Thử lại 429/5xx với thời gian chờ tăng dần. Giữ request_id. Kiểm tra quyền Workspace hoặc key trong môi trường chạy.

## Tài liệu Felo liên quan

- [Data API](https://openapi.felo.ai/vi/docs/guides/data-api.md)
- [API Reference](https://openapi.felo.ai/vi/docs/data-api)
- [Authentication](https://openapi.felo.ai/vi/docs/authentication.md)
- [Apps & Agents](https://openapi.felo.ai/vi/apps)

## Tài liệu chính thức của ứng dụng

- [Grok Bot](https://docs.x.ai/grok-bot/overview)
- [Grok Bot Tools](https://docs.x.ai/grok-bot/skills-routines-and-automations)
