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

# AI Search

> Perform intelligent AI-powered searches

The AI Search service combines advanced language models with specialized search capabilities to provide intelligent search results.

<Note>
  The API reference for this endpoint is not yet available in OpenAPI format. Use the examples below to make requests.
</Note>

## Base URL

```bash theme={null}
https://api.gately.ai/v1
```

## Authentication

Authentication is handled through the standard Bearer token header. Get your API key from the [API Key Management Guide](/api-reference/endpoint/get-api).

## Request Format

<ParamField body="model" type="string" required default="taam-ai-search">
  Model identifier for AI search (must be set to `taam-ai-search`)
</ParamField>

<ParamField body="params" type="object" required>
  <Expandable title="Search Parameters">
    <ParamField body="query" type="string" required>
      The search query text
    </ParamField>

    <ParamField body="chatModel" type="object" required>
      <Expandable title="Chat Model Configuration">
        <ParamField body="provider" type="string" required default="openai">
          Model provider (typically `openai`)
        </ParamField>

        <ParamField body="model" type="string" required>
          Available models:

          * `gpt-3.5-turbo`
          * `gpt-4`
          * `gpt-4o`
          * `gpt-4o-mini`
        </ParamField>
      </Expandable>
    </ParamField>

    <ParamField body="embeddingModel" type="object" required>
      <Expandable title="Embedding Model Configuration">
        <ParamField body="provider" type="string" required default="openai">
          Provider name (typically `openai`)
        </ParamField>

        <ParamField body="model" type="string" required>
          Available models:

          * `text-embedding-3-large`
          * `text-embedding-3-small`
          * `text-embedding-ada-002`
          * `jina-embeddings-v3`
          * `jina-embeddings-v2-base-en`
          * `jina-embeddings-v2-base-zh`
          * `jina-embeddings-v2-base-code`
        </ParamField>
      </Expandable>
    </ParamField>

    <ParamField body="focusMode" type="string" required>
      Search mode:

      * `webSearch` - General web search
      * `academicSearch` - Academic and research content
      * `writingAssistant` - Writing and content generation
      * `wolframAlphaSearch` - Mathematical and scientific queries
      * `youtubeSearch` - YouTube content search
      * `redditSearch` - Reddit discussions and posts
    </ParamField>

    <ParamField body="optimizationMode" type="string" required>
      Optimization preference (`balanced`, `speed`)
    </ParamField>

    <ParamField body="history" type="array">
      Conversation history as array of \[role, content] pairs
    </ParamField>
  </Expandable>
</ParamField>

## Example Request

```bash theme={null}
curl --location 'https://api.gately.ai/v1/web' \
--header 'Authorization: Bearer YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
    "model": "taam-ai-search",
    "params": {
        "query": "What is Perplexica",
        "chatModel": {
            "provider": "openai",
            "model": "gpt-4o-mini"
        },
        "embeddingModel": {
            "provider": "openai",
            "model": "text-embedding-3-large"
        },
        "optimizationMode": "speed",
        "focusMode": "webSearch"
    }
}'
```

## Response Format

<ResponseField name="id" type="string">
  Unique identifier for the search request
</ResponseField>

<ResponseField name="object" type="string">
  Object type (e.g., "search.completion")
</ResponseField>

<ResponseField name="created" type="integer">
  Unix timestamp for when the request was created
</ResponseField>

<ResponseField name="model" type="string">
  Model used for the search
</ResponseField>

