world"` before processing, ensuring the inner reasoning is recognized as a single `THINKING` chunk despite arriving in f
world"before processing, ensuring the inner reasoning is recognized as a singleTHINKING` chunk despite arriving in fragmented network packets.
Summary
ThinkTagParserinparsing/think_tags.pymaintains a stateful buffer to extract"), the parser waits for the subsequent chunk before yielding aContentChunk, ensuring reasoning content is never fragmented in the SSE output.
Can I disable thinking tokens for a single API request without changing global settings?
Yes. Include "thinking": {"enabled": false} in the request JSON body. The provider checks request.thinking.enabled during initialization; when False, it discards ContentType.THINKING chunks via a continue statement in providers/openai_compat.py while still parsing them internally for tool detection compatibility.
Where does the parser logic reside in the free‑claude‑code repository?
The core parsing logic is implemented in the ThinkTagParser class located in parsing/think_tags.py. The integration logic that consumes this parser, evaluates ENABLE_THINKING, and emits SSE events resides in providers/openai_compat.py, specifically within the async streaming loop (lines 87‑110) and the post‑stream flush block (lines 12‑26).
Why is there both a global ENABLE_THINKING flag and a per‑request thinking.enabled field?
The environment variable provides a server‑wide default, while the request field allows client‑driven overrides. This dual‑layer approach lets administrators set baseline behavior (e.g., disabled for token cost savings) while permitting specific clients to opt‑in to reasoning visibility without requiring service restarts or separate deployment pipelines.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →