Metadata-Version: 2.4
Name: litecc-proxy
Version: 0.5.0
Summary: Anthropic Messages API proxy for LiteLLM-hosted models (e.g. Qwen) - fixes <think> tag handling for Claude Code
Requires-Python: >=3.10
Requires-Dist: fastapi>=0.115
Requires-Dist: httpx>=0.27
Requires-Dist: uvicorn[standard]>=0.30
Description-Content-Type: text/markdown

# litecc-proxy

Anthropic Messages API proxy that lets [Claude Code](https://code.claude.com) talk to a
[LiteLLM](https://www.litellm.ai/)-hosted model (e.g. Qwen 3.5) instead of the real Anthropic API.

Handles streaming, tool use, and rewrites raw `<think>...</think>` text (which reasoning
models like Qwen emit inline, and which otherwise breaks Claude Code's rendering) into proper
Anthropic `thinking` content blocks. Any number of `<think>` spans in a single response or
stream are supported.

## Run it

Without installing anything, straight from PyPI:

```sh
uvx litecc-proxy --port 4000 \
  --litellm-base-url http://11.11.11.11:4000 \
  --litellm-model qwen-3.5
```

Straight from this git repo, without cloning:

```sh
uvx --from git+https://github.com/seong-hun/litecc-proxy litecc-proxy --port 4000 \
  --litellm-base-url http://11.11.11.11:4000 \
  --litellm-model qwen-3.5
```

From a local checkout, with `uv`:

```sh
uv sync
uv run litecc-proxy --port 4000 --litellm-base-url http://11.11.11.11:4000 --litellm-model qwen-3.5
```

Every flag also has an env-var equivalent, so you can drop them in `.env` instead:

| Flag                 | Env var            | Default                 |
| -------------------- | ------------------ | ----------------------- |
| `--port`             | `PROXY_PORT`       | `8787`                  |
| `--host`             | `PROXY_HOST`       | `0.0.0.0`               |
| `--litellm-base-url` | `LITELLM_BASE_URL` | `http://localhost:4000` |
| `--litellm-model`    | `LITELLM_MODEL`    | `qwen-3.5`              |
| `--litellm-api-key`  | `LITELLM_API_KEY`  | _(empty)_               |
| `--timeout`          | `LITELLM_TIMEOUT`  | `600` (seconds)         |
| `--log-level`        | `LOG_LEVEL`        | `INFO`                  |
| `--no-think`         | `PROXY_THINK=false`| `think_enabled=true`    |

`--no-think` is for models that never emit `<think>...</think>` at all. Without it, the proxy
holds back the first chunk of every text block for a bit while it figures out whether the model's
chat template prefilled the `<think>` opener (so a bare `</think>` still gets caught). If you know
your model never thinks, `--no-think` skips that and streams immediately.

CLI flags take precedence over env vars.

## Point Claude Code at it

In Claude Code's `settings.json`:

```json
{
  "env": {
    "ANTHROPIC_BASE_URL": "http://localhost:4000"
  }
}
```

(match the port to whatever you passed to `--port`.)

## Publishing to PyPI

Publishing is automated via GitHub Actions + PyPI Trusted Publishing (OIDC): pushing a
`v*.*.*` tag builds the package and publishes it, no API token needed.

```sh
git tag v0.1.0
git push origin v0.1.0
```

After that, `uvx litecc-proxy --port 4000` works for anyone without a local checkout.
