feat: add API-key subscription coding plan providers#1240
feat: add API-key subscription coding plan providers#1240guillaumegay13 wants to merge 9 commits intomnfst:mainfrom
Conversation
…on-coding-plans Feat/add api key subscription coding plans
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #1240 +/- ##
==========================================
+ Coverage 98.47% 98.55% +0.08%
==========================================
Files 92 94 +2
Lines 7528 7745 +217
Branches 2878 2929 +51
==========================================
+ Hits 7413 7633 +220
- Misses 88 90 +2
+ Partials 27 22 -5
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
Bundle ReportChanges will increase total bundle size by 7.89kB (1.53%) ⬆️. This is within the configured threshold ✅ Detailed changes
Affected Assets, Files, and Routes:view changes for bundle: manifest-frontend-esmAssets Changed:
Files in
Files in
|
There was a problem hiding this comment.
1 issue found across 48 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="packages/openclaw-plugin/subscription-capabilities/index.js">
<violation number="1" location="packages/openclaw-plugin/subscription-capabilities/index.js:79">
P2: Z.ai’s model IDs overlap with other subscription providers (e.g., `glm-5`), but this config omits `alwaysQualifyModelIds`. That leaves Z.ai models unqualified in `qualifyDiscoveredModelId`, so overlapping IDs can collide and route to the wrong provider. Add `alwaysQualifyModelIds: true` for Z.ai.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
There was a problem hiding this comment.
1 issue found across 48 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="packages/backend/src/common/utils/provider-inference.ts">
<violation number="1" location="packages/backend/src/common/utils/provider-inference.ts:5">
P1: `zai/` qualified models are not handled in the new internal prefix map, so they fall through to the generic `vendor/model -> openrouter` rule and can resolve to the wrong provider.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
|
One additional change in this PR is Kimi Code subscription support. This adds a dedicated
That is why the subscription manifests, backend routing/discovery, and frontend provider list now include |
- Register nano-gpt in subscription-capabilities, provider registry, endpoints, model fetcher, and frontend provider definitions - Add inline SVG icon in ProviderIcon.tsx - Add nano-gpt to INTERNAL_PROVIDER_PREFIX_MAP (backend + frontend) so model names like nano-gpt/vendor/model resolve correctly - Add nano-gpt to STREAM_USAGE_PROVIDERS so streaming responses include token usage via stream_options - Prevent zero-usage final SSE chunks from overwriting valid captured usage in pipeStream (fixes NanoGPT token reporting)
|
Added NanoGPT (https://nano-gpt.com/api) as it was requested by the community too. It's a subscription with an API key - similar to all the providers added in this PR. It serves a lot of models! |
SebConejo
left a comment
There was a problem hiding this comment.
Hey, thanks for the PR! I can't merge this as-is:
- API-key providers don't belong in Subscriptions. Connecnting ot the new providers from subscription tabs, suggest me to use standard API keys. We should use the subsctipion way.
- Kimi and Z.ai already exist (Moonshot provider -> Kimi).
- OpenCode-Go should not be here. they're other agents (alternative to OpenClaw). The vision is to support other agents besides OpenClaw in the future, not to route through as LLM providers.
- Adding 6 providers in a single PR makes review and
testing very wide. Each new provider (especially with OAuth) is a significant release on its own. Could we have 1 PR per provider instead?
|
Hey @SebConejo API-key providers don't belong in Subscriptions Kimi and Z.ai already exist (Moonshot provider -> Kimi) OpenCode-Go should not be here. they're other agents (alternative to OpenClaw). The vision is to support other agents besides OpenClaw in the future, not to route through as LLM providers. Adding 6 providers in a single PR makes review and testing very wide. Each new provider (especially with OAuth) is a significant release on its own. Could we have 1 PR per provider instead? |
Summary
opencode,opencode-go, andollama-cloudprovidersNotes for reviewers
mainupstream/mainand carries the full feature plus the later review/validation follow-up fixesValidation
npm test --workspace=packages/backend -- --runInBand src/common/constants/providers.spec.ts src/routing/model-discovery/model-discovery.service.spec.ts src/routing/routing.service.spec.ts src/otlp/services/trace-ingest.service.spec.ts src/routing/proxy/__tests__/provider-client.spec.ts src/routing/proxy/__tests__/proxy.controller.spec.tsnpm test --workspace=packages/frontend -- --run tests/components/ModelPickerModal.test.tsx tests/pages/Routing.test.tsx tests/components/ProviderKeyForm.test.tsx tests/services/providers.test.ts tests/services/routing-utils.test.tsnpm test --workspace=packages/openclaw-plugin -- --runInBand __tests__/hooks.test.ts __tests__/subscription-capabilities.test.tsChangeset
.changeset/add-zai-subscription.mdImpact
Summary by cubic
Adds API‑key subscription support for coding plans with new providers and tighter routing, billing, and usage tracking. Now includes
kimi(Kimi Code),zai,opencode,opencode-go,ollama-cloud, andnano-gpt, with provider‑qualified model IDs preserved end‑to‑end.New Features
kimi,zai,opencode,opencode-go,ollama-cloud,nano-gpt(subscription‑only where applicable).kimito an Anthropic‑compatible coding endpoint; routedzaisubscription calls to coding‑plan endpoints; curated catalogs (e.g., filteredopencode-go) and qualifiedprovider/modelIDs across discovery, routing, and pricing.input_tokens/output_tokensmapped to OpenAI fields); passthrough streaming usage fordeepseek,nano-gpt,ollama,ollama-cloud.Bug Fixes
nano-gptsubscription model IDs to avoid collisions; improved inference for provider‑qualified IDs.zai/...model IDs; stable provider resolution for duplicate model IDs; prefer cached models to avoid extra discovery; correct endpoint selection for subscription vs API key flows; acquire Postgres row lock before success dedup.Written for commit 7208299. Summary will update on new commits.