File tree Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ " kilo-code " : patch
3+ ---
4+
5+ OpenRouter bring-your-own-key models now have much more accurate cost estimates.
Original file line number Diff line number Diff line change @@ -48,8 +48,11 @@ interface CompletionUsage {
4848 }
4949 total_tokens ?: number
5050 cost ?: number
51+ is_byok ?: boolean // kilocode_change
5152}
5253
54+ const BYOK_COST_MULTIPLIER = 20 // kilocode_change
55+
5356export class OpenRouterHandler extends BaseProvider implements SingleCompletionHandler {
5457 protected options : ApiHandlerOptions
5558 private client : OpenAI
@@ -169,7 +172,7 @@ export class OpenRouterHandler extends BaseProvider implements SingleCompletionH
169172 // and how to best support it.
170173 // cacheReadTokens: lastUsage.prompt_tokens_details?.cached_tokens,
171174 reasoningTokens : lastUsage . completion_tokens_details ?. reasoning_tokens ,
172- totalCost : lastUsage . cost || 0 ,
175+ totalCost : ( lastUsage . is_byok ? BYOK_COST_MULTIPLIER : 1 ) * ( lastUsage . cost || 0 ) , // kilocode_change byok
173176 }
174177 }
175178 }
You can’t perform that action at this time.
0 commit comments