Skip to main content

Run Claude Code against Claude models hosted on Snowflake Cortex.

Project description

❄️ snowflake-claude-code

PyPI CI License

Run Claude Code against Claude models served by Cortex inside your Snowflake account, so prompts and responses never leave your Snowflake governance boundary.

Claude Code  →  FastAPI proxy (127.0.0.1:4000)  →  Snowflake Cortex Inference

The CLI authenticates to Snowflake (SSO or PAT), starts a local proxy that translates Anthropic Messages API calls to Cortex Inference calls (SSE streaming included), and launches Claude Code pointed at the proxy.

⚡ Quick start

uv tool install snowflake-claude-code
npm install -g @anthropic-ai/claude-code
snowflake-claude-code --account MYORG-MYACCOUNT --user me@company.com

Browser pops for Snowflake SSO, proxy spins up, Claude Code launches.

🔒 Why

Your Claude Code session never talks to Anthropic. Every prompt, file read, tool call, and model response goes over TLS to the same Snowflake endpoint your warehouse queries already use — governed by your existing Snowflake trust boundary, not a new third-party LLM vendor.

  • 🚫 No traffic to Anthropic. The proxy binds to 127.0.0.1 only; the only outbound endpoint is your Snowflake account's API.
  • 🛡️ Snowflake IAM applies. Role, warehouse, and network policy controls gate model access. Revoke Snowflake → revoke AI.
  • 🔑 Familiar auth. Browser SSO flows through your existing IdP; PATs for headless.
  • 📝 Full audit trail. Every call lands in SNOWFLAKE.ACCOUNT_USAGE.CORTEX_REST_API_USAGE_HISTORY.
  • 🌍 Data residency honored. Inference runs in your account's region.
  • 🧠 No training on your data. Per Snowflake Cortex terms.
  • 💰 Consolidated spend. Cortex tokens roll up with your warehouse costs.
  • ♻️ Transparent re-auth. Expired tokens trigger a silent refresh mid-session.

📦 Install

Requires Python 3.10+ and the Claude Code CLI.

uv tool install snowflake-claude-code     # recommended
pipx install snowflake-claude-code        # or pipx
pip install snowflake-claude-code         # or pip
uvx snowflake-claude-code ...             # or run without installing

And Claude Code itself:

npm install -g @anthropic-ai/claude-code

🚀 Usage

snowflake-claude-code \
  --account MYORG-MYACCOUNT \
  --user me@company.com \
  --model claude-sonnet-4-6

Flags

Flag Default Description
--account Snowflake account identifier
--user Snowflake username (required for SSO)
--model claude-sonnet-4-6 Cortex model ID
--port 4000 Local proxy port
--token Snowflake PAT (skips browser SSO)
--verbose, -v off Debug logging

Environment variables

Any flag can also be provided via an env var — useful for shell profiles, CI, or devcontainers:

Env var Equivalent flag
SNOWFLAKE_ACCOUNT --account
SNOWFLAKE_USER (or SNOWFLAKE_USERNAME) --user
SNOWFLAKE_MODEL --model
SNOWFLAKE_PORT --port
SNOWFLAKE_TOKEN --token
export SNOWFLAKE_ACCOUNT=MYORG-MYACCOUNT
export SNOWFLAKE_USER=me@company.com
snowflake-claude-code

Config file

Or persist them in ~/.snowflake-claude-code/config.toml:

account = "MYORG-MYACCOUNT"
user = "me@company.com"
default_model = "claude-sonnet-4-6"
port = 4000
# token = "pat-..."   # optional, skips SSO

Precedence: CLI flags > env vars > config file > defaults.

🤖 Supported models

Model ID Notes
claude-sonnet-4-6 Default — 1M context built-in
claude-sonnet-4-5 Previous-generation Sonnet
claude-opus-4-6 Most capable Claude model on Cortex
claude-opus-4-5 Previous-generation Opus
claude-haiku-4-5 Fastest, cheapest

Not every model is available in every Snowflake region — use cross-region inference or check SHOW CORTEX FUNCTIONS for your region.

Non-Claude Cortex models work for plain chat too (--model mistral-large2, --model llama3.1-70b). Tool-calling compatibility varies.

🔍 Verify traffic is hitting Snowflake

SELECT START_TIME, MODEL_NAME, TOKENS, USER_ID, INFERENCE_REGION
FROM SNOWFLAKE.ACCOUNT_USAGE.CORTEX_REST_API_USAGE_HISTORY
WHERE START_TIME >= CURRENT_DATE()
ORDER BY START_TIME DESC;

ACCOUNT_USAGE views lag 45 min–3 hours. For real-time, run with --verbose.

🏗️ Architecture

snowflake_claude_code/
├── cli.py        Parse config, start proxy, launch `claude` subprocess
├── proxy.py      FastAPI app: /v1/messages, /v1/models, /v1/health
├── translate.py  Anthropic ⇄ Cortex format translation + SSE adapter
├── auth.py       Snowflake connector + re-auth on 401
└── config.py     Layered config loader

The proxy binds to 127.0.0.1 only. The Snowflake token lives in process memory for the session lifetime and is cleared on exit.

🛠️ Development

git clone https://github.com/dylan-murray/snowflake-claude-code.git
cd snowflake-claude-code
uv sync --group dev

uv run pytest
uv run ruff check .
uv run ruff format .

CI runs on Python 3.10–3.13.

📄 License

MIT — see LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

snowflake_claude_code-1.0.1.tar.gz (80.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

snowflake_claude_code-1.0.1-py3-none-any.whl (15.4 kB view details)

Uploaded Python 3

File details

Details for the file snowflake_claude_code-1.0.1.tar.gz.

File metadata

  • Download URL: snowflake_claude_code-1.0.1.tar.gz
  • Upload date:
  • Size: 80.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for snowflake_claude_code-1.0.1.tar.gz
Algorithm Hash digest
SHA256 1b4592ad2970fa30df3883c5015757181893b3da1987120e9ec1e26e7a29d024
MD5 63e8261c68d97918cb51337a0e324c61
BLAKE2b-256 621adebbbdad698ff2a0d278e80a52f8b44dabb93ba117afca5a62c7d435e4ac

See more details on using hashes here.

Provenance

The following attestation bundles were made for snowflake_claude_code-1.0.1.tar.gz:

Publisher: release.yml on dylan-murray/snowflake-claude-code

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file snowflake_claude_code-1.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for snowflake_claude_code-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c8c69a3eecdcced743145fb970c89a0493675ab9260c6b3ad8f183ed62e5d93d
MD5 b956e09345ff523aa7a46dac24cca45b
BLAKE2b-256 429104328700919ae5dea4ba3a8f8b6f94c7e24d6f097e05c7d9640c1c8a2f5f

See more details on using hashes here.

Provenance

The following attestation bundles were made for snowflake_claude_code-1.0.1-py3-none-any.whl:

Publisher: release.yml on dylan-murray/snowflake-claude-code

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page