Skip to content

Commit 3482548

Browse files
committed
feat: add OpenAI and Anthropic LLM providers
OpenAI provider supports any OpenAI-compatible API via configurable base URL, with SSE streaming and Bearer auth. Anthropic provider uses the Messages API with x-api-key auth and SSE event parsing. Both include timeout handling and cancellation support.
1 parent 5bec086 commit 3482548

6 files changed

Lines changed: 590 additions & 17 deletions

File tree

Cargo.lock

Lines changed: 140 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ toml = "0.9"
2727

2828
# Config & paths
2929
directories = "6.0"
30+
figment = { version = "0.10", features = ["toml", "env"] }
3031

3132
# HTTP client
3233
reqwest = { version = "0.13", features = ["json", "stream"] }

src/config.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,10 @@ pub struct Config {
9696
#[serde(default = "default_num_predict")]
9797
pub num_predict: u32,
9898

99+
/// Base URL for OpenAI-compatible APIs (default: https://api.openai.com/v1)
100+
#[serde(default)]
101+
pub openai_base_url: Option<String>,
102+
99103
/// Commit message format options
100104
#[serde(default)]
101105
pub format: CommitFormat,
@@ -140,6 +144,7 @@ impl Default for Config {
140144
timeout_secs: default_timeout_secs(),
141145
temperature: default_temperature(),
142146
num_predict: default_num_predict(),
147+
openai_base_url: None,
143148
format: CommitFormat::default(),
144149
}
145150
}

0 commit comments

Comments
 (0)