# Brave AI Mode API

> Get the AI-generated answer Brave Search shows for a query, with answer text, cited sources and location and language options.

Source: https://www.sandbase.ai/apis/brave/ai-mode
API reference: https://www.sandbase.ai/apis/brave/ai-mode#api

## Facts

- Provider: Brave
- Type: Data API
- Endpoint: `POST https://api.sandbase.ai/v1/api/brave/ai-mode`
- Price: $0.01 per call
- Capabilities: api, brave, ai search, web search
- Billing: pay per use from one SandBase balance; no provider account or subscription needed

## Call it

`POST https://api.sandbase.ai/v1/api/brave/ai-mode` with `Authorization: Bearer $SANDBASE_API_KEY` and the parameters as a JSON body.

| Parameter | Type | Required | Allowed values |
| --- | --- | --- | --- |
| `q` | string | yes |  |
| `location` | string | no |  |
| `lat` | string | no |  |
| `lon` | string | no |  |
| `country` | string | no |  |
| `language` | string | no |  |
| `safeSearch` | string | no |  |
| `units_of_measurement` | string | no |  |
| `subsequent_request_token` | string | no |  |
| `json_restrictor` | string | no |  |

## FAQ

### How do I use the Brave AI Mode API?

Send a POST request to https://api.sandbase.ai/v1/api/brave/ai-mode with your SandBase API key in the Authorization header (Bearer) and the parameters as a JSON body. You can also try it in the Playground on this page without writing code.

### How much does the Brave AI Mode API cost?

$0.01 per call, billed from your SandBase balance. You are only charged for calls you make; there is no subscription.

### What parameters does the Brave AI Mode API accept?

Required: q (string). Optional: location (string), lat (string), lon (string), country (string), language (string) and safeSearch (string) and 3 more. The Parameters table and the Playground on this page list every field.

### What does the Brave AI Mode API return?

A JSON response returned in the same HTTP request (synchronous).

### Do I need a Brave developer account or API key?

No. Brave AI Mode runs through SandBase, so one SandBase API key covers this endpoint and every other API and model in the catalog. You do not need to apply for Brave API access separately.

## README

### Brave AI Mode

Get the AI-generated answer Brave Search shows for a query, with answer text, cited sources and location and language options.

#### Request

```bash
curl -X POST "https://api.sandbase.ai/v1/api/brave/ai-mode" \
  -H "Authorization: Bearer $SANDBASE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"q": "How does a heat pump work?"}'
```

The result is returned in `outputs[0].data` as structured JSON.

#### Parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `q` | string | Yes | Parameter defines the query you want to search. |
| `location` | string | No | Parameter defines from where you want the search to originate. If several locations match the location requested, we'll pick the most popular one. Head to the /locations.json API if you need more precise control. It is recommended to specif |
| `lat` | string | No | Parameter defines a GPS latitude for the search origin. Parameter is required when using `lon` parameter. Parameter can't be used with `location` parameter. |
| `lon` | string | No | Parameter defines a GPS longitude for the search origin. Parameter is required when using `lat` parameter. Parameter can't be used with `location` parameter. |
| `country` | string | No | Parameter defines the country to use for the Brave AI search. It's a two-letter country code. (e.g., `us` for the United States, `uk` for United Kingdom, or `fr` for France). Head to the Brave countries page for a full list of supported Bra |
| `language` | string | No | Parameter defines the language to use for the Brave AI search. It's a two-letter language code. (e.g., `en` for English, `es` for Spanish, or `fr` for French). Head to the Brave languages page for a full list of supported Brave AI Mode lang |
| `safeSearch` | string | No | Parameter defines the level of filtering for adult content. It can be set to: `off` - Off `moderate` - Moderate `strict` - Strict |
| `units_of_measurement` | string | No | Parameter defines the units of measurement to use. It can be set to: `metric` - Metric `us` - Imperial (US) |
| `subsequent_request_token` | string | No | Parameter defines the token used to continue a Brave AI Mode conversation. Pass this token to send a follow-up question that includes the prior exchange as context (multi-turn). The token is returned by the API from your previous request us |
| `json_restrictor` | string | No | Parameter defines the fields you want to include in the output, reducing payload size for faster response. See the JSON Restrictor documentation for more details. |

#### Pricing

$0.010 per successful call. Failed calls are not charged.
