Aller au contenu principal

Anthropic LLM

Category: AI & ML
Node id: anthropic-llm

Anthropic Claude LLM inference with streaming and extended thinking support

What it does​

  • Anthropic Claude API integration with streaming support
  • Extended thinking (reasoning content) extraction
  • Multi-turn conversation support
  • Prompt caching with cache hit/creation token tracking
  • Custom base URL for API-compatible endpoints
  • System prompt customization

Use cases​

  • Production inference via Claude models (Sonnet, Opus, Haiku)
  • Complex reasoning tasks leveraging extended thinking
  • Streaming chat with real-time token delivery
  • Multi-turn clinical or analytical conversations

Runtime​

  • Performance tier: variable

Input ports​

NameTypeRequiredDescription
prompttextNoSingle user prompt
messagesjsonNoMulti-turn conversation messages array

Output ports​

NameTypeRequiredDescription
resultjsonNoMain result containing response, finish_reason, and reasoning
metadatajsonNoExecution metadata including tokens, chunk_count, stream, and stop_reason
successbooleanNoWhether the operation succeeded

Settings​

Basic​

SettingNameTypeRequiredDefaultAllowed valuesDescription
ModelmodelstringYesclaude-3-5-sonnet-20241022Anthropic model name
System Promptsystem_prompttextNo""System prompt to prepend
StreamstreambooleanNofalseEnable streaming responses

Auth​

SettingNameTypeRequiredDefaultAllowed valuesDescription
API Keyapi_keysecretNoAnthropic API key (or set ANTHROPIC_API_KEY env var)
Base URLbase_urlstringNo""Custom API base URL

Advanced​

SettingNameTypeRequiredDefaultAllowed valuesDescription
TemperaturetemperaturenumberNo1min 0; max 1Sampling temperature
Max Tokensmax_tokensnumberNo4096min 1Maximum tokens to generate
Top Ptop_pnumberNo1min 0; max 1Nucleus sampling parameter

Errors​

CodeDescription
API_KEY_MISSINGAnthropic API key not found in config or ANTHROPIC_API_KEY env var
MODEL_REQUIREDModel name must be specified
API_CALL_FAILEDAnthropic API request returned an error
INPUT_REQUIREDEither prompt or messages input must be provided

Runtime notes​

  • result.reasoning is only present when the model returns extended thinking content — check for its existence before wiring
  • When stream=true, metadata.chunks contains an array of deltas; when false, chunk_count is 0
  • API key falls back to ANTHROPIC_API_KEY env var if not set in config
  • Provide either prompt (single turn) or messages (multi-turn) — not both; prompt is wrapped with an optional system message

See Build any workflow for how to put nodes together and Ports, types and data flow for how port types connect.

Quelque chose n'est pas clair ? Envoyez vos commentaires sur la documentation par courriel.