> For the complete documentation index, see [llms.txt](https://help.tellius.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.tellius.com/tellius-6.4/settings/kaiya-and-ai/snowflake-cortex-inference.md).

# Snowflake Cortex inference

Run Kaiya on language models hosted in your own Snowflake account through Snowflake Cortex, so model execution stays inside Snowflake.

Kaiya runs on language models from providers such as OpenAI, Anthropic and Google. It can also run on models hosted in Snowflake, through Snowflake Cortex. Teams that keep their data in Snowflake can then keep model execution there too. Kaiya's model use draws on the Snowflake credits your organization has already committed, rather than a separate model bill.

Setting it up takes two steps in Tellius: add a **Snowflake Cortex** configuration in **LLM Configuration**, then choose it in **LLM Assignments**.

### **Before you start**

You need a few things ready in Snowflake:

* **Your account identifier.** This is the first part of your Snowflake URL. For example, it is `myorganization` in `myorganization.snowflakecomputing.com`.
* **A Snowflake user for Tellius.** Snowflake recommends a dedicated user for these requests.
* **Access to Cortex for that user.** Cortex requests run under the user's default role, and that role needs the `SNOWFLAKE.CORTEX_USER` database role or the narrower `SNOWFLAKE.CORTEX_REST_API_USER` role. Snowflake grants `CORTEX_USER` to every role by default, so check with your Snowflake administrator whether it has been removed.
* **A way to sign in.** Either a token (a Snowflake programmatic access token or an OAuth access token), or an RSA key pair registered with the Snowflake user.
* **The model you want to use.** Check that it is available to your Snowflake account and region. Snowflake marks some models as preview, and those are not meant for production use.

### **Add a Snowflake Cortex configuration**

<figure><img src="https://1702728550-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FC5PhRxmOjkQZJEO6F9Zw%2Fuploads%2FCyLv6qbEB0pLm9v4BhVb%2Fcx-bearer-hl.png?alt=media&amp;token=71758763-1e0d-4f02-b052-abfd8ea1bd1c" alt="The Add Configuration dialog with Snowflake Cortex chosen and the Bearer Token authentication fields" width="563"><figcaption></figcaption></figure>

1. Go to **Settings → Intelligence → Kaiya & AI → LLM Configuration** and select **Add Configuration**.
2. Under **LLM Model**, choose **Snowflake Cortex**. The form changes to show the fields Cortex needs.
3. Enter a **Reference Name**. This is the name you pick the configuration by in **LLM Assignments**, so make it clear, for example the model name.
4. Enter the **Model Parameter**: the request settings, written as JSON, including the Cortex model to use. Contact Tellius support for the exact keys.
5. Enter your Snowflake **Account** identifier.
6. Choose an **Authentication Type** and fill in the field it adds:
   * **Bearer Token (PAT / OAuth):** paste the token in **Bearer Token**. It can be a Snowflake programmatic access token, an OAuth access token or a JWT.
   * **Key-Pair (RSA Private Key):** enter the **Snowflake User** the key pair belongs to, and paste the private key in PEM format in **RSA Private Key (PEM)**.
7. Select **Validate** to send a test request with these details. Fix anything it reports.
8. Select **Save**. To keep a partly filled configuration, select **Save as Draft** instead.

**Validate** and **Save** stay unavailable until the required fields are filled in. A Snowflake Cortex configuration has no **Default Header** field.

### **Use the configuration in Kaiya**

1. Go to **Settings → Intelligence → Kaiya & AI → LLM Assignments**.
2. Under **Unified Chat**, choose your Snowflake Cortex configuration as the **Primary Model**, the **Secondary Model**, or both.
3. Select **Save**.

The **Secondary Model** is optional. Kaiya switches to it on its own if the primary model fails with a rate limit or an authentication error. See [LLM Assignments](https://help.tellius.com/settings/kaiya-and-ai/llm-assignments).

### **Cost and usage**

Snowflake bills Cortex use to your Snowflake account in credits. To see the usage on the Snowflake side, use the `CORTEX_REST_API_USAGE_HISTORY` view in Snowflake's Account Usage schema.

In Tellius, **Kaiya Cost** shows the cost of Kaiya's model use from the rates set for each model. A model reached through Snowflake Cortex appears in its own row. If it has no rates yet, add them on the **Model Pricing** tab so its usage shows a cost. See [Kaiya Cost](https://help.tellius.com/settings/kaiya-and-ai/kaiya-cost).

### **Edit or remove the configuration**

Your Snowflake Cortex configuration appears as a card on **LLM Configuration**, labelled **Snowflake Cortex**. Use the card's three-dot menu to **Edit** or **Delete** it. Before you delete it, choose another configuration in **LLM Assignments** for any slot that uses it. See [LLM Configuration](https://help.tellius.com/settings/kaiya-and-ai/llm-configuration).

### **Best practices**

* **Use a dedicated Snowflake user.** It keeps Kaiya's Cortex use separate in Snowflake's usage history and easy to control.
* **Validate before you save.** A wrong account identifier or an expired token shows up straight away.
* **Set a secondary model.** If the primary model hits a rate limit, Kaiya carries on with the secondary one.
* **Add rates for your Cortex model.** Kaiya Cost can only show a cost for models that have rates.

### **Related pages**

* [LLM Configuration](https://help.tellius.com/settings/kaiya-and-ai/llm-configuration)
* [LLM Assignments](https://help.tellius.com/settings/kaiya-and-ai/llm-assignments)
* [Kaiya Cost](https://help.tellius.com/settings/kaiya-and-ai/kaiya-cost)
* [Connecting to Snowflake](https://help.tellius.com/data/create-new-datasource/connecting-to-snowflake)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://help.tellius.com/tellius-6.4/settings/kaiya-and-ai/snowflake-cortex-inference.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
