# language_models: Improve token counting for providers \(\#32853\) · gitcafe/zed

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

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

Visibility: public

Requested revision: ed4b29f80c971df820ad1477102ed4ccf034450f

Requested commit: ed4b29f80c971df820ad1477102ed4ccf034450f

Commit: ed4b29f80c971df820ad1477102ed4ccf034450f

Tree: ae82e69e611139da79837ba272081d573d58298b

Author: Umesh Yadav

Committer: GitHub

## Message

```
language_models: Improve token counting for providers (#32853)

We push the usage data whenever we receive it from the provider to make
sure the counting is correct after the turn has ended.

- [x] Ollama 
- [x] Copilot 
- [x] Mistral 
- [x] OpenRouter 
- [x] LMStudio

Put all the changes into a single PR open to move these to separate PR
if that makes the review and testing easier.

Release Notes:

- N/A
```

## Parents

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

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