Providers¶
The contract¶
Bases: Protocol
Any async text-in/text-out LLM endpoint.
Implement this with your SDK of choice (or plain HTTP) and pass it to
:class:toolloop.Agent. No tool-use support is required or expected —
that is the whole point of the framework.
complete(messages)
async
¶
Render messages and return the model's text response.
OpenAI-compatible endpoints¶
Implements toolloop's one-method provider contract.
last_usage()
¶
Usage of the last response as reported by the SDK (tokens, etc.).
OpenRouter¶
Implements toolloop's one-method provider contract via OpenRouter.
last_usage()
¶
Usage of the last response as reported by OpenRouter (tokens, cost...).
Anthropic¶
Implements toolloop's one-method provider contract.
last_usage()
¶
Usage of the last response as reported by the SDK (tokens, etc.).
Note
Adapters are installed via extras: pip install "toolloop[openai]" /
pip install "toolloop[anthropic]". Importing one without its SDK
raises an ImportError telling you which extra to install.