Skip to content

client.agentChat talks to a hosted agent from anywhere, and client.getUsage reads your spend - #15

Merged
chrisjleal merged 1 commit into
mainfrom
feat/agent-chat-and-usage
Nov 1, 2026
Merged

chrisjleal merged 1 commit into
mainfrom
feat/agent-chat-and-usage

Conversation

@chrisjleal

Copy link
Copy Markdown
Contributor

client.agentChat({ agentId, messages, onEvent }) posts one turn to /api/v1/agent/chat/turn as the named agent, streams its events and resolves with the final event: the answer, the records the agent read as citations, and the credits it spent. A refusal before the stream is an ApiError with its code. client.getUsage({ from, to }) reads the balance and spend by line and by UTC day.

Tests: 224 passed (7 new). Lint clean.

🤖 Generated with Claude Code

…tUsage reads your spend

agentChat posts one turn to /api/v1/agent/chat/turn as the named agent, streams its events to
onEvent and resolves with the final event: the answer, the records the agent read as
citations, and the credits it spent. A refusal before the stream is an ApiError with its code.
getUsage reads the balance and spend by line and by UTC day for any period. The README's
first screen shows the call.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@chrisjleal
chrisjleal merged commit f442ec0 into main Nov 1, 2026
1 check passed
@chrisjleal
chrisjleal deleted the feat/agent-chat-and-usage branch November 1, 2026 21:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant