mirror of
https://github.com/router-for-me/CLIProxyAPI.git
synced 2026-09-11 22:58:08 +08:00
- Add `ParsePluginExecutorResponseUsage` to extract token usage from non-streaming plugin responses across Claude, Gemini, Interactions, Antigravity, and OpenAI/Codex protocols. - Add `ObservePluginExecutorStreamUsage` to observe and aggregate token usage across streaming chunks. Closes: #5340
15 lines
497 B
Go
15 lines
497 B
Go
package handlers
|
|
|
|
import (
|
|
"github.com/router-for-me/CLIProxyAPI/v7/internal/runtime/executor/helps"
|
|
"github.com/router-for-me/CLIProxyAPI/v7/sdk/cliproxy/usage"
|
|
)
|
|
|
|
func parsePluginExecutorResponseUsage(protocol string, payload []byte) usage.Detail {
|
|
return helps.ParsePluginExecutorResponseUsage(protocol, payload)
|
|
}
|
|
|
|
func observePluginExecutorStreamUsage(protocol string, payload []byte, buffer *helps.StreamUsageBuffer) {
|
|
helps.ObservePluginExecutorStreamUsage(protocol, payload, buffer)
|
|
}
|