@spendgraph/llms
v0.15.0
Published
Read any LLM provider reply into one shape. Records usage through @spendgraph/sdk.
Maintainers
Readme
@spendgraph/llms
Read any LLM provider reply into one shape. Records usage through @spendgraph/sdk.
npm install @spendgraph/llmsimport { Llm } from "@spendgraph/llms";
const llm = new Llm({ client: anthropic, model: "claude-opus-5" });
const reply = await llm.call([{ role: "user", content: "Summarise this." }]);
reply.output;
reply.inputTokens;What you get
- Zero dependencies, no provider SDK imported. It takes plain objects and calls your client by duck typing.
- Six wire families, one shape back — Anthropic, OpenAI, Responses, Bedrock,
Gemini, Perplexity, and every gateway that copies one of them. The Claude
Code CLI's
claude -poutput reads the same way. - All six token counts on every reply, so they can be summed without guarding each one.
- Fallbacks for a bad day, and a retry for a provider that refuses over headroom it was never going to use.
- A history you can check before you send it —
unpairednames the tool calls nothing answered, which is what a strict provider rejects the whole request over.
Docs
| | | | --- | --- | | Overview | One call, and what is recorded | | Making a call | Options, fallbacks, paying for headroom | | Streaming | When usage arrives, and a broken stream | | Tools | The loop, and a truncated call | | Structured output | One schema, three providers | | Providers | Six shapes, and reading a reply yourself |
License
Apache-2.0
