Provider API Reference
The Provider API connects BindAI agents to external AI model services. Providers isolate vendor-specific model communication from the rest of the agent architecture, allowing agents to select different model providers while keeping application and agent logic largely independent of the underlying service. This page documents the current Provider API and provider architecture.Overview
A provider connects an agent’s model request to an external AI service. Conceptually:Provider Selection
BindAI uses a provider-and-model identifier when configuring an agent. The general format is:Supported Providers
The current BindAI provider ecosystem includes:- OpenAI
- Anthropic
- Google Gemini
- Groq
- Ollama
- OpenRouter
Configuring a Provider
Providers are normally selected through the agent configuration. For example:Provider Registry
BindAI maintains a provider registry for registered provider implementations. Conceptually:Provider Bootstrap
Provider registration is initialized through BindAI’s provider bootstrap mechanism. The CLI initializes the available provider packages before starting the application. This allows provider integrations to remain modular instead of requiring all provider implementations to be hard-coded into the core agent runtime.Request Lifecycle
A typical provider-backed agent execution follows this flow:Provider Responsibilities
A provider implementation can be responsible for concerns such as:- Model selection
- Request construction
- Authentication
- Communication with the external service
- Response handling
- Streaming
- Provider-specific error handling
- Provider-specific capabilities
Authentication
External providers generally require credentials. Typical configuration uses environment variables. Examples include:Environment Configuration
Provider credentials can be loaded through environment configuration. For example:Model Selection
A provider can expose access to multiple models. For example:Streaming
Providers can support streaming model responses. Conceptually:Structured Output
Provider capabilities can also affect structured-output behavior. An agent can request structured output using a supported schema. For example:Tool Calling
Providers can participate in model-driven tool calling. Conceptually:Provider and Memory
Memory is handled by BindAI’s memory layer rather than being a provider responsibility. Conceptually:Provider and Knowledge
Knowledge and retrieval are also separate from model-provider communication. An agent can combine:- A model provider
- Knowledge
- A retriever
- Memory
- Tools
Provider and Workflows
Workflows can coordinate agents that use different providers. For example:Provider Errors
External model services can fail for many reasons. Examples include:- Invalid credentials
- Invalid model identifiers
- Invalid requests
- Rate limits
- Network failures
- Service outages
- Unsupported capabilities
- Provider-side errors
Provider Independence
A major purpose of the provider layer is reducing vendor-specific coupling. Conceptually:- Model capabilities
- Context limits
- Tool calling
- Structured output
- Streaming
- Latency
- Rate limits
- Availability
Performance Considerations
Provider performance can vary significantly. Important considerations include:- Response latency
- Throughput
- Context-window size
- Model capability
- Streaming behavior
- Rate limits
- Service availability
- Cost
Custom Providers
BindAI’s provider architecture is designed to support additional provider implementations. A custom provider integration generally needs to:- Register with the provider system.
- Resolve a provider-model configuration.
- Communicate with the target model service.
- Convert requests into the service’s expected format.
- Convert responses into the format expected by BindAI.
- Handle provider-specific failures.
- Support relevant capabilities such as streaming where appropriate.
Provider Packages
Provider integrations are kept modular. Conceptually:Security
Provider integrations handle credentials and potentially sensitive model input. Applications should:- Keep API credentials out of source code.
- Use environment or secret-management systems.
- Use secure transport.
- Avoid logging credentials.
- Avoid unnecessarily logging sensitive prompts and responses.
- Restrict provider credentials to the required permissions.
- Rotate credentials according to organizational policy.
Testing Providers
Provider integrations should be tested at multiple levels. Useful tests include:- Provider registration
- Provider discovery
- Model configuration
- Request construction
- Response handling
- Streaming behavior
- Structured output
- Tool calling
- Invalid configuration
- Authentication failures
- Provider errors
Provider Configuration and Agent Logic
Provider configuration should remain separate from business logic. For example:API Accuracy
The Provider API should not be represented as though every provider exposes the same public Python class with identical methods. The current architecture is centered on:- Provider implementations
- Provider registration
- Provider discovery
- Provider-model identifiers
- Agent provider configuration
- Provider-specific capabilities
Best Practices
- Select providers through the
provider:modelconfiguration. - Keep credentials in environment or secret-management systems.
- Choose models based on actual application requirements.
- Test provider configuration before production use.
- Account for provider-specific capabilities.
- Avoid unnecessary vendor-specific logic in agents.
- Handle provider failures explicitly.
- Keep provider integrations modular.
- Monitor provider latency, limits, and availability.
- Do not assume all providers support identical model features.
Related APIs
The Provider API works closely with:- Agent
- AgentResult
- Tool
- Memory
- Knowledge
- Workflow
- Provider Registry
Summary
The Provider API is the abstraction layer between BindAI agents and external AI model services. The current architecture uses registered provider implementations andprovider:model identifiers to select the model service used by an agent.
Supported providers currently include OpenAI, Anthropic, Google Gemini, Groq, Ollama, and OpenRouter.
This separation allows BindAI applications to remain modular and portable while still accommodating provider-specific capabilities and differences.