LLM — API reference¶
call_claude
¶
call_claude(
prompt: str,
*,
system_prompt: str | None = None,
model: str = "haiku",
timeout: int | None = None,
retries: int = 0,
backoff_base: float = 2.0,
) -> str | None
Invoke claude -p --model <model> with the prompt via stdin.
| PARAMETER | DESCRIPTION |
|---|---|
prompt
|
The user prompt to send.
TYPE:
|
system_prompt
|
Optional system prompt prepended with a marker.
TYPE:
|
model
|
Model name passed to
TYPE:
|
timeout
|
Subprocess timeout in seconds.
TYPE:
|
retries
|
Number of retries on transient failure (default: 0).
TYPE:
|
backoff_base
|
Base for exponential backoff in seconds (default: 2.0).
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
str | None
|
Stripped stdout on success, or |