nvidia-claude-proxy
v1.0.1
Published
Proxy that exposes Anthropic/Claude-style POST /v1/messages, converts to OpenAI Chat Completions, and forwards to NVIDIA API
Maintainers
Readme
nvidia-claude-proxy
Proxy that exposes Anthropic/Claude-style POST /v1/messages, converts to OpenAI Chat Completions format, and forwards to NVIDIA API.
Visit build.nvidia.com/explore/discover, register an account, and generate an API key. NVIDIA provides hidden models such as moonshotai/kimi-k2.5, z-ai/glm4.7, and minimaxai/minimax-m2.1.
Install
npm install -g nvidia-claude-proxy@latest
# or
npx nvidia-claude-proxyInitialization
Run the init command to set up your NVIDIA API Key and port interactively. The configuration will be saved to your user home directory (e.g., ~/.nvidia-claude-proxy/config.json).
nvidia-claude-proxy init
# or
npx nvidia-claude-proxy initConfig
The configuration is stored in ~/.nvidia-claude-proxy/config.json (or %USERPROFILE%\.nvidia-claude-proxy\config.json on Windows).
To update your configuration, you can edit this file directly:
{
"nvidia_url": "https://integrate.api.nvidia.com/v1/chat/completions",
"nvidia_key": "your-nvidia-api-key",
"port": 3001,
"host": "0.0.0.0"
}Alternatively, you can re-run the init command to overwrite the existing configuration.
| Option | Description |
|--------|-------------|
| nvidia_url | Upstream API URL (default: https://integrate.api.nvidia.com/v1/chat/completions) |
| nvidia_key | Required. Used for upstream authentication. Usually keys starting nvapi- ... |
| port | Listen port (default: 3001) |
| host | Listen host (default: 0.0.0.0) |
Environment Variables
| Variable | Default | Description |
|----------|---------|-------------|
| CONFIG_PATH | ~/.nvidia-claude-proxy/config.json | Path to config file |
| PROVIDER_API_KEY | from config | Overrides nvidia_key |
| UPSTREAM_URL | from config | Overrides nvidia_url |
| ADDR | from config / port+host | Full listen address (e.g. :3001, 0.0.0.0:8080); overrides PORT and HOST when set |
| PORT | from config | Listen port (used when ADDR is not set) |
| HOST | from config | Listen host (used when ADDR is not set) |
| UPSTREAM_TIMEOUT_SECONDS | 300 | Upstream request timeout |
| LOG_BODY_MAX_CHARS | 0 | Max chars to log in request/response bodies (0 disables) |
| LOG_STREAM_TEXT_PREVIEW_CHARS | 0 | Max chars for stream preview in logs (0 disables) |
| VERBOSE | false | Set to 1 or true to enable detailed logs |
Run
nvidia-claude-proxy
# or
npx nvidia-claude-proxyBuild & Test
npm run build # verify modules load (uses config.json.example)
npm test # run tests (Node built-in test runner)Usage with Claude CLI
Using moonshotai/kimi-k2.5:
export ANTHROPIC_BASE_URL=http://localhost:3001
export ANTHROPIC_AUTH_TOKEN=any
export ANTHROPIC_DEFAULT_HAIKU_MODEL=moonshotai/kimi-k2.5
export ANTHROPIC_DEFAULT_SONNET_MODEL=moonshotai/kimi-k2.5
export ANTHROPIC_DEFAULT_OPUS_MODEL=moonshotai/kimi-k2.5
claudeUsing z-ai/glm4.7:
export ANTHROPIC_BASE_URL=http://localhost:3001
export ANTHROPIC_AUTH_TOKEN=any
export ANTHROPIC_DEFAULT_HAIKU_MODEL=z-ai/glm4.7
export ANTHROPIC_DEFAULT_SONNET_MODEL=z-ai/glm4.7
export ANTHROPIC_DEFAULT_OPUS_MODEL=z-ai/glm4.7
claudeUsing minimaxai/minimax-m2.1:
export ANTHROPIC_BASE_URL=http://localhost:3001
export ANTHROPIC_AUTH_TOKEN=any
export ANTHROPIC_DEFAULT_HAIKU_MODEL=minimaxai/minimax-m2.1
export ANTHROPIC_DEFAULT_SONNET_MODEL=minimaxai/minimax-m2.1
export ANTHROPIC_DEFAULT_OPUS_MODEL=minimaxai/minimax-m2.1
claudeAPI
POST /v1/messages
- Upstream auth: Always sends
Authorization: Bearer <nvidia_key>to NVIDIA.
Example (non-stream):
curl -sS http://127.0.0.1:3001/v1/messages \
-H 'Content-Type: application/json' \
-d '{
"model":"z-ai/glm4.7",
"max_tokens":256,
"messages":[{"role":"user","content":"hello"}]
}'Example (stream):
curl -N http://127.0.0.1:3001/v1/messages \
-H 'Content-Type: application/json' \
-d '{
"model":"z-ai/glm4.7",
"max_tokens":256,
"stream":true,
"messages":[{"role":"user","content":"hello"}]
}'POST /v1/chat/completions (OpenAI-compatible)
Same upstream as /v1/messages, but accepts OpenAI request format and returns the response as-is (no conversion). Use this when your client (e.g. Cursor, OpenAI SDK) calls the OpenAI-style endpoint. Upstream auth behaves the same as /v1/messages.
GET /
Health check. Returns {"message":"nvidia-claude-proxy","health":"ok"}.
Notes / Limitations
- Streaming conversion supports
delta.contenttext anddelta.tool_callstool-use blocks. - Logs may show forwarded request bodies; keep
LOG_BODY_MAX_CHARSsmall and avoid secrets in prompts. - Requires Node.js >= 18.
