Skip to content

Instantly share code, notes, and snippets.

View kdcyberdude's full-sized avatar

Karandeep singh kdcyberdude

View GitHub Profile
@kdcyberdude
kdcyberdude / proxy.py
Created May 9, 2026 10:02
vLLM preserve_thinking proxy (Anthropic/OpenAI) + start_vllm_and_proxy.sh launcher
#!/usr/bin/env python3
"""
vLLM preserve_thinking proxy (multi-session, restart-safe)
Behaviour
─────────
1. Forwards requests to UPSTREAM (CLI `--upstream`, env
PRESERVE_THINKING_PROXY_UPSTREAM, or default https://vllm.treowai.com).
2. Injects preserve_thinking=true into chat_template_kwargs when the client did
not set it (OpenAI Chat, Responses API, and Anthropic Messages / Claude Code).