Snowflake Cortex

Snowflake Cortex

LiteLLM에서 Snowflake Cortex REST API의 모든 모델을 사용하는 방법을 알아봐요. Anthropic(Claude), OpenAI(GPT), Meta(Llama), Mistral, DeepSeek, Snowflake 모델을 지원해요.

출처: 문서

본문

LiteLLM은 Anthropic(Claude), OpenAI(GPT), Meta(Llama), Mistral, DeepSeek, Snowflake 모델을 포함한 Snowflake Cortex REST API의 모든 모델을 지원해요.

설명 Snowflake Cortex REST API는 OpenAI 호환 및 Anthropic 호환 엔드포인트를 통해 최고 수준의 프론티어 LLM에 접근을 제공해요. 모든 추론은 Snowflake의 보안 경계 내에서 실행돼요
LiteLLM 라우트 snowflake/
제공사 문서 Cortex REST API ↗
API 엔드포인트 Chat Completions: https://{account}.snowflakecomputing.com/api/v2/cortex/v1/chat/completions
Messages: https://{account}.snowflakecomputing.com/api/v2/cortex/v1/messages
Legacy: https://{account}.snowflakecomputing.com/api/v2/cortex/inference:complete
지원 OpenAI 엔드포인트 /chat/completions, /completions, /embeddings

: 모든 Snowflake Cortex 모델을 지원해요. LiteLLM 요청을 보낼 때 model=snowflake/을 접두사로 사용해요.

인증

Snowflake Cortex REST API는 세 가지 인증 방법을 지원해요.

Programmatic Access Token (PAT) — 권장

가장 간단한 방법이에요. Snowsight의 User Menu → My Profile → Programmatic Access Tokens에서 PAT를 생성해요.

import os
from litellm import completion

os.environ["SNOWFLAKE_API_KEY"] = "pat/"
os.environ["SNOWFLAKE_API_BASE"] = "https://.snowflakecomputing.com/api/v2/cortex/v1"

response = completion(
    model="snowflake/claude-sonnet-4-6",
    messages=[{"role": "user", "content": "Hello!"}],
)

JWT (Key-Pair 인증)

Snowflake 키 페어에서 JWT를 생성해요. Key-pair authentication 참고.

import os
from litellm import completion

os.environ["SNOWFLAKE_JWT"] = ""
os.environ["SNOWFLAKE_ACCOUNT_ID"] = "-"

response = completion(
    model="snowflake/claude-sonnet-4-6",
    messages=[{"role": "user", "content": "Hello!"}],
)

파라미터로 자격 증명 전달

from litellm import completion

# Using PAT
response = completion(
    model="snowflake/claude-sonnet-4-6",
    messages=[{"role": "user", "content": "Hello!"}],
    api_key="pat/",
    api_base="https://.snowflakecomputing.com/api/v2/cortex/v1",
)

# Using JWT
response = completion(
    model="snowflake/claude-sonnet-4-6",
    messages=[{"role": "user", "content": "Hello!"}],
    api_key="",
    account_id="-",
)

모든 인증 옵션은 "Authenticating to Cortex REST API"를 참고해요.

사용법

from litellm import completion
import os

os.environ["SNOWFLAKE_API_KEY"] = "pat/"
os.environ["SNOWFLAKE_API_BASE"] = "https://.snowflakecomputing.com/api/v2/cortex/v1"

response = completion(
    model="snowflake/claude-sonnet-4-6",
    messages=[{"role": "user", "content": "What is Snowflake Cortex?"}],
)
print(response.choices[0].message.content)

1. Config:

model_list:
  - model_name: claude-sonnet
    litellm_params:
      model: snowflake/claude-sonnet-4-6
      api_key: pat/
      api_base: https://.snowflakecomputing.com/api/v2/cortex/v1
  - model_name: llama4-maverick
    litellm_params:
      model: snowflake/llama4-maverick
      api_key: pat/
      api_base: https://.snowflakecomputing.com/api/v2/cortex/v1

2. Proxy 시작:

litellm --config /path/to/config.yaml

3. 테스트:

curl --location 'http://0.0.0.0:4000/chat/completions' \
--header 'Content-Type: application/json' \
--data '{
    "model": "claude-sonnet",
    "messages": [
        {"role": "user", "content": "What is Snowflake Cortex?"}
    ]
}'

지원되는 OpenAI 파라미터

temperature, max_tokens, top_p, stream, response_format,
tools, tool_choice

스트리밍

from litellm import completion
import os

os.environ["SNOWFLAKE_API_KEY"] = "pat/"
os.environ["SNOWFLAKE_API_BASE"] = "https://.snowflakecomputing.com/api/v2/cortex/v1"

response = completion(
    model="snowflake/claude-sonnet-4-6",
    messages=[{"role": "user", "content": "Write a haiku about data."}],
    stream=True,
)

for chunk in response:
    if chunk.choices[0].delta.content:
        print(chunk.choices[0].delta.content, end="")
curl --location 'http://0.0.0.0:4000/chat/completions' \
--header 'Content-Type: application/json' \
--data '{
    "model": "claude-sonnet",
    "messages": [{"role": "user", "content": "Write a haiku about data."}],
    "stream": true
}'

도구/함수 호출

