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

# Cortex REST API Setup

> Configure and use Snowflake Cortex REST API with Genesis Data Agents for AI-powered data operations

## Overview

The Snowflake Cortex REST API integration allows Genesis Data Agents to leverage state-of-the-art large language models (LLMs) directly within your Snowflake environment. This enables powerful AI capabilities for text generation, embeddings, and unstructured data analysis—all without requiring a Snowflake warehouse.

### Key Benefits

* **No Warehouse Required**: Cortex REST API operates without warehouse compute costs
* **Multiple Model Options**: Access models from OpenAI, Anthropic, Meta, Mistral AI, and DeepSeek
* **Server-Sent Events**: Streaming token generation for responsive user experiences
* **Native Integration**: Seamlessly works within Genesis agent implementations

## How Genesis Uses Cortex REST API

Genesis integrates with Cortex REST API through the `bot_implementation` configuration, allowing agents to use Cortex models as their underlying LLM provider.

```mermaid theme={null}
graph TD
    A[Genesis Agent] -->|HTTP POST Request| B[Cortex REST API Endpoint]
    B -->|Authentication| C{Snowflake Auth Layer}
    C -->|JWT/OAuth/PAT Token| D[CORTEX_USER Role Check]
    D -->|Authorized| E[Model Selection]
    E -->|claude-sonnet-4-6| F1[Anthropic Models]
    E -->|openai-gpt-5| F2[OpenAI Models]
    E -->|claude-opus-5| F1
    E -->|openai-gpt-5.2| F2
    E -->|deepseek-r1| F5[DeepSeek Models]
    F1 & F2 & F5 -->|Server-Sent Events| G[Streaming Response]
    G -->|Token Stream| H[Genesis Agent Response]
    H -->|Display| I[User Interface]
    
    style A fill:#0078d4,color:#fff
    style B fill:#29b6f6,color:#fff
    style E fill:#66bb6a,color:#fff
    style H fill:#0078d4,color:#fff
```

<Warning>
  **The Team Wiki Librarian uses your active LLM provider.** When Cortex is the active provider, set `wiki.extractor_model` to a Cortex model such as `cortex/claude-sonnet-4-6` (pick it from the dropdown in Advanced Settings). If you later switch the active provider away from Cortex, the Librarian stops calling Cortex until you choose a model from the new provider. See [Team Wiki Learnings](/docs/User-Guide/Team-Wiki-Learnings).
</Warning>

## Prerequisites

Before configuring Cortex REST API in Genesis, ensure you have:

1. **Snowflake Account** with Cortex AI features enabled in a supported region
2. **Authentication Credentials**: Programmatic Access Token (PAT) or Snowflake key-pair (PEM private key plus account and user)
3. **CORTEX\_USER Role**: Granted to your user/role (usually inherited from PUBLIC role)
4. **Genesis Data Agents** platform deployed (SPCS or standalone)

## Configure in Genesis

On standalone or non-native deployments, open **Config -> AI Providers**, select **Snowflake Cortex**, and choose **Authentication Method**:

* **Personal Access Token (PAT)** — enter **Account URL** and **Personal Access Token**.
* **Key Pair (JWT)** — enter **Snowflake Account**, **Snowflake User**, **Private Key** (PEM), and optional **Private Key Passphrase** for encrypted keys.

Use **Test Connection** to verify either mode before saving. In Snowflake Native App / SPCS runtimes where Cortex is already available, Genesis can use native runtime credentials without entering these fields. See [AI Providers](/docs/Setup/Setup-AI-Model) for embedding-method options and model-assignment details.

## Additional Resources

* [Snowflake Cortex REST API Documentation](https://docs.snowflake.com/en/user-guide/snowflake-cortex/cortex-rest-api)

## Support

For issues specific to:

* **Cortex REST API**: Contact Snowflake Support
* **Genesis Integration**: Email [support@genesiscomputing.ai](mailto:support@genesiscomputing.ai)
* **Rate Limit Increases**: Submit ticket to Snowflake Support with usage projections
