> ## Documentation Index
> Fetch the complete documentation index at: https://mintlify.com/ItzCrazyKns/Perplexica/llms.txt
> Use this file to discover all available pages before exploring further.

# Providers endpoint

> Get available AI providers and their chat and embedding models

The providers endpoint returns a list of all active providers with their available chat and embedding models. Use this endpoint before making search requests to get the valid provider IDs and model keys.

## Endpoint

<CodeGroup>
  ```bash GET /api/providers theme={null}
  http://localhost:3000/api/providers
  ```
</CodeGroup>

<Note>Replace `localhost:3000` with your Perplexica instance URL if running on a different host or port.</Note>

## Response

<ResponseField name="providers" type="array">
  A list of all active providers with their available models.

  <Expandable title="provider object">
    <ResponseField name="id" type="string">
      The UUID of the provider. Use this as the `providerId` when making search requests.
    </ResponseField>

    <ResponseField name="name" type="string">
      The display name of the provider (e.g., "OpenAI", "Ollama").
    </ResponseField>

    <ResponseField name="chatModels" type="array">
      Available chat models for this provider.

      <Expandable title="model object">
        <ResponseField name="name" type="string">
          The display name of the model (e.g., "GPT 4 Omni Mini").
        </ResponseField>

        <ResponseField name="key" type="string">
          The model key/identifier (e.g., `gpt-4o-mini`). Use this value in the `chatModel.key` field when making search requests.
        </ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="embeddingModels" type="array">
      Available embedding models for this provider.

      <Expandable title="model object">
        <ResponseField name="name" type="string">
          The display name of the model (e.g., "Text Embedding 3 Large").
        </ResponseField>

        <ResponseField name="key" type="string">
          The model key/identifier (e.g., `text-embedding-3-large`). Use this value in the `embeddingModel.key` field when making search requests.
        </ResponseField>
      </Expandable>
    </ResponseField>
  </Expandable>
</ResponseField>

## Request example

<CodeGroup>
  ```bash cURL theme={null}
  curl http://localhost:3000/api/providers
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch('http://localhost:3000/api/providers');
  const data = await response.json();
  console.log(data);
  ```

  ```python Python theme={null}
  import requests

  response = requests.get('http://localhost:3000/api/providers')
  data = response.json()
  print(data)
  ```
</CodeGroup>

## Response example

```json theme={null}
{
  "providers": [
    {
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "name": "OpenAI",
      "chatModels": [
        {
          "name": "GPT 4 Omni Mini",
          "key": "gpt-4o-mini"
        },
        {
          "name": "GPT 4 Omni",
          "key": "gpt-4o"
        }
      ],
      "embeddingModels": [
        {
          "name": "Text Embedding 3 Large",
          "key": "text-embedding-3-large"
        }
      ]
    }
  ]
}
```

<Note>
  Use the `id` field as the `providerId` and the `key` field from the models arrays when making search requests.
</Note>

## Error responses

<ResponseField name="500" type="Internal Server Error">
  Returned if an error occurs while fetching providers.
</ResponseField>
