Skip to main content

Module provider

Module provider 

Source
Expand description

Provider and model system.

Loads a built-in model catalog from models.json in this directory, overlays user overrides from ~/.rab/agent/models.json, and provides the right StreamProvider for each model’s API protocol.

Modules§

anthropic
Custom Anthropic Messages API provider that uses model_config.base_url and forwards model_config.headers — unlike yoagent’s AnthropicProvider which hardcodes https://api.anthropic.com and ignores headers.
compat
Rich compatibility flags matching pi’s OpenAICompletionsCompat structure. Deserialized from the compat field in models.json, then serialized into ModelConfig::headers["_rab_compat"] for our custom provider to read.
generate_models
rab generate-models subcommand.
models
models.json — parses built-in and user models.json files and constructs yoagent ModelConfigs with rich compat stored in headers.
oauth
OAuth provider trait and registry — matching pi’s OAuthProviderInterface.
openai_compat
Custom OpenAI-compatible streaming provider with pi-level compat support.

Structs§

ProviderRegistry
The provider registry — holds all known providers and their models.
ResolvedModel
A resolved model ready for use by the agent.

Functions§

calculate_cost
Calculate the USD cost components of a usage record given a model’s cost config.
get_agent_dir
Get the agent config directory (~/.rab/agent).