block / block/buzz

Kimi is only reachable as an ACP harness, not as an LLM provider for buzz-agent

Open
#3,853 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
32.7k
Forks
4.3k
Avg merge
1d 13h
Merged PRs (30d)
253

Description

## Summary

Kimi is reachable in Buzz today only as an **ACP harness** (`kimi acp`, `PresetHarness { id: "kimi", label: "Kimi Code" }` in `desktop/src-tauri/src/managed_agents/discovery/presets.rs`). There is no way to run the **native Buzz Agent harness on Kimi models** (K3 and friends) without hand-editing config files, even though Kimi ships an OpenAI-compatible endpoint that already satisfies Buzz's discovery contract.

I would like to add `kimi` as a first-class LLM provider for `buzz-agent`, mirroring the merged OpenRouter work in #1975.

## Current behaviour

Settings → Default harness `Buzz` → Provider `OpenAI-compatible` → paste a Kimi API key → **Model** dropdown shows `No models found`.

Cause: discovery calls `{OPENAI_COMPAT_BASE_URL}/models` and the var defaults to `https://api.openai.com/v1`:

```rust
// desktop/src-tauri/src/commands/agent_models.rs
fn openai_compatible_models_url_for_discovery(env: &BTreeMap) -> String {
let base_url = env_or_process_value(env, "OPENAI_COMPAT_BASE_URL")
.unwrap_or_else(|| "https://api.openai.com/v1".to_string());
format!("{}/models", base_url.trim_end_matches('/'))
}
```

The Kimi key against `api.openai.com` returns 401, so the list comes back empty. Injecting `OPENAI_COMPAT_BASE_URL=https://api.kimi.com/coding/v1` into `global-agent-config.json` by hand makes discovery and chat work, which confirms the wire format is compatible — it is purely a discoverability/configuration gap.

(#3798 adds a Base URL field for the generic `openai-compat` provider. That is complementary: this issue is about a named provider with a baked endpoint, model catalog and effort mapping, the same treatment OpenRouter got.)

## Endpoint facts (verified against the live API)

- `GET https://api.kimi.com/coding/v1/models` → `200`, returns `k3` (1M context, `think_efforts: ["low","high","max"]`, default `high`), `k3-256k`, `kimi-for-coding`, `kimi-for-coding-highspeed`.
- `POST /chat/completions` → standard OpenAI chat shape; `reasoning_effort` accepted; replies carry `reasoning_content` plus `usage.completion_tokens_details.reasoning_tokens`.
- Bearer auth, so `provider.required_env` / `bearer_auth` paths need no special-casing.

## Proposal

Follow the shape of #1975 (`feat: add first-class OpenRouter provider support`):

- `crates/buzz-agent/src/config.rs` — `Provider::Kimi`, resolve `"kimi"`, credential `KIMI_API_KEY`.
- `crates/buzz-agent/src/llm.rs` — default base URL `https://api.kimi.com/coding/v1` (overridable via `KIMI_BASE_URL`, so platform users can point at their own endpoint), OpenAI chat-completions wire format, `reasoning_content` handling.
- `desktop/src-tauri/src/commands/agent_models*.rs` + `managed_agents/readiness.rs` — live model discovery against `/models`, required-env wiring.
- `desktop/src/features/agents/ui/agentConfigOptions.tsx` — `{ id: "kimi", label: "Kimi" }` in `PERSONA_LLM_PROVIDER_OPTIONS` + `PROVIDER_CREDENTIAL_CONFIG` entry; effort table entry for the `low | high | max` triple.
- `crates/buzz-agent/README.md` + unit tests alongside the existing provider tests.

## Related

- #1975 — first-class OpenRouter provider (merged; the template used here)
- #3798 — Base URL field for the generic OpenAI-compatible provider (complementary, no overlap intended)
- #3084, #3700 — Kimi Code as an ACP *harness* (different layer: harness process vs. LLM provider for `buzz-agent`)
- #3560, #2053, #3152, #3055 — other pending first-class provider requests, listed for maintainer context on whether provider additions are wanted at all

## Offer

Happy to implement and open the PR (DCO signed off, Conventional Commit title, `just ci` green) if a maintainer confirms the approach — in particular whether the default endpoint should be the Kimi For Coding base (`https://api.kimi.com/coding/v1`) or the pay-per-token platform base, with the other reachable via `KIMI_BASE_URL`.

Contributor guide

Open the contributing guide

Research direction

Read the merged OpenRouter implementation from #1975 first, then trace the provider and discovery paths in crates/buzz-agent/src/config.rs, crates/buzz-agent/src/llm.rs, the desktop agent-model commands, readiness.rs, and agentConfigOptions.tsx. Add the Kimi provider, credentials, endpoint and effort mapping, model discovery, documentation, and unit tests; done means Kimi models appear and can be used without hand-editing config, with the existing provider tests and CI passing.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust, typescript
Domain
ai, backend-api-design, frontend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.