Claude Chat Model (CLI) icon

Claude Chat Model (CLI)

Use Claude CLI (via @anthropic-ai/claude-agent-sdk) as a LangChain Chat Model

Claude Chat Model (CLI)

AI-generated

Summary

The Claude Chat Model (CLI) operation spawns the Claude CLI process with configured parameters, sends a prompt, and returns Claude's response as an AI message with optional tool calls and usage metadata. It supports stateless and stateful conversation modes, custom system instructions, tool restrictions, permission modes, budget limits, and streams or returns the full response based on settings. The node requires a claudeCliApi credential and the @anthropic-ai/claude-agent-sdk package. A background TokenRefreshService periodically checks and refreshes OAuth credentials when 75% of the token lifetime has elapsed.

Inputs

None.

Output shape

ai_languageModel

Returns AI message generations where each generation contains text content, tool_calls when bound tools are configured, response_metadata with model and usage, and additional_kwargs including claude sessionId. Stream mode yields ChatGenerationChunk objects token-by-token.

Links

Discussion