Add /internal/chat endpoint for multi-model editor integration#25
Open
Add /internal/chat endpoint for multi-model editor integration#25
Conversation
Standalone chat proxy that routes to CLI providers (Claude, Gemini, Codex) via subprocess and Ollama via HTTP API. Supports conversation history (last 20 messages), model selection, and native Ollama /api/chat messages. No auth — intended for trusted network access (editor integrations). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
shutil.which() resolves bare command names to full .cmd paths on Windows. Avoids shell=True (command injection risk) while finding npm global CLIs. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
New llm_router.py: call_llm() routes through CLI subprocess (Claude, Gemini, Codex) or Ollama HTTP with automatic fallback chain. Zero cost on subscription billing. Planner no longer requires ANTHROPIC_API_KEY. Budget reservation removed (cost is always $0 on subscription). Provider fallback: gemini → claude → codex. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Bypasses auth to allow MCP and internal callers to trigger planning via CLI providers. Includes traceback in error response for debugging. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Windows has a ~32K command line length limit. Large planning prompts (system prompt + requirements) exceed this when passed as -p arguments. Now pipes prompts via stdin for all CLI providers. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Planner returns plan_id, not id. Use .get() with fallback for resilience. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Same Windows command line length fix as llm_router.py — pipe prompts via stdin instead of passing as -p arguments to CLI providers. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
/api/internal/chatendpoint for editor integration (NoZ, VS Code extension)/api/chatmessages arrayTest plan
curl -X POST http://localhost:5200/api/internal/chat -H 'Content-Type: application/json' -d '{"prompt": "hello", "provider": "gemini"}'messagesarrayprovider: "ollama"uses HTTP API directly-m, Codex--modelflagsGenerated by Claude Code · Claude Opus 4.6