Feature: Claude Agent SDK provider for subscription-backed credit
Summary Add a claude_agent_sdk provider that routes inference through claude -p (or @anthropic-ai/claude-agent-sdk) instead of the Anthropic HTTP API, so subscribers can use OpenHuman against their Claude plan's Agent SDK credit.
Why Starting June 15, 2026, Anthropic Pro/Max/Team/Enterprise plans include a separate monthly credit for Agent SDK and claude -p usage, including third-party apps built on the SDK (Help Center): Pro: $20/mo Max 20x: $200/mo Team Premium: $100/seat/mo
The credit is only redeemable through the Agent SDK surface — not generic HTTP API calls with ANTHROPIC_API_KEY. Today, OpenHuman's Anthropic path goes through the HTTP API, so subscribers effectively pay twice (flat sub + per-token charges) or skip OpenHuman for Claude work. An SDK provider unlocks the credit for OpenHuman users.
Proposed approach: New claude_agent_sdk provider in src/openhuman/providers/ Spawn claude -p as a child process; communicate over stdin/stdout JSON-RPC (control_request / control_response with request_id multiplexing) Map OpenHuman tool calls onto the SDK's can_use_tool callback so existing approvals still apply Don't handle OAuth tokens directly — assume user has run claude setup-token; CLI manages CLAUDE_CODE_OAUTH_TOKEN refresh Doctor check for claude binary + token status
Config: toml [providers.claude_agent_sdk] enabled = true binary = "claude" model = "claude-sonnet-4-6" permission_mode = "default"
Out of scope (first PR) Migrating other providers Composio/integrations changes (SDK provider should be transparent to them) Local fallback when credit is exhausted (good follow-up)
Open questions
- Spawn claude -p as a subprocess, or call the TS SDK directly from the existing node_runtime module?
- Credit-exhausted behavior — fall back to a configured secondary provider, or hard-fail with a clear message?
References Help Center: Agent SDK with your Claude plan Agent SDK docs Subprocess protocol reference Prior art: ai-sdk-provider-claude-code
Contribution Can help with design discussion and testing the subscription credit flow once it ships. Would need a Rust-fluent co-contributor for the core subprocess and provider work.
@Al629176 can I work on this or the team will handle it
@Al629176 can I work on this or the team will handle it
Please feel free to take it up @aryash45 thanks.
@aryash45 Will be glad to assist with design validation/testing.
Right thanks @Fiztech-ai grateful for your assistance
@Al629176 can you please answer the above open questions mentioned in the issue description that would be a great help also @Fiztech-ai can you please mention your requirements for the design thank you
@aryash45 thanks for picking this up! Here are the design requirements, listed roughly in priority order.
One upstream note before the list: I think the main design decision is whether this should be implemented as a Rust-side provider in src/openhuman/providers/ that shells out to claude -p, or as a TypeScript-backed provider using @anthropic-ai/claude-agent-sdk through the existing app/node runtime path. My preference is the TS SDK path if it fits the current architecture, because the SDK already handles the claude subprocess, exposes typed messages/result metadata, and should keep the OpenHuman-side surface smaller. That said, I understand the Rust core is the authoritative business-logic layer, so I'd like the team's view before treating this as settled.
Must-have (P0)
-
Subscription-only auth path. This provider must use the Claude CLI / Agent SDK subscription-auth path, relying on the existing Claude Code OAuth setup. No
ANTHROPIC_API_KEYcodepath in this provider; that would defeat the purpose of using subscription-backed Agent SDK credit. Ifclaude setup-tokenhas not been completed, fail fast with a clear setup message pointing the user to that command. -
Token safety. Never display, persist unnecessarily, or log
CLAUDE_CODE_OAUTH_TOKEN. Any stderr/debug logs should be redacted. -
Doctor check. Pre-flight verification should separately report:
claudebinary found on PATH or configured pathclaude --versionreturns sane output- subscription/OAuth auth appears usable
Surface each as a separate pass/fail.
-
Streaming input mode. Use the SDK's streaming/input mode rather than a single-shot wrapper, so OpenHuman can preserve its existing streaming UX and agent loop behavior.
-
Tool approvals reconciled, not duplicated. Map the SDK permission/
canUseToolflow into OpenHuman's existing approval system. The user should see one approval prompt per tool call in OpenHuman's UI, not a second prompt from Claude Code/SDK underneath. If a Claude permission mode bypasses this callback path, it should not be enabled by default.
Should-have (P1)
-
Model selection. Config-driven with a sensible default, e.g.
claude-sonnet-4-6if available. Allow explicit model override rather than hardcoding a short allowlist, because model availability changes. -
Permission mode passthrough, but safely constrained. Expose supported modes in config only where they are compatible with OpenHuman's approval model.
defaultshould be the default.acceptEditscan be supported if edits still map cleanly into OpenHuman's approval/visibility model.bypassPermissionsshould either be hidden behind an explicit danger flag or treated as incompatible unless we confirm tool approval mediation still works. -
Cost visibility, best effort only. Surface SDK
result.modelUsagefields such as input/output/cache tokens andcostUSDin OpenHuman's cost module, clearly labeled as a local/client-side estimate. Do not claim to show remaining subscription credit or authoritative billing balance unless Anthropic exposes that via an official API. -
Graceful subprocess/SDK failure. A stuck SDK/
claudeprocess should fail through OpenHuman's existing heartbeat/retry/error path rather than hanging the agent loop. Capture stderr to redacted logs for debugging.
Nice-to-have (P2)
-
Configurable binary path. Default
binary = "claude", but allow override for non-standard installs such as/opt/homebrew/bin/claudeor custom Node/package-manager setups. -
max_budget_usdexposure. If supported by the SDK, expose a per-run cost cap so users can set a hard ceiling for an agent run.
Non-requirements / out of scope for first PR
- Migrating or replacing the existing Anthropic HTTP provider — keep both and let users choose.
- Automatic fallback between providers when subscription credit is exhausted. That is a good follow-up issue, but first PR should hard-fail clearly.
- Composio/tools layer changes. The provider should be transparent to that layer.
- Authoritative billing API integration. Client-side estimates are enough for first PR.
Validation I can offer
I can test the end-to-end flow on a Claude subscription plan once a build is available:
setup-tokenflow- confirmation that requests draw from Agent SDK/subscription credit rather than the Anthropic HTTP API key path
- streaming behavior
- no double approval prompts
- doctor checks under broken states such as missing binary, missing/expired token, and invalid binary path
For @Al629176 , two meta-questions on top of the issue-body questions:
-
Does the team prefer this as a TS SDK-backed provider routed through the existing app/node runtime path, or as a Rust-side provider in
src/openhuman/providers/that shells out toclaude -p? -
UX preference: should this appear alongside the existing Anthropic HTTP provider as a separate Settings → AI provider, or as a mode/auth toggle on the existing Anthropic provider? My preference is a separate provider because API-key billing and subscription-backed Agent SDK credit are materially different auth/billing paths.
@Fiztech-ai I think I should work on this after @Al629176 ans these two questions that would provide more clarity what do you think
@Fiztech-ai i think the team already figured out as i can see the pr
from team open human member