# language_model: Split request methods into LanguageModelClient \(\#64794\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/933d8d93819c749a607e561883855a9b95c79cea)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: 933d8d93819c749a607e561883855a9b95c79cea

Requested commit: 933d8d93819c749a607e561883855a9b95c79cea

Commit: 933d8d93819c749a607e561883855a9b95c79cea

Tree: 74b7c293fa0a662950889e5cf197de87011bae99

Author: Mikayla Maki

Committer: GitHub

## Message

```
language_model: Split request methods into LanguageModelClient (#64794)

Follow-up to #64750. `LanguageModelProvider` mixes two concerns: serving
requests to a model, and offering models to Zed's registry, picker and
settings. Hosts that keep their own registry and UI but serve requests
through this API had to stub out the registry and UI methods
(`provided_models`, `default_model`, `authenticate`, `settings_view`,
…).

This splits the request methods into a new supertrait,
`LanguageModelClient`: `stream_completion`, `stream_completion_text`,
`stream_completion_tool`, `count_input_tokens`, `compact` and `api_key`,
with signatures, docs and default bodies unchanged.
`LanguageModelProvider: LanguageModelClient` keeps everything else. Each
provider's request methods move into a separate `impl
LanguageModelClient` block; no bodies change and no call sites change,
since supertrait methods remain callable on `dyn LanguageModelProvider`.
Provider-side sessions will live on `LanguageModelClient`.

Tested: `language_model`, `language_models`, `language_models_cloud`,
`copilot_chat`, `openai_subscribed`, `x_ai_subscribed`, and `agent` (753
tests), plus `cargo check --workspace --tests`.

Release Notes:

- N/A
```

## Parents

- [e91b82c106817f2419207ebf81f1da766698ac95](https://git.cafe/gitcafe/zed/commit/e91b82c106817f2419207ebf81f1da766698ac95?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/933d8d93819c749a607e561883855a9b95c79cea?format=markdown)
