Skip to main content

Snowflake Cortex logoSnowflake Cortex

Access 25 Snowflake Cortex models through Mastra's model router. Authentication is handled automatically using the SNOWFLAKE_CORTEX_PAT environment variable. Configure SNOWFLAKE_ACCOUNT as well.

Learn more in the Snowflake Cortex documentation.

.env
SNOWFLAKE_ACCOUNT=your-value
SNOWFLAKE_CORTEX_PAT=your-api-key
src/mastra/agents/my-agent.ts
import { Agent } from "@mastra/core/agent";

const agent = new Agent({
id: "my-agent",
name: "My Agent",
instructions: "You are a helpful assistant",
model: "snowflake-cortex/claude-fable-5"
});

// Generate a response
const response = await agent.generate("Hello!");

// Stream a response
const stream = await agent.stream("Tell me a story");
for await (const chunk of stream) {
console.log(chunk);
}
note

Mastra uses the OpenAI-compatible /chat/completions endpoint. Some provider-specific features may not be available. Check the Snowflake Cortex documentation for details.

Models
Direct link to Models

ModelContextToolsReasoningImageAudioVideoInput $/1MOutput $/1M
snowflake-cortex/claude-fable-51.0M
snowflake-cortex/claude-haiku-4-5200K
snowflake-cortex/claude-opus-4-5200K
snowflake-cortex/claude-opus-4-61.0M
snowflake-cortex/claude-opus-4-71.0M
snowflake-cortex/claude-opus-4-81.0M
snowflake-cortex/claude-opus-51.0M
snowflake-cortex/claude-sonnet-4-5200K
snowflake-cortex/claude-sonnet-4-61.0M
snowflake-cortex/claude-sonnet-51.0M
snowflake-cortex/deepseek-r1128K
snowflake-cortex/gemini-3.1-pro1.0M
snowflake-cortex/mistral-large2262K
snowflake-cortex/openai-gpt-4.11.0M
snowflake-cortex/openai-gpt-5400K
snowflake-cortex/openai-gpt-5-mini272K
snowflake-cortex/openai-gpt-5-nano400K
snowflake-cortex/openai-gpt-5.1400K
snowflake-cortex/openai-gpt-5.2400K
snowflake-cortex/openai-gpt-5.41.1M
snowflake-cortex/openai-gpt-5.51.1M
snowflake-cortex/openai-gpt-5.6-luna1.1M
snowflake-cortex/openai-gpt-5.6-sol1.1M
snowflake-cortex/openai-gpt-5.6-terra1.1M
snowflake-cortex/snowflake-llama3.3-70b128K
25 available models

Model availability, capabilities, context windows, and pricing are sourced from models.dev and may change.

Advanced configuration
Direct link to Advanced configuration

Custom headers
Direct link to Custom headers

src/mastra/agents/my-agent.ts
const agent = new Agent({
id: "custom-agent",
name: "custom-agent",
model: {
url: "https://${SNOWFLAKE_ACCOUNT}.snowflakecomputing.com/api/v2/cortex/v1",
id: "snowflake-cortex/claude-fable-5",
apiKey: process.env.SNOWFLAKE_CORTEX_PAT,
headers: {
"X-Custom-Header": "value"
}
}
});

Dynamic model selection
Direct link to Dynamic model selection

src/mastra/agents/my-agent.ts
const agent = new Agent({
id: "dynamic-agent",
name: "Dynamic Agent",
model: ({ requestContext }) => {
const useAdvanced = requestContext.task === "complex";
return useAdvanced
? "snowflake-cortex/snowflake-llama3.3-70b"
: "snowflake-cortex/claude-fable-5";
}
});
On this page