Problem
When using a proxy provider like LiteLLM, the modelID returned by the session API reflects the proxy's model name (e.g., litellm-local/qwen3.6-plus) rather than the original provider prefix (e.g., alibaba-cn/qwen3.6-plus).
The isAlibabaModelId() function only matches models starting with alibaba/ or alibaba-cn/, so local request counting never triggers for proxied models.
Root Cause
plugin.js:1389 — isAlibabaModelId(model) checks:
normalized.startsWith("alibaba/") || normalized.startsWith("alibaba-cn/")
But when routed through LiteLLM, sessionMeta.modelID = litellm-local/qwen3.6-plus, which doesn't match.
Impact
recordAlibabaCodingPlanCompletion() is never called
alibaba-coding-plan-local-quota.json recent array stays empty
- Users with proxy setups cannot track local request counts
Suggested Solutions
Option A: Configurable model ID mapping
Add a config option to map custom model prefixes to provider quota tracking:
{
"modelIdMapping": {
"litellm-local/qwen3.6-plus": "alibaba-coding-plan"
}
}
Option B: Provider-based matching fallback
When modelID doesn't match any known prefix, fall back to providerID from sessionMeta to determine which quota tracker to use.
Option C: Wildcard/pattern matching in isAlibabaModelId
Allow configurable regex or wildcard patterns for model ID matching.
Environment
- opencode-quota: v3.8.7
- opencode: v1.15.4
- Provider: LiteLLM proxy routing to Alibaba Coding Plan
Problem
When using a proxy provider like LiteLLM, the
modelIDreturned by the session API reflects the proxy's model name (e.g.,litellm-local/qwen3.6-plus) rather than the original provider prefix (e.g.,alibaba-cn/qwen3.6-plus).The
isAlibabaModelId()function only matches models starting withalibaba/oralibaba-cn/, so local request counting never triggers for proxied models.Root Cause
plugin.js:1389—isAlibabaModelId(model)checks:But when routed through LiteLLM,
sessionMeta.modelID=litellm-local/qwen3.6-plus, which doesn't match.Impact
recordAlibabaCodingPlanCompletion()is never calledalibaba-coding-plan-local-quota.jsonrecentarray stays emptySuggested Solutions
Option A: Configurable model ID mapping
Add a config option to map custom model prefixes to provider quota tracking:
{ "modelIdMapping": { "litellm-local/qwen3.6-plus": "alibaba-coding-plan" } }Option B: Provider-based matching fallback
When
modelIDdoesn't match any known prefix, fall back toproviderIDfromsessionMetato determine which quota tracker to use.Option C: Wildcard/pattern matching in
isAlibabaModelIdAllow configurable regex or wildcard patterns for model ID matching.
Environment