pub struct MatrixConfig {Show 18 fields
pub provider: Option<String>,
pub api_key: Option<String>,
pub base_url: Option<String>,
pub model: Option<String>,
pub think: bool,
pub markdown: bool,
pub max_tokens: u32,
pub context_size: Option<u32>,
pub multi_model: Option<bool>,
pub plan_model: Option<String>,
pub compress_model: Option<String>,
pub fast_model: Option<String>,
pub approve_mode: Option<String>,
pub extra_headers: Option<HashMap<String, String>>,
pub mcp_servers: Option<HashMap<String, McpServerConfig>>,
pub lsp_servers: Option<HashMap<String, LspServerConfig>>,
pub enable_lsp: bool,
pub verify_strategy: Option<String>,
}Expand description
Matrixcode configuration file structure. Uses universal naming (no ANTHROPIC_ prefix).
Fields§
§provider: Option<String>LLM provider: “anthropic” or “openai”
api_key: Option<String>API key (universal naming, also supports ANTHROPIC_AUTH_TOKEN alias)
base_url: Option<String>Base URL for API endpoint
model: Option<String>Main model name
think: boolEnable extended thinking
markdown: boolEnable markdown rendering
max_tokens: u32Maximum output tokens
context_size: Option<u32>Context size
multi_model: Option<bool>Multi-model configuration
plan_model: Option<String>Plan/reasoning model
compress_model: Option<String>Compress/haiku model
fast_model: Option<String>Fast model
approve_mode: Option<String>Approve mode: “ask”, “auto”, “strict”
extra_headers: Option<HashMap<String, String>>Extra HTTP headers to add to API requests Format: {“Header-Name”: “header-value”}
mcp_servers: Option<HashMap<String, McpServerConfig>>MCP servers configuration Format: {“server_name”: McpServerConfig}
lsp_servers: Option<HashMap<String, LspServerConfig>>LSP servers configuration Format: {“server_name”: LspServerConfig}
enable_lsp: boolEnable LSP tools globally If false, LSP servers won’t be loaded and LSP tools won’t be available
verify_strategy: Option<String>Code verification strategy for write operations Options: “none” (no verification), “post” (verify after write, default), “pre” (verify before write, block if errors), “pre-quick” (quick syntax check before, full check after) When “pre” is enabled, invalid code will be blocked and errors returned to AI for automatic correction.
Implementations§
Source§impl MatrixConfig
impl MatrixConfig
Sourcepub fn matrix_config_path() -> Option<PathBuf>
pub fn matrix_config_path() -> Option<PathBuf>
Path to matrixcode config file.
Sourcepub fn claude_settings_path() -> Option<PathBuf>
pub fn claude_settings_path() -> Option<PathBuf>
Path to Claude Code settings file.
Sourcepub fn load() -> Self
pub fn load() -> Self
Load configuration with fallback chain. Priority: env vars > ~/.matrix/config.json > ~/.claude/settings.json > defaults
Sourcepub fn get_api_key(&self, provider: &str) -> Option<String>
pub fn get_api_key(&self, provider: &str) -> Option<String>
Get API key, with fallback to environment variable. Universal env var: API_KEY (also supports ANTHROPIC_AUTH_TOKEN for compatibility)
Sourcepub fn get_model(&self, provider: &str) -> String
pub fn get_model(&self, provider: &str) -> String
Get model name, with fallback to environment variable. Universal env var: MODEL (also supports ANTHROPIC_MODEL for compatibility)
Sourcepub fn get_base_url(&self, provider: &str) -> String
pub fn get_base_url(&self, provider: &str) -> String
Get base URL, with fallback to environment variable. Universal env var: BASE_URL (also supports ANTHROPIC_BASE_URL for compatibility)
Sourcepub fn is_api_configured(&self) -> bool
pub fn is_api_configured(&self) -> bool
Check if API is configured.
Sourcepub fn resolve_api_key(&self) -> Option<String>
pub fn resolve_api_key(&self) -> Option<String>
Get API key with fallback chain (public for subagent use)
Sourcepub fn resolve_base_url(&self) -> Option<String>
pub fn resolve_base_url(&self) -> Option<String>
Get base URL with fallback chain (public for subagent use)
Sourcepub fn resolve_provider_type(&self, model: &str) -> ProviderType
pub fn resolve_provider_type(&self, model: &str) -> ProviderType
Resolve provider type from config or infer from model (public for subagent use)
Sourcepub fn create_provider_from_env() -> Result<Arc<dyn Provider>>
pub fn create_provider_from_env() -> Result<Arc<dyn Provider>>
Create a Provider instance from configuration. Useful for tools that need AI capabilities but don’t have an injected provider.
Trait Implementations§
Source§impl Clone for MatrixConfig
impl Clone for MatrixConfig
Source§fn clone(&self) -> MatrixConfig
fn clone(&self) -> MatrixConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more