pub struct MatrixConfig {Show 13 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>,
}Expand description
Matrixcode configuration file structure. Field names align with Claude Code conventions.
Fields§
§provider: Option<String>LLM provider: “anthropic” or “openai”
api_key: Option<String>API key (Claude Code style: ANTHROPIC_AUTH_TOKEN)
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 (Claude Code style: ANTHROPIC_REASONING_MODEL)
compress_model: Option<String>Compress/haiku model (Claude Code style: ANTHROPIC_DEFAULT_HAIKU_MODEL)
fast_model: Option<String>Fast model
approve_mode: Option<String>Approve mode: “ask”, “auto”, “strict”
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 cc-switch settings file.
Sourcepub fn load() -> Self
pub fn load() -> Self
Load configuration with fallback chain. Priority: CLI args > ~/.matrix/config.json > ~/.claude/settings.json > env vars
Fields are merged: matrix config values take precedence, missing fields fall back to Claude settings, then to defaults/env vars.
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. Uses Claude Code style: ANTHROPIC_AUTH_TOKEN
Sourcepub fn get_model(&self, provider: &str) -> String
pub fn get_model(&self, provider: &str) -> String
Get model name, with fallback to environment variable. Uses Claude Code style: ANTHROPIC_MODEL
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. Uses Claude Code style: ANTHROPIC_BASE_URL
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