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

Any flag can be set via an env var (SNOWFLAKE_ACCOUNT, SNOWFLAKE_USER, etc.) or ~/.snowflake-claude-code/config.toml.

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.

/model picker

Claude Code's built-in picker lists its own aliases (Sonnet, Opus, Haiku, 1M-context variants) — we can't replace that catalog. The model you launched with appears as a custom picker entry labeled "Via Snowflake Cortex". Swap by relaunching with a different --model.

🔍 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.0.tar.gz (79.8 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.0-py3-none-any.whl (15.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: snowflake_claude_code-1.0.0.tar.gz
  • Upload date:
  • Size: 79.8 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.0.tar.gz
Algorithm Hash digest
SHA256 bd58da863f575961b8e6ab5d42eb12dc564d3a8f503931fb6b5791126f01008e
MD5 77cb78aaf5973c155920a1cbe5e7b567
BLAKE2b-256 2b77ccdf94fab258d6efcb02f5edaa8cf8dcb232dd88750e480f2fbcf4afea57

See more details on using hashes here.

Provenance

The following attestation bundles were made for snowflake_claude_code-1.0.0.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.0-py3-none-any.whl.

File metadata

File hashes

Hashes for snowflake_claude_code-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b70cb7d795b352dad50880e34faa0317a9fc7c9844e5c2e973cb83b7f3382edc
MD5 b7a19f557aa5e91968e4a618d0e2fbc6
BLAKE2b-256 556829598a382e817d6ce7d48d3a47ae3e55e631cb18b10e113c94bc187b5d5d

See more details on using hashes here.

Provenance

The following attestation bundles were made for snowflake_claude_code-1.0.0-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