> ## Documentation Index
> Fetch the complete documentation index at: https://docs.geekai.co/llms.txt
> Use this file to discover all available pages before exploring further.

# Chat with Web Search

### Models with native search

In the [model catalog](https://geekai.co/models), filter by `Web Search` to find models with native web search or an official built-in search tool.

Model names marked for web access, search, deep search, deep research, or deep reasoning indicate native search. Examples include the web-enabled GPT-5, GPT-4o, and GPT-4o mini variants, Grok 3 Deep Reasoning, Jina Deep Search, and DeepSeek with Metaso search. Search is already on for these models; you can skip the setup below:

* `gpt-5-search-api`
* `gpt-4o-search-preview`
* `gpt-4o-mini-search-preview`
* `o3-deep-research`
* `o4-mini-deep-research`
* `deepseek-search`
* `deepseek-r1-search`
* `deepseek-r1-metasearch`
* `gemini-2.5-flash-deepsearch`
* `gemini-2.5-pro-deepsearch`
* `qwen-deep-research`
* `grok-3-deepsearch`
* `sonar`
* `sonar-reasoning`
* `sonar-reasoning-pro`
* `sonar-deep-research`
* `jina-deepsearch-v1`

### Enable web search

Set `enable_search` to `true` in a Chat API request. GeekAI automatically uses the model's built-in search tool if it has one. Otherwise, it uses a third-party AI search engine to add web results to the context:

```bash curl theme={null}
curl --location --request POST 'https://geekai.co/api/v1/chat/completions' \
--header 'Authorization: Bearer $GEEKAI_API_KEY' \
--header 'Content-Type: application/json' \
--data-raw '{
    "model": "deepseek-flash",
    "messages": [
        {
            "role": "user",
            "content": "What is the weather like at West Lake in Hangzhou today?"
        }
    ],
    "enable_search": true
}'
```

```bash python theme={null}
# Install the networking library first: `pip3 install aiohttp asyncio`

import aiohttp
import asyncio
import json

async def invoke_geekai():
	headers = {
		"Authorization": "Bearer $GEEKAI_API_KEY",
		"Content-Type": "application/json"
	}

	body =     {
      "model": "deepseek-flash",
      "messages": [
        {
          "role": "user",
          "content": "What is the weather like at West Lake in Hangzhou today?"
        }
      ],
      "enable_search": True,
      "stream": True
    }

	async with aiohttp.ClientSession() as session:
		async with session.post(
			"https://geekai.co/v1/chat/completions",
			headers=headers,
			json=body
		) as response:
			async for line in response.content:
				line = line.decode("utf-8").strip()
				if line.startswith("data: "):
					data = line[6:]
					if data == "[DONE]":
						break
					try:
						chunk = data.strip()
						if chunk:
							print(chunk)
					except Exception as e:
						print(f"Error parsing chunk: {e}")

asyncio.run(invoke_geekai())
```

```bash javascript theme={null}
const response = await fetch("https://geekai.co/v1/chat/completions", {
    method: "POST",
    headers: {
        "Authorization": "Bearer $GEEKAI_API_KEY",
        "Content-Type": "application/json"
    },
    body: JSON.stringify({
        "model": "deepseek-flash",
        "messages": [
            {
                "role": "user",
                "content": "What is the weather like at West Lake in Hangzhou today?"
            }
        ],
        "stream": true,
        "enable_search": true
    })
});

const data = await response.json();
console.log(data);
```

```bash go theme={null}
package main

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

func main() {
	requestBody := map[string]interface{}{
		"model": "deepseek-flash",
		"messages": []interface{}{
            map[string]interface{}{
                "role": "user",
                "content": "What is the weather like at West Lake in Hangzhou today?",
            },
        },
        "enable_search": true,
        "stream": true,
	}

	jsonData, err := json.Marshal(requestBody)
	if err != nil {
		panic(err)
	}

	client := &http.Client{}
	req, err := http.NewRequest("POST", "https://geekai.co/api/v1/chat/completions", bytes.NewBuffer(jsonData))
	if err != nil {
		panic(err)
	}

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

	resp, err := client.Do(req)
	if err != nil {
		panic(err)
	}
	defer resp.Body.Close()

	body, err := io.ReadAll(resp.Body)
	if err != nil {
		panic(err)
	}

	fmt.Println(string(body))
}
```

Web search consumes additional tokens or incurs a per-search tool fee. Check `usage` in the response for usage. The [model catalog](https://geekai.co/models) lists prices for native search and third-party search engines. See your [billing history](https://geekai.co/user/transactions) for individual charges.

### Choose a search engine

For models without native search, GeekAI adds context using a third-party search engine. The default is Zhipu's free basic search, `glm-search-std`. To select another engine, set `engine` in `search_config`:

```bash curl theme={null}
curl --location --request POST 'https://geekai.co/api/v1/chat/completions' \
--header 'Authorization: Bearer $GEEKAI_API_KEY' \
--header 'Content-Type: application/json' \
--data-raw '{
    "model": "deepseek-flash",
    "messages": [
        {
            "role": "user",
            "content": "What is the weather like at West Lake in Hangzhou today?"
        }
    ],
    "enable_search": true,
    "search_config": {
        "engine": "glm-search-pro",
        "return_result": true
    },
    "stream": true
}'
```

Filter the model catalog by “Search Engine” to see which third-party AI search engines you can use:

![AI search engines available on GeekAI](https://static.geekai.co/storage/image-20261117113915358.png)

For details on `search_config`, see the [API reference](https://docs.geekai.co/en/api/chat/completions.md).

### Call the web search endpoint

For finer control over how searches are configured and run, use the standalone [web search endpoint](https://docs.geekai.co/en/api/web_search.md):

```bash curl theme={null}
curl --location --request POST 'https://geekai.co/api/v1/web_search' \
--header 'Authorization: Bearer $GEEKAI_API_KEY' \
--header 'Content-Type: application/json' \
--data-raw '{
    "model": "deepseek-search",
    "query": "What is the weather like at West Lake in Hangzhou today?",
    "count": 5
}'
```

Read the search results from the `results` response field:

```json theme={null}
{
    ...
    "results": [
        {
            "url": "http://qjwb.tidenews.com.cn/html/2026-11/17/content_4534876.htm?div=1",
            "title": "Qianjiang Evening News",
            "summary": "Hangzhou weather\n\nOvercast with light rain today, 13–16°C.",
            "icon": "https://cdn.deepseek.com/site-icons/tidenews.com.cn",
            "site_name": "Tide News",
            "rerank_score": 1.9337319135665896
        }
        ...
    ]
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.