Skip to main content
ZeroClaw’s provider system lets you add any LLM backend in ~30 lines of code. Providers handle communication with language models and expose a uniform interface to the agent.

Overview

Providers implement the Provider trait, which defines a simple contract:

Step-by-Step Guide

Complete Example

Here’s the full implementation from examples/custom_provider.rs:

Advanced Features

Error Handling

Providers should return descriptive errors:

Streaming Support

For streaming responses, implement chat_stream:

Authentication

Handle API keys securely:

Best Practices

Focus on API communication. Don’t add business logic — that belongs in the agent orchestration layer.
Implement exponential backoff for rate-limited APIs:
Use masked logging for credentials:
Use integration tests with real (or mocked) API calls:

Next Steps

Creating Channels

Learn how to add messaging platform support

Creating Tools

Give your agent new capabilities