TheDocumentation Index
Fetch the complete documentation index at: https://docs.stellartools.dev/llms.txt
Use this file to discover all available pages before exploring further.
@stellartools/langchain-adapter package wraps any LangChain language model with metered billing. It checks credit balance before each call and charges by token usage after.
Install
Usage
Pass your config and a base model tocreateMeteredModel. Then call it with a customerId as the first argument, followed by the usual LangChain arguments.
Config options
Your StellarTools API key.
Credit product ID to charge for model usage.
Available methods
| Method | Description |
|---|---|
invoke(customerId, input, options?) | Single call; charges by token usage. |
stream(customerId, input, options?) | Streaming; charges after stream ends. |
batch(customerId, inputs, options?) | Batch calls; charges by total usage. |
streamEvents(customerId, input, options?) | Stream events; charges on model end. |