Claude와 일부 모델에서 지원해요. LiteLLM이 OpenAI 도구 형식을 Snowflake의 tool_spec 형식으로 자동 변환해요.

from litellm import completion
import os, json

os.environ["SNOWFLAKE_API_KEY"] = "pat/"
os.environ["SNOWFLAKE_API_BASE"] = "https://.snowflakecomputing.com/api/v2/cortex/v1"

tools = [
    {
        "type": "function",
        "function": {
            "name": "get_weather",
            "description": "Get the current weather for a location",
            "parameters": {
                "type": "object",
                "properties": {
                    "location": {"type": "string", "description": "City name"}
                },
                "required": ["location"],
            },
        },
    }
]

response = completion(
    model="snowflake/claude-sonnet-4-6",
    messages=[{"role": "user", "content": "What's the weather in San Francisco?"}],
    tools=tools,
    tool_choice="auto",
)

print(response.choices[0].message.tool_calls)
model_list:
  - model_name: claude-sonnet
    litellm_params:
      model: snowflake/claude-sonnet-4-6
      api_key: pat/
      api_base: https://.snowflakecomputing.com/api/v2/cortex/v1
curl --location 'http://0.0.0.0:4000/chat/completions' \
--header 'Content-Type: application/json' \
--data '{
    "model": "claude-sonnet",
    "messages": [{"role": "user", "content": "What is the weather in SF?"}],
    "tools": [{
        "type": "function",
        "function": {
            "name": "get_weather",
            "description": "Get weather for a location",
            "parameters": {
                "type": "object",
                "properties": {"location": {"type": "string"}},
                "required": ["location"]
            }
        }
    }],
    "tool_choice": "auto"
}'

Thinking / Reasoning

Cortex의 Claude 모델은 extended thinking을 지원해요. 제공사의 thinking 파라미터를 직접 전달하며, reasoning_effort는 Snowflake에서 지원되지 않는 파라미터로, drop_params가 설정되지 않으면 UnsupportedParamsError를 발생시켜요.

from litellm import completion

response = completion(
    model="snowflake/claude-sonnet-4-6",
    messages=[{"role": "user", "content": "Solve: what is 127 * 389?"}],
    thinking={"type": "enabled", "budget_tokens": 1024},
)
print(response.choices[0].message.content)

프롬프트 캐싱

Snowflake Cortex는 비용 절감을 위한 프롬프트 캐싱을 지원해요:

  • OpenAI 모델: 1,024토큰 이상 프롬프트의 암시적 캐싱 (코드 변경 불필요)
  • Claude 모델: cache_control 중단점을 통한 명시적 캐싱

캐시된 입력 토큰은 1,024토큰 이상 캐시 시 일반 입력 요금의 10%(90% 할인)로 과금돼요.

자세한 내용은 Cortex REST API Billing & Cost Analysis를 참고해요.

임베딩

from litellm import embedding
import os

os.environ["SNOWFLAKE_API_KEY"] = "pat/"
os.environ["SNOWFLAKE_API_BASE"] = "https://.snowflakecomputing.com/api/v2/cortex/v1"

response = embedding(
    model="snowflake/snowflake-arctic-embed-l-v2.0",
    input=["Snowflake Cortex provides LLM inference"],
)
print(response.data[0]["embedding"][:5])

지원 모델

모든 모델은 snowflake/ 접두사로 사용 가능해요.

: 현재 모델 가용성, 레이트 리밋, 가격은 공식 Cortex REST API 문서와 Service Consumption Table을 참고해요.

채팅 완성 모델

모델 litellm 모델명 함수 호출 Vision 프롬프트 캐싱
Claude Sonnet 4.5 snowflake/claude-sonnet-4-5
Claude Sonnet 4.6 snowflake/claude-sonnet-4-6
Claude 4 Sonnet snowflake/claude-4-sonnet
Claude 4 Opus snowflake/claude-4-opus
Claude Haiku 4.5 snowflake/claude-haiku-4-5
Claude 3.7 Sonnet snowflake/claude-3-7-sonnet
Claude 3.5 Sonnet snowflake/claude-3-5-sonnet
OpenAI GPT-4.1 snowflake/openai-gpt-4.1
OpenAI GPT-5 snowflake/openai-gpt-5
OpenAI GPT-5 Mini snowflake/openai-gpt-5-mini
OpenAI GPT-5 Nano snowflake/openai-gpt-5-nano
DeepSeek R1 snowflake/deepseek-r1
Mistral Large 2 snowflake/mistral-large2
Llama 3.1 8B snowflake/llama3.1-8b
Llama 3.1 70B snowflake/llama3.1-70b
Llama 3.1 405B snowflake/llama3.1-405b
Llama 3.3 70B snowflake/llama3.3-70b
Llama 4 Maverick snowflake/llama4-maverick
Snowflake Llama 3.3 70B snowflake/snowflake-llama-3.3-70b

임베딩 모델

모델 litellm 모델명
Snowflake Arctic Embed L v2.0 snowflake/snowflake-arctic-embed-l-v2.0
Snowflake Arctic Embed M v2.0 snowflake/snowflake-arctic-embed-m-v2.0

더 알아보기 (Learn more)

  • Snowflake Cortex REST API 문서
  • Cortex REST API 인증 문서