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

# Snowflake Cortex

Serve agent inference from Snowflake Cortex, keeping tokens and billing inside your Snowflake account. Credentials come from an existing [Snowflake data connection](/integrations/databases/snowflake); no separate key is stored.

## Prerequisites

* A Snowflake data connection authenticated with a **key pair** (password-auth connections are not accepted by Snowflake's Cortex REST API).
* The connection's role needs Cortex access (the `SNOWFLAKE.CORTEX_USER` database role, granted to `PUBLIC` by default).

## Configure in Datafold

1. Navigate to **Settings** → **Integrations**, click **Add New Integration**, and choose **Snowflake Cortex**.
2. Select the **Data connection** for the account that serves Cortex.
3. **Models** — Datafold lists the account's Cortex models via `SHOW CORTEX BASE MODELS`. Select the ones to expose, or add ids manually (e.g. `claude-4-sonnet`, `mistral-large2`).
4. Click **Save**.

## Enabling the automatic model listing

`SHOW CORTEX BASE MODELS` reads the `SNOWFLAKE.MODELS` schema, which is empty until an account admin populates it, and its output is filtered by RBAC. If the model fetch reports that the schema is inaccessible, run as `ACCOUNTADMIN`:

```sql theme={null}
-- Populate SNOWFLAKE.MODELS (one-time; re-run occasionally as new models ship)
CALL SNOWFLAKE.MODELS.CORTEX_BASE_MODELS_REFRESH();

-- Make all current and future models visible to the connection's role
GRANT APPLICATION ROLE SNOWFLAKE."CORTEX-MODEL-ROLE-ALL" TO ROLE <your_role>;
```

Manual model entry works regardless — inference only requires Cortex access, not listing access.
