Files
CLIProxyAPI/internal/runtime/executor/helps/model_capabilities.go
hkfires b9971ee3df feat(sdk): add Home credential capabilities and quota APIs
Use Home credential options as authoritative model capability
configuration for compat handling and prompt cache behavior.

Expose quota provider operations through the public plugin host API.
2026-09-28 19:03:21 +08:00

33 lines
1.5 KiB
Go

package helps
import (
"github.com/router-for-me/CLIProxyAPI/v8/internal/thinking"
cliproxyauth "github.com/router-for-me/CLIProxyAPI/v8/sdk/cliproxy/auth"
cliproxyexecutor "github.com/router-for-me/CLIProxyAPI/v8/sdk/cliproxy/executor"
)
// APIKeyModelIsCompat reports whether the selected API-key model enables
// compatibility handling for Claude thinking blocks.
func APIKeyModelIsCompat(req cliproxyexecutor.Request) bool {
modelInfo, ok := cliproxyauth.ResolvedModelInfo(req)
return ok && modelInfo != nil && modelInfo.IsCompat
}
// ApplyRequestThinking preserves the registry lookup path unless the auth
// manager bound authoritative model capabilities to this execution attempt.
func ApplyRequestThinking(body []byte, req cliproxyexecutor.Request, opts cliproxyexecutor.Options, fromFormat, toFormat, provider string, normalizedUpdatesChanged ...bool) ([]byte, error) {
originalSource := opts.OriginalRequest
if len(originalSource) == 0 {
originalSource = req.Payload
}
source := req.Payload
if len(source) == 0 {
source = opts.OriginalRequest
}
summaryConfig := translatedRequestSummaryConfig(body, req.Payload, originalSource, req.Model, fromFormat, toFormat)
if modelInfo, ok := cliproxyauth.ResolvedModelInfo(req); ok {
return thinking.ApplyThinkingWithModelInfoAndSummary(body, source, req.Model, fromFormat, toFormat, provider, modelInfo, summaryConfig, normalizedUpdatesChanged...)
}
return thinking.ApplyThinkingWithSourceAndSummary(body, source, req.Model, fromFormat, toFormat, provider, summaryConfig, normalizedUpdatesChanged...)
}