From 0902166f8afca81e5979822773556fbe82184e0b Mon Sep 17 00:00:00 2001 From: Sergei Bronnikov Date: Sat, 17 Jan 2026 16:58:34 +0000 Subject: [PATCH] tools function --- internal/provider/openai/cost.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/internal/provider/openai/cost.go b/internal/provider/openai/cost.go index 0a0932c..d31cc32 100644 --- a/internal/provider/openai/cost.go +++ b/internal/provider/openai/cost.go @@ -236,6 +236,7 @@ var AllowedTools = []string{ "code_interpreter", "file_search", + "function", } type tokenCounter interface { @@ -583,12 +584,10 @@ func (ce *CostEstimator) EstimateResponseApiToolCallsCost(tools []responsesOpena totalCost := 0.0 for _, tool := range tools { toolType := tool.Type - if toolType == "code_interpreter" { - continue - } cost, ok := OpenAiPerThousandCallsToolCost[extendedToolType(toolType, model)] if !ok { - return 0, fmt.Errorf("tool type %s is not present in the tool cost map provided", toolType) + // The permission check is performed in the middleware. The additional cost is taken from OpenAiPerThousandCallsToolCost + continue } totalCost += cost }