MCPcopy Create free account
hub / github.com/ephraimduncan/opencode-cursor / computeUsage

Function computeUsage

src/proxy.ts:831–836  ·  view source on GitHub ↗
(state: StreamState)

Source from the content-addressed store, hash-verified

829}
830
831function computeUsage(state: StreamState) {
832 const completion_tokens = state.outputTokens;
833 const total_tokens = state.totalTokens || completion_tokens;
834 const prompt_tokens = Math.max(0, total_tokens - completion_tokens);
835 return { prompt_tokens, completion_tokens, total_tokens };
836}
837
838function processServerMessage(
839 msg: AgentServerMessage,

Callers 2

makeUsageChunkFunction · 0.85
collectFullResponseFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected