API Reference
Complete reference documentation for the Claif API, including all public classes, methods, and utilities.
Core API
Client Classes
ClaifClient
- Main client for interacting with providersAsyncClient
- Async interface for concurrent operationsProvider
- Abstract base class for all providers
Configuration
Config
- Main configuration classClaifOptions
- Query options and settingsProviderOptions
- Provider-specific configuration
Message Types
Message
- Base message typeTextBlock
- Text content blockToolUseBlock
- Tool usage blockContentBlock
- Generic content block
CLI Interface
Commands
claif query
- Send queries to providersclaif config
- Manage configurationclaif list
- List available providersclaif server
- Start MCP server
Options
--provider
- Select specific provider--verbose
- Enable verbose logging--config
- Specify config file--timeout
- Set request timeout
Utility Functions
Formatting
format_response()
- Format provider responsesformat_metrics()
- Format performance metrics
Error Handling
ClaifError
- Base exception classProviderError
- Provider-specific errorsConfigurationError
- Configuration errorsValidationError
- Input validation errors
MCP Server
FastMCP Integration
start_mcp_server()
- Start the MCP serverToolHandler
- Handle MCP tool requestsServerConfig
- MCP server configuration
Navigation
- Core Classes - Main API classes and methods
- CLI Reference - Command-line interface
- Error Types - Exception hierarchy
- Utilities - Helper functions and tools
- MCP Server - Model Context Protocol server