Add subscription-login provider bridges via local CLI subprocess#12
Merged
Conversation
Introduce two new `provider` values (`*_cli` variants) that reuse existing flat-rate subscriptions instead of per-token API billing. The dispatcher flattens (system + messages) into one prompt and pipes it to the configured CLI binary; stdout becomes the assistant reply. Oversize argv falls back to stdin. Missing-binary and timeout cases degrade to a wait-action JSON instead of crashing the agent loop. Why: running many 24/7 agents in parallel is much cheaper on an existing subscription than on per-token billing, especially during heavy Think/Reflect cycles. The two per-token API paths are untouched and remain the default. Updates config.yaml, README and the two setup guides to document the new options and the API-vs-subscription trade-off.
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
Two new
providervalues that reuse existing flat-rate subscriptions instead of per-token API billing:claude_cli— shells out to the localclaude -pbinarycodex_cli— shells out to the localcodex execbinaryThe dispatcher flattens (system + messages) into one prompt, pipes it to the CLI, and returns stdout as the assistant reply. Per-token API paths (
anthropic,openai) are untouched and remain the default.Why
Running many 24/7 agents in parallel is much cheaper on an existing subscription than on per-token billing, especially during heavy Think / Reflect cycles.
Changes
core/agents.py— newSUPPORTED_PROVIDERSconstant + validation,_call_llmdispatch extended with two new branches, new helpers_flatten_for_cli,_run_cli,_call_claude_cli,_call_codex_cli. Defensive: missing binary, non-zero exit, and 10-min timeout all degrade to a structured wait-action JSON. Oversize argv falls back to stdin automatically.config.yaml— extended provider / model commentary to cover all four options.README.md— new API key vs. subscription table under Supported LLM Providers; added changelog entry under Recent Updates.AI_GUIDE.md,CLAUDE.md— Step 3 rewritten to ask both "which vendor" and "API or subscription", with a trade-off note.Test plan
python3 -c "from core.agents import AgentDispatcher"— all 4 providers construct; invalid provider raisesValueError.{"action":"wait",...}JSON without raising.provider: "claude_cli"locally and run one Think cycle on a toy project. (Manual — requires the CLI to be installed on the host.)