Run Claude Code against Claude models hosted on Snowflake Cortex.
Project description
❄️ snowflake-claude-code
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.1only; 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) |
--model |
claude-sonnet-4-6 |
Cortex model ID |
--port |
4000 |
Local proxy port |
--token |
— | Snowflake PAT — pair with --user to skip 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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file snowflake_claude_code-1.0.3.tar.gz.
File metadata
- Download URL: snowflake_claude_code-1.0.3.tar.gz
- Upload date:
- Size: 83.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
51cd7b3d7f3864269e38c31208cffbbd6b8228df72205a2b126aa9263af2003f
|
|
| MD5 |
ee2f0588a7486823c49e39feff961e4d
|
|
| BLAKE2b-256 |
eb4f00032d078e375f4ea5abb5356864f8c9706d75e47910a41aeb9563729530
|
Provenance
The following attestation bundles were made for snowflake_claude_code-1.0.3.tar.gz:
Publisher:
release.yml on dylan-murray/snowflake-claude-code
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
snowflake_claude_code-1.0.3.tar.gz -
Subject digest:
51cd7b3d7f3864269e38c31208cffbbd6b8228df72205a2b126aa9263af2003f - Sigstore transparency entry: 1333797455
- Sigstore integration time:
-
Permalink:
dylan-murray/snowflake-claude-code@d19ceb3b03cee53d0d3dd0c5272518eb6b70d01d -
Branch / Tag:
refs/tags/v1.0.3 - Owner: https://github.com/dylan-murray
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@d19ceb3b03cee53d0d3dd0c5272518eb6b70d01d -
Trigger Event:
push
-
Statement type:
File details
Details for the file snowflake_claude_code-1.0.3-py3-none-any.whl.
File metadata
- Download URL: snowflake_claude_code-1.0.3-py3-none-any.whl
- Upload date:
- Size: 17.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3c5dbfbdc273e5e9abe9ea8810e4ef5bcbe5ecf4cdaf096494830477338d2500
|
|
| MD5 |
70db1fb3224b3544323b8adca3da38db
|
|
| BLAKE2b-256 |
542ee10948f990ec3ed74a1f1172f0c64a7f256e37394edc998972b8091cbd35
|
Provenance
The following attestation bundles were made for snowflake_claude_code-1.0.3-py3-none-any.whl:
Publisher:
release.yml on dylan-murray/snowflake-claude-code
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
snowflake_claude_code-1.0.3-py3-none-any.whl -
Subject digest:
3c5dbfbdc273e5e9abe9ea8810e4ef5bcbe5ecf4cdaf096494830477338d2500 - Sigstore transparency entry: 1333797590
- Sigstore integration time:
-
Permalink:
dylan-murray/snowflake-claude-code@d19ceb3b03cee53d0d3dd0c5272518eb6b70d01d -
Branch / Tag:
refs/tags/v1.0.3 - Owner: https://github.com/dylan-murray
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@d19ceb3b03cee53d0d3dd0c5272518eb6b70d01d -
Trigger Event:
push
-
Statement type: