Jan is an open source alternative to ChatGPT that runs 100% offline on your computer.
fix: pass local server api to openclaw as provider
Vanalite9714ecda0976
diff --git a/src-tauri/src/core/openclaw/commands.rs b/src-tauri/src/core/openclaw/commands.rsindex 438665405..08836bdc1 100644--- a/src-tauri/src/core/openclaw/commands.rs+++ b/src-tauri/src/core/openclaw/commands.rs@@ -1243,6 +1243,11 @@ fn generate_default_config(input: Option<OpenClawConfigInput>) -> OpenClawConfigif let Some(base_url) = input.jan_base_url {config.models.providers.jan.base_url = base_url;}+ if let Some(api_key) = input.jan_api_key {+ if !api_key.is_empty() {+ config.models.providers.jan.api_key = api_key;+ }+ }}config@@ -1453,6 +1458,12 @@ pub async fn openclaw_configure(config_input: Option<OpenClawConfigInput>) -> Reexisting["models"]["providers"]["jan"] = models["providers"]["jan"].clone();}}+ // Always update the jan provider apiKey when an explicit key was provided+ // (i.e., the generated config has a non-default key from config_input.jan_api_key)+ if config.models.providers.jan.api_key != DEFAULT_JAN_API_KEY {+ existing["models"]["providers"]["jan"]["apiKey"] =+ serde_json::json!(config.models.providers.jan.api_key);+ }existing} else {defaultsdiff --git a/src-tauri/src/core/openclaw/models.rs b/src-tauri/src/core/openclaw/models.rsindex 790c11537..0d143b659 100644--- a/src-tauri/src/core/openclaw/models.rs+++ b/src-tauri/src/core/openclaw/models.rs@@ -251,6 +251,9 @@ pub struct OpenClawConfigInput {pub port: Option<u16>,/// Optional bind addresspub bind: Option<String>,+ /// Optional API key for Jan's local API server+ #[serde(rename = "janApiKey")]+ pub jan_api_key: Option<String>,}// ============================================diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rsindex ad9cebc5b..f1860e4e4 100644--- a/src-tauri/src/main.rs+++ b/src-tauri/src/main.rs@@ -176,12 +176,13 @@ fn run_openclaw_cli(cli: OpenClawCli) {}}- OpenClawCommands::Configure { port, bind, jan_base_url, model_id } => {+ OpenClawCommands::Configure { port, bind, jan_base_url, model_id, jan_api_key } => {let config_input = app_lib::core::openclaw::models::OpenClawConfigInput {port,bind,jan_base_url,model_id,+ jan_api_key,};let result = rt.block_on(async {diff --git a/src-tauri/src/openclaw_cli.rs b/src-tauri/src/openclaw_cli.rsindex 5e39542b3..a7b36b16e 100644--- a/src-tauri/src/openclaw_cli.rs+++ b/src-tauri/src/openclaw_cli.rs@@ -40,6 +40,9 @@ pub enum OpenClawCommands {/// Model ID to use (sets agents.defaults.model.primary)#[arg(long)]model_id: Option<String>,+ /// Jan API key for authentication+ #[arg(long)]+ jan_api_key: Option<String>,},/// Restart the OpenClaw gatewayRestart,diff --git a/web-app/src/containers/dialogs/EnableProgressDialog.tsx b/web-app/src/containers/dialogs/EnableProgressDialog.tsxindex 270b634d1..4643e2767 100644--- a/web-app/src/containers/dialogs/EnableProgressDialog.tsx+++ b/web-app/src/containers/dialogs/EnableProgressDialog.tsx@@ -112,8 +112,9 @@ export function EnableProgressDialog({setIsRunning(true)try {+ const { apiKey } = useLocalApiServer.getState()const result = await invoke<EnableResult>('openclaw_enable', {- configInput: null,+ configInput: apiKey ? { janApiKey: apiKey } : null,})if (result.success) {