hx login custom: store OpenAI-compat API key in auth.json

This commit is contained in:
hermes committed 2026-10-07 10:30:18 +00:00
1 parent 1952cb41c3
commit 9b9718e22e
3 files changed
+83 -18

No files matched your search

+2 -2
View File
@@ -53,7 +53,7 @@ enum Mode {
#[derive(Subcommand)]
enum Cmd {
/// Log in with a Claude Pro/Max or ChatGPT Plus/Pro subscription.
/// Log in with a Claude Pro/Max or ChatGPT Plus/Pro subscription; `custom` asks for an API key.
Login { provider: Kind },
/// Remove stored credentials for a provider.
Logout { provider: Kind },
@@ -290,7 +290,7 @@ fn provider(k: Kind) -> hx_ai::Result<Arc<dyn Provider>> {
.get()
.cloned()
.ok_or_else(|| hx_ai::Error::Http("no [openai_compat] in config.toml".into()))?;
let c = hx_ai::openai_compat::OpenAiCompat::new(cfg)?;
let c = hx_ai::openai_compat::OpenAiCompat::new(cfg, hx_ai::auth::stored_key())?;
Arc::new(match std::env::var("HX_BASE_URL") {
Ok(u) => c.with_base_url(u),
Err(_) => c,