Metadata-Version: 2.4
Name: nim-proxy
Version: 1.1.0
Summary: A drop-in NVIDIA NIM proxy for Claude Code CLI and VSCode
Author-email: Mirjan Ali Sha <mastools.help@gmail.com>
License: MIT
Keywords: nvidia,nim,claude,proxy,ai,llm,Agent,Code,VSCode,CLI
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: fastapi>=0.109.0
Requires-Dist: uvicorn>=0.27.0
Requires-Dist: httpx>=0.26.0
Requires-Dist: pydantic-settings>=2.1.0
Requires-Dist: python-dotenv>=1.0.0
Requires-Dist: loguru>=0.7.2
Requires-Dist: pyjwt>=2.8.0
Requires-Dist: rich>=13.7.0
Dynamic: license-file

# 🚀 NVIDIA NIM Proxy for Claude Code [v1.1.0]
**Created By: [Mirjan Ali Sha](https://github.com/Mirjan-Ali-Sha)**

A professional, high-performance drop-in replacement for the Anthropic API using NVIDIA NIM models. Optimized specifically for the **Claude Code CLI** and **VSCode tools**.

## ✨ Features
- **🛡️ Privacy First**: 100% Locally hosted. No data tracking, no telemetry, and zero log retention.
- **🪶 Ultra Lightweight**: Minimal footprint and dependency-light for maximum speed.
- **⚡ Drop-in Compatible**: Mimics Anthropic's message protocol perfectly.
- **🔄 SSE Stability**: Advanced indexing system to prevent "Content block not found" errors during long reasoning steps.
- **🧠 Native Reasoning**: Streams live "Thinking" blocks from GLM, DeepSeek, and specialized NIM models.
- **🛠️ Sequential Tools**: Fixed tool-hanging issues by ensuring strict block termination and index alignment.
- **🛡️ Robust Fallback**: Instantly retries if primary models fail.
- **🔥 CLI Config**: Manage all your settings directly from your terminal.

---

## 📦 Installation

### 0. Install Claude Code (If you haven't)
Claude Code requires Node.js. Install it globally via npm:
```bash
npm install -g @anthropic-ai/claude-code
```

### 1. Install the Proxy
```bash
# Clone the repository
git clone https://github.com/Mirjan-Ali-Sha/nim-proxy.git
cd nim-proxy

# Install in editable mode
pip install -e .
```

```bash
pip install nim-proxy
```

### 2. Configure Your API Key (Must)
Run the interactive config command:
```bash
nim-proxy config --key your_nvidia_api_key_here
```

### 3. Start the Server
```bash
# Standard mode (Quiet)
nim-proxy start

# Debug mode (Shows request payloads)
nim-proxy start --verbose
```
The proxy will run at `http://localhost:8082` by default.

---

## 🔗 Connecting Claude Code

You need to point Claude Code to this proxy by setting the `ANTHROPIC_BASE_URL` and a dummy API Key.

### One-Liner Quick Connect
#### Windows (PowerShell)
```bash
$env:ANTHROPIC_AUTH_TOKEN="nim-proxy"; $env:ANTHROPIC_BASE_URL="http://localhost:8082"; $env:ANTHROPIC_API_KEY="sk-ant-dummy"; claude
```
#### MacOS / Linux (Bash/Zsh)
```bash
export ANTHROPIC_AUTH_TOKEN="nim-proxy" ANTHROPIC_BASE_URL="http://localhost:8082" ANTHROPIC_API_KEY="sk-ant-dummy"; claude
```

### Windows (PowerShell) - Permanent Setup
To set it up for your current session:
```powershell
$env:ANTHROPIC_AUTH_TOKEN="nim-proxy"
$env:ANTHROPIC_BASE_URL="http://localhost:8082"
$env:ANTHROPIC_API_KEY="sk-ant-dummy"
claude
```

**Permanent (Recommended):**
Add these lines to your PowerShell Profile (`notepad $profile`):
```powershell
$env:ANTHROPIC_AUTH_TOKEN="nim-proxy"
$env:ANTHROPIC_BASE_URL="http://localhost:8082"
$env:ANTHROPIC_API_KEY="sk-ant-dummy"
```

### macOS / Linux (Bash or Zsh) 
To set it up for your current session:
```bash
export ANTHROPIC_AUTH_TOKEN="nim-proxy"
export ANTHROPIC_BASE_URL="http://localhost:8082"
export ANTHROPIC_API_KEY="sk-ant-dummy"
claude
```

**Permanent:**
Add these lines to your `~/.bashrc` or `~/.zshrc`:
```bash
export ANTHROPIC_AUTH_TOKEN="nim-proxy"
export ANTHROPIC_BASE_URL="http://localhost:8082"
export ANTHROPIC_API_KEY="sk-ant-dummy"
```

---

## 🛠️ CLI Help
Use the built-in help setup generator:
```bash
nim-proxy --help
```

```bash
nim-proxy config --help
```

```bash
nim-proxy setup-env
```


To update model mappings:
```bash
nim-proxy config --opus deepseek-ai/deepseek-v4-pro --sonnet openai/gpt-oss-120b --haiku z-ai/glm-5.1 --fallback openai/gpt-oss-20b
```

## ⚠️ Legal Disclaimer
**PLEASE READ CAREFULLY.**

1. **Use at Your Own Risk**: This tool is provided for educational and developmental purposes. The Author (Mirjan Ali Sha) assumes no responsibility for how this tool is used.
2. **Third-Party Terms**: Users are strictly required to check and comply with the Licenses and Terms of Service of **NVIDIA NIM** and **Anthropic**. The Author is not responsible for any violations of these third-party agreements.
3. **No Liability**: In no event shall the Author be liable for any claims, damages, or other liability, whether in an action of contract, tort, or otherwise, arising from, out of, or in connection with the software.

## 📜 License
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for the full text and additional legal disclaimers.