<ResponseField name="choices" type="array">
  <Expandable title="Choices">
    <ResponseField name="index" type="integer">
      Index in the choices array
    </ResponseField>

    <ResponseField name="message" type="object">
      <Expandable title="Message">
        <ResponseField name="role" type="string">
          Role of the message (e.g., "assistant")
        </ResponseField>

        <ResponseField name="content" type="string">
          The AI-generated response to the query
        </ResponseField>

        <ResponseField name="sources" type="array">
          <Expandable title="Source Information">
            <ResponseField name="pageContent" type="string">
              Content from the source
            </ResponseField>

            <ResponseField name="metadata" type="object">
              <Expandable title="Metadata Fields">
                <ResponseField name="title" type="string">
                  Source title
                </ResponseField>

                <ResponseField name="url" type="string">
                  Source URL
                </ResponseField>
              </Expandable>
            </ResponseField>
          </Expandable>
        </ResponseField>

        <ResponseField name="videos" type="array">
          Video sources related to the query
        </ResponseField>

        <ResponseField name="images" type="array">
          Image sources related to the query
        </ResponseField>

        <ResponseField name="suggestions" type="array">
          Suggested follow-up queries
        </ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="finish_reason" type="string">
      Reason why the generation finished
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="usage" type="object">
  <Expandable title="Usage Information">
    <ResponseField name="prompt_tokens" type="integer">
      Number of tokens in the prompt
    </ResponseField>

    <ResponseField name="completion_tokens" type="integer">
      Number of tokens in the completion
    </ResponseField>

    <ResponseField name="total_tokens" type="integer">
      Total number of tokens used
    </ResponseField>
  </Expandable>
</ResponseField>

## Example Response

```json theme={null}
{
    "id": "search-f0e3e9a4f72a42a29c428e36d9a53717",
    "object": "search.completion",
    "created": 1741151462,
    "model": "taam-ai-search",
    "choices": [
        {
            "index": 0,
            "message": {
                "role": "assistant",
                "content": "Gately AI is an innovative AI API platform designed to facilitate ....",
                "sources": [
                    {
                        "pageContent": "Taam API . seamless integration of AI-driven models . Taam Hub . All-In-One WordPress Management . Email Marketing . Email campaigns to promote products . PRODUCTS. Taamly socail Poster . create, schedule, publish to social media . AI Image Genrator ...",
                        "metadata": {
                            "title": "AI API Playground for Developers | Taam.cloud",
                            "url": "https://taam.cloud/"
                        }
                    },

                    {
                        "pageContent": "Meaning app team one, they might be all in on Amazon. App team two, they're picking and choosing. App team three, they're building something themselves. So it's this chaotic approach where each team is picking their own tooling, approaching it their own way, building their own pipelines, building their own process for how they're adopting cloud.",
                        "metadata": {
                            "title": "What is a platform team and what problems do they solve? - HashiCorp",
                            "url": "https://www.hashicorp.com/resources/what-is-a-platform-team-and-why-do-we-need-them"
                        }
                    }
                ],
                "videos": [
                    {
                        "url": "https://www.youtube.com/watch?v=iojibP9pg9g",
                        "img_src": "https://i.ytimg.com/vi/iojibP9pg9g/hqdefault.jpg",
                        "title": "How to use Technical Account Management (TAM) with Google Cloud Premium Support",
                        "iframe_src": "https://www.youtube-nocookie.com/embed/iojibP9pg9g"
                    }
                    
                ],
                "images": [
                    {
                        "url": "https://docs.taam.cloud/introduction",
                        "img_src": "https://mintlify.s3.us-west-1.amazonaws.com/taamai-c8c27d6c/images/home.png",
                        "title": "Welcome to Gately AI - Gately AI"
                    }
                    
                ],
                "suggestions": [
                    "What are the key features of the latest smartphone models released this year?"
                ]
            },
            "finish_reason": "stop"
        }
    ],
    "usage": {
        "prompt_tokens": 1,
        "completion_tokens": 1474,
        "total_tokens": 1475,
        "prompt_tokens_details": {
            "cached_tokens": 0,
            "text_tokens": 0,
            "audio_tokens": 0,
            "image_tokens": 0
        },
        "completion_tokens_details": {
            "text_tokens": 0,
            "audio_tokens": 0
        }
    },
    "system_fingerprint": "fp_61a4ca71"
}
```
