dsh-unified-router 0.7.0 → 0.7.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
- # API Key 渠道(Agnes / 云知声 / 千帆 Token Plan / 阿里云百炼)
1
+ # API Key 渠道(Agnes / 云知声 / 千帆 Token Plan / 阿里云百炼 / Step Plan)
2
2
 
3
3
  本文是 API Key 类渠道的接口契约:宿主侧管理器、模型设置、推理适配器、渠道规格与 RPC 投影。
4
- 四家 API Key 渠道共用同一套实现,差异只在 `lib/apikey-providers.js` 的规格对象里。
4
+ 五家 API Key 渠道共用同一套实现,差异只在 `lib/apikey-providers.js` 的规格对象里。
5
5
 
6
6
  ## 1. 渠道事实(实测与官方文档)
7
7
 
@@ -89,6 +89,16 @@
89
89
  | 控制台额度 | 专属 `sk-sp-` Key 只授权推理;浏览器登录 `https://bailian.console.aliyun.com/cn-beijing?tab=plan`(或粘贴 Cookie,存 `UNIFIED_ROUTER_BAILIAN_CONSOLE`),两步取数:① GET 控制台页提取 `SEC_TOKEN`;② POST `BroadScopeAspnGateway` 调 `zeldaHttp.apikeyMgr./tokenplan/personal/api/v2/usage`(**严禁硬编码 `switchAgent`**),按 `per5HourPercentage` / `per1WeekPercentage` / `per1MonthPercentage` 投影为百分比窗口(`window-percent` / `weekly-percent` / `monthly-percent`) | 控制台网关实测协议(参考 `can1357/oh-my-pi#12260`) |
90
90
  | 限流/耗尽 | `429 Requests rate limit exceeded` / `Throttling*` 记限速;`429 insufficient_quota` 为套餐额度耗尽不记短时限速 | [Token Plan FAQ](https://help.aliyun.com/zh/model-studio/token-plan-faq) |
91
91
 
92
+ ### 阶跃星辰 Step Plan(`stepfun`)
93
+
94
+ | 项 | 值 | 来源 |
95
+ |---|---|---|
96
+ | 端点 | OpenAI 兼容 `https://api.stepfun.com/step_plan/v1`(`POST /step_plan/v1/chat/completions`),Step Plan API Key Bearer 鉴权 | [推理模型接入](https://platform.stepfun.com/docs/zh/step-plan/integrations/reasoning-api)(2026-11-04) |
97
+ | 目录 | `GET /step_plan/v1/models`(实测无 Key 返回 401,端点存在),过滤 `stepaudio*`/`step-tts*`/`step-asr*`/`step-1x*`/`step-video*`,空表回落官方兜底清单 | 2026-11-26 端点探针 + 官方文档 |
98
+ | 模型 | `step-5-preview`(1M / 65536,多模态)、`step-3.7-flash`(256K,多模态)、`step-3.5-flash-2603`(256K)、`step-3.5-flash`(256K)、`step-router-v1` | [推理模型接入](https://platform.stepfun.com/docs/zh/step-plan/integrations/reasoning-api) |
99
+ | 思考 | OpenAI 协议三档 `reasoning_effort: 'low' \| 'medium' \| 'high'`(默认 `medium`,无 `off` 档);`step-router-v1` 不下发 | [推理模型接入](https://platform.stepfun.com/docs/zh/step-plan/integrations/reasoning-api) |
100
+ | 控制台额度 | 浏览器登录直达 `https://platform.stepfun.com/step-plan`(未登录自动跳账号中心并在回跳后刷新平台域 `Oasis-Token`)或粘贴 Cookie / 裸 `Oasis-Token`(存 `UNIFIED_ROUTER_STEPFUN_CONSOLE`),调 Connect-JSON `POST /api/step.openapi.devcenter.Dashboard/QueryStepPlanRateLimit`,按 `*_left_rate`(剩余比例,0+0 视为无窗口)投影为 `window-percent` / `weekly-percent` / `monthly-percent` | 控制台协议(参考 `yetone/magpie` `stepfun_plan.go` 与 `dsh-musage-card`) |
101
+
92
102
  ### 控制台额度与限速提醒
93
103
 
94
104
  - 控制台会话来源:设置页浏览器登录/粘贴(存凭据引用,见 §1.3),或宿主启动环境变量 `UNIFIED_ROUTER_AGNES_CONSOLE_TOKEN`(Agnes)/ `UNIFIED_ROUTER_UNISOUND_CONSOLE_COOKIE`(云知声,作回退)。推理仍使用原 API Key。
@@ -635,7 +635,6 @@ const bailianRow = id => {
635
635
  reasoning: efforts.length > 0,
636
636
  efforts: [...efforts],
637
637
  defaultEffort: known?.defaultEffort,
638
- ...(known?.free ? { free: true } : {}),
639
638
  }
640
639
  }
641
640
 
@@ -796,7 +795,186 @@ const bailian = {
796
795
  },
797
796
  }
798
797
 
799
- export const APIKEY_PROVIDERS = Object.freeze({ agnes, unisound, qianfan, bailian })
798
+ /* --------------------- 阶跃星辰 Step Plan(国内) --------------------- */
799
+
800
+ // 官方文档:
801
+ // - 推理模型接入与支持模型:https://platform.stepfun.com/docs/zh/step-plan/integrations/reasoning-api(2026-11-04)
802
+ // - 控制台额度:Connect-JSON `POST /api/step.openapi.devcenter.Dashboard/QueryStepPlanRateLimit`
803
+ const STEPFUN_EFFORTS = ['low', 'medium', 'high']
804
+ const STEPFUN_NON_CHAT_PREFIXES = ['stepaudio', 'step-tts', 'step-asr', 'step-1x', 'step-video']
805
+
806
+ const STEPFUN_SPECS = {
807
+ 'step-5-preview': {
808
+ name: 'Step 5 Preview', context: 1_048_576, output: 65_536, attachment: true,
809
+ efforts: STEPFUN_EFFORTS, defaultEffort: 'medium',
810
+ },
811
+ 'step-3.7-flash': {
812
+ name: 'Step 3.7 Flash', context: 262_144, output: 0, attachment: true,
813
+ efforts: STEPFUN_EFFORTS, defaultEffort: 'medium',
814
+ },
815
+ 'step-3.5-flash-2603': {
816
+ name: 'Step 3.5 Flash 2603', context: 262_144, output: 0, attachment: false,
817
+ efforts: STEPFUN_EFFORTS, defaultEffort: 'medium',
818
+ },
819
+ 'step-3.5-flash': {
820
+ name: 'Step 3.5 Flash', context: 262_144, output: 0, attachment: false,
821
+ efforts: STEPFUN_EFFORTS, defaultEffort: 'medium',
822
+ },
823
+ 'step-router-v1': {
824
+ name: 'Step Router V1', context: 0, output: 0, attachment: false,
825
+ efforts: [], defaultEffort: undefined,
826
+ },
827
+ }
828
+
829
+ const stepfunRow = id => {
830
+ const known = STEPFUN_SPECS[id]
831
+ const efforts = known?.efforts ?? []
832
+ return {
833
+ id,
834
+ name: known?.name ?? id,
835
+ context: known?.context ?? 0,
836
+ output: known?.output ?? 0,
837
+ attachment: known?.attachment ?? false,
838
+ reasoning: efforts.length > 0,
839
+ efforts: [...efforts],
840
+ defaultEffort: known?.defaultEffort,
841
+ }
842
+ }
843
+
844
+ const STEPFUN_CONSOLE_URL = 'https://platform.stepfun.com/step-plan'
845
+ const STEPFUN_RATE_LIMIT_URL = 'https://platform.stepfun.com/api/step.openapi.devcenter.Dashboard/QueryStepPlanRateLimit'
846
+
847
+ function stepfunConsoleHeaders(session) {
848
+ const raw = String(session ?? '').trim()
849
+ const headers = {
850
+ 'content-type': 'application/json',
851
+ accept: 'application/json',
852
+ origin: 'https://platform.stepfun.com',
853
+ referer: STEPFUN_CONSOLE_URL,
854
+ }
855
+ // 兼容两种粘贴格式:完整 Cookie 头(含 Oasis-Token=...)或裸 Oasis-Token 值。
856
+ if (raw.includes('=')) {
857
+ headers.cookie = raw
858
+ const oasisToken = raw.match(/(?:^|;\s*)Oasis-Token=([^;]+)/i)?.[1]
859
+ const oasisWebid = raw.match(/(?:^|;\s*)Oasis-Webid=([^;]+)/i)?.[1]
860
+ if (oasisToken) headers['oasis-token'] = decodeURIComponent(oasisToken)
861
+ if (oasisWebid) headers['oasis-webid'] = decodeURIComponent(oasisWebid)
862
+ } else if (raw) {
863
+ headers['oasis-token'] = raw
864
+ headers.cookie = `Oasis-Token=${raw}`
865
+ }
866
+ return headers
867
+ }
868
+
869
+ /**
870
+ * 解析 Step Plan 剩余比例窗口(上游 `*_left_rate` 为 0..1 剩余比例,与百炼相反)。
871
+ * 上游约定:无该窗口时返回 `leftRate === 0` 且 `resetTime === 0`(除非有显式 buckets),
872
+ * 不得将「无窗口」误显示为「0% 已耗尽」。
873
+ */
874
+ function stepfunLeftWindow(id, rawLeft, rawReset, now, { allowZeroReset = false } = {}) {
875
+ const left = amount(rawLeft)
876
+ if (left === null) return null
877
+ const resetNum = amount(rawReset)
878
+ const hasReset = resetNum !== null && resetNum > 0
879
+ if (left === 0 && !hasReset && !allowZeroReset) return null
880
+ const clamped = Math.min(1, Math.max(0, left))
881
+ const remaining = Math.round(clamped * 1000) / 10
882
+ const used = Math.max(0, Math.round((1 - clamped) * 1000) / 10)
883
+ const resetMs = hasReset ? (resetNum > 1e12 ? resetNum : resetNum * 1000) : null
884
+ const resetInMs = resetMs !== null && resetMs > now ? Math.round(resetMs - now) : undefined
885
+ return windowOf(id, used, 100, remaining, resetInMs)
886
+ }
887
+
888
+ function parseStepfunRateLimitResponse(json, now = Date.now()) {
889
+ if (!object(json)) return { windows: [], gifts: [], balance: null }
890
+ const credit = object(json.plan_credit_rate_limit) ? json.plan_credit_rate_limit : null
891
+ const hasBuckets = Array.isArray(credit?.credit_buckets) && credit.credit_buckets.length > 0
892
+ const windows = [
893
+ stepfunLeftWindow('window-percent', json.five_hour_usage_left_rate, json.five_hour_usage_reset_time, now),
894
+ stepfunLeftWindow('weekly-percent', json.weekly_usage_left_rate, json.weekly_usage_reset_time, now),
895
+ credit ? stepfunLeftWindow('monthly-percent', credit.subscription_credit_left_rate, credit.subscription_credit_reset_time, now, { allowZeroReset: hasBuckets }) : null,
896
+ ].filter(Boolean)
897
+ return { windows, gifts: [], balance: null }
898
+ }
899
+
900
+ const stepfun = {
901
+ id: 'stepfun',
902
+ title: 'Step Plan',
903
+ endpoint: 'https://api.stepfun.com',
904
+ chatPath: '/step_plan/v1/chat/completions',
905
+ baseUrl: 'https://api.stepfun.com/step_plan/v1',
906
+ credentialRef: 'UNIFIED_ROUTER_STEPFUN_API_KEY',
907
+ consoleCredentialRef: 'UNIFIED_ROUTER_STEPFUN_CONSOLE',
908
+ consoleLogin: {
909
+ // 直达 platform.stepfun.com/step-plan(未登录自动跳 account.stepfun.com,完成后回跳
910
+ // 才会刷新平台域的 Oasis-Token Cookie;不能直达账号中心页)。
911
+ url: STEPFUN_CONSOLE_URL,
912
+ cookieUrls: ['https://platform.stepfun.com', 'https://stepfun.com'],
913
+ cookieDomains: ['platform.stepfun.com', 'stepfun.com'],
914
+ async verify(cookie, fetchJson, signal) {
915
+ const json = await fetchJson({
916
+ url: STEPFUN_RATE_LIMIT_URL,
917
+ method: 'POST',
918
+ headers: stepfunConsoleHeaders(cookie),
919
+ body: '{}',
920
+ }, signal)
921
+ if (!object(json) || json.code === 'unauthenticated') return false
922
+ return 'five_hour_usage_left_rate' in json || 'weekly_usage_left_rate' in json || object(json.plan_credit_rate_limit)
923
+ },
924
+ },
925
+ catalog: {
926
+ fallbackOnEmpty: true,
927
+ request(key) {
928
+ return {
929
+ url: 'https://api.stepfun.com/step_plan/v1/models',
930
+ headers: { authorization: 'Bearer ' + key },
931
+ }
932
+ },
933
+ parse(json) {
934
+ if (!object(json) || !Array.isArray(json.data)) return []
935
+ const rows = []
936
+ const seen = new Set()
937
+ for (const entry of json.data) {
938
+ if (!object(entry) || !validId(entry.id) || seen.has(entry.id)) continue
939
+ const lower = entry.id.toLowerCase()
940
+ if (STEPFUN_NON_CHAT_PREFIXES.some(prefix => lower.startsWith(prefix))) continue
941
+ seen.add(entry.id)
942
+ rows.push(stepfunRow(entry.id))
943
+ }
944
+ return rows
945
+ },
946
+ next() { return undefined },
947
+ },
948
+ fallback: Object.keys(STEPFUN_SPECS).map(stepfunRow),
949
+ effortBody(effort, row) {
950
+ if (!Array.isArray(row?.efforts) || !row.efforts.includes(effort)) return undefined
951
+ return { reasoning_effort: effort }
952
+ },
953
+ balance: null, // Step Plan 专属额度走控制台会话
954
+ consoleQuota: {
955
+ consoleUrl: STEPFUN_CONSOLE_URL,
956
+ baseUrl: 'https://platform.stepfun.com',
957
+ credentialEnv: 'UNIFIED_ROUTER_STEPFUN_CONSOLE',
958
+ async fetch(session, fetchJson, signal) {
959
+ const json = await fetchJson({
960
+ url: STEPFUN_RATE_LIMIT_URL,
961
+ method: 'POST',
962
+ headers: stepfunConsoleHeaders(session),
963
+ body: '{}',
964
+ }, signal)
965
+ if (!object(json)) return { windows: [], gifts: [], balance: null }
966
+ if (json.code === 'unauthenticated' || json.code === 'permission_denied') return { expired: true }
967
+ return parseStepfunRateLimitResponse(json)
968
+ },
969
+ },
970
+ rateLimit: {
971
+ scanOnOk: false,
972
+ codes: { rate_limit_exceeded: 'rpm' },
973
+ exhaustedCodes: ['insufficient_quota', 'quota_exceeded'],
974
+ },
975
+ }
976
+
977
+ export const APIKEY_PROVIDERS = Object.freeze({ agnes, unisound, qianfan, bailian, stepfun })
800
978
  export const APIKEY_PROVIDER_IDS = Object.freeze(Object.keys(APIKEY_PROVIDERS))
801
979
 
802
980
  export function apikeyProvider(id) {
package/lib/backend.js CHANGED
@@ -2536,6 +2536,8 @@ var OFFICIAL_MODEL_SPECS = Object.freeze({
2536
2536
  hy4flash: { context: 1024e3, maxOutput: 65536 },
2537
2537
  "hy4flash-free": { context: 1024e3, maxOutput: 65536 },
2538
2538
  "step-5-preview": { context: 1048576, maxOutput: 65536 },
2539
+ "step-3-7-flash": { context: 262144 },
2540
+ "step-3-5-flash": { context: 262144 },
2539
2541
  "openpangu-2-0-pro": { context: 524288, maxOutput: 131072 },
2540
2542
  "openpangu-2-0-flash": { context: 524288, maxOutput: 131072 },
2541
2543
  "openpangu-2-1-pro": { context: 524288, maxOutput: 393216 },
@@ -3204,12 +3206,9 @@ function raccoonSupportsImage(modelId, tags) {
3204
3206
  }
3205
3207
  var RACCOON = {
3206
3208
  id: "raccoon",
3207
- // ⚠️ 展示名必须能一眼区分免费版 / 订阅版:两者是**同一上游账号体系**的两个
3208
- // 产品面(同 API 基址、同登录协议),只按套餐分流模型。名字若都叫
3209
- // 「Raccoon (商汤)」,模型选择器与设置页里会出现两张分不清的卡片。
3210
- // ⚠️ 也不要用『Raccoon Work (商汤)』—— 那个词组在 Channel Pack 的 provider
3211
- // Tab 里**触发换行**(用户报障)。
3212
- displayName: "Raccoon \u514D\u8D39\u7248",
3209
+ // ⚠️ 展示名必须能一眼区分体验版 / 订阅版,且避免用「免费版」误导模型或用户以为零消耗。
3210
+ // 合并统一模式下由宿主挂载层覆写为不带后缀的 `Raccoon`。
3211
+ displayName: "Raccoon \u4F53\u9A8C\u7248",
3213
3212
  apiBase: RACCOON_API_BASE,
3214
3213
  authApiPrefix: "/api/web/auth/v1",
3215
3214
  llmApiPrefix: "/api/web/llm/v2",
@@ -14091,7 +14090,13 @@ function mountRaccoon({ ctx, pool, throwIfAllAccountsRateLimited, readImage, rea
14091
14090
  if (credential === void 0) return [];
14092
14091
  return await raccoonPro.fetchModelsWithCredential(credential);
14093
14092
  };
14094
- const raccoonAdapter = mountRaccoon2(RACCOON, raccoon, "free", proRemoteFetch);
14093
+ const raccoonProduct = {
14094
+ ...RACCOON,
14095
+ get displayName() {
14096
+ return unified() ? "Raccoon" : RACCOON.displayName;
14097
+ }
14098
+ };
14099
+ const raccoonAdapter = mountRaccoon2(raccoonProduct, raccoon, "free", proRemoteFetch);
14095
14100
  const raccoonProAdapter = mountRaccoon2(
14096
14101
  RACCOON_PRO,
14097
14102
  raccoonPro,
@@ -14213,7 +14218,7 @@ var CHANNEL_SPECS = Object.freeze([
14213
14218
  // 只有代表账号池的 `raccoon` 置 claim —— `raccoon-pro` 再跑一次会重复调度同一账号。
14214
14219
  Object.freeze({
14215
14220
  id: "raccoon",
14216
- title: "Raccoon \u514D\u8D39\u7248",
14221
+ title: "Raccoon \u4F53\u9A8C\u7248",
14217
14222
  kind: "pack",
14218
14223
  card: true,
14219
14224
  claim: true,
@@ -14329,16 +14334,22 @@ var CHANNEL_SPECS = Object.freeze([
14329
14334
  capabilities: Object.freeze({ accounts: false, models: true, quota: true, consoleSession: true }),
14330
14335
  methods: Object.freeze({})
14331
14336
  }),
14337
+ Object.freeze({
14338
+ id: "stepfun",
14339
+ title: "Step Plan",
14340
+ kind: "apikey",
14341
+ card: true,
14342
+ claim: false,
14343
+ accountPool: false,
14344
+ capabilities: Object.freeze({ accounts: false, models: true, quota: true, consoleSession: true }),
14345
+ methods: Object.freeze({})
14346
+ }),
14332
14347
  Object.freeze({
14333
14348
  id: "astudio",
14334
14349
  title: "AStudio",
14335
14350
  kind: "managed",
14336
- // 停用:上游无法回报正确积分(用尽后仍显示满值,用户以为有额度却调不动)。
14337
- // 实现与契约保留在 lib/managed-providers/astudio.js,恢复时把 registered 与 card
14338
- // 一起改回 true,并在 lib/managed-providers/index.js 的注册表里加回来。
14339
- card: false,
14340
- registered: false,
14341
- claim: false,
14351
+ card: true,
14352
+ claim: true,
14342
14353
  accountPool: false,
14343
14354
  capabilities: Object.freeze({ accounts: true, models: true, quota: true, checkin: "credits", onboarding: false }),
14344
14355
  methods: Object.freeze({})
@@ -98,7 +98,7 @@ export const CHANNEL_SPECS = Object.freeze([
98
98
  // 只有代表账号池的 `raccoon` 置 claim —— `raccoon-pro` 再跑一次会重复调度同一账号。
99
99
  Object.freeze({
100
100
  id: 'raccoon',
101
- title: 'Raccoon 免费版',
101
+ title: 'Raccoon 体验版',
102
102
  kind: 'pack',
103
103
  card: true,
104
104
  claim: true,
@@ -209,16 +209,22 @@ export const CHANNEL_SPECS = Object.freeze([
209
209
  capabilities: Object.freeze({ accounts: false, models: true, quota: true, consoleSession: true }),
210
210
  methods: Object.freeze({}),
211
211
  }),
212
+ Object.freeze({
213
+ id: 'stepfun',
214
+ title: 'Step Plan',
215
+ kind: 'apikey',
216
+ card: true,
217
+ claim: false,
218
+ accountPool: false,
219
+ capabilities: Object.freeze({ accounts: false, models: true, quota: true, consoleSession: true }),
220
+ methods: Object.freeze({}),
221
+ }),
212
222
  Object.freeze({
213
223
  id: 'astudio',
214
224
  title: 'AStudio',
215
225
  kind: 'managed',
216
- // 停用:上游无法回报正确积分(用尽后仍显示满值,用户以为有额度却调不动)。
217
- // 实现与契约保留在 lib/managed-providers/astudio.js,恢复时把 registered 与 card
218
- // 一起改回 true,并在 lib/managed-providers/index.js 的注册表里加回来。
219
- card: false,
220
- registered: false,
221
- claim: false,
226
+ card: true,
227
+ claim: true,
222
228
  accountPool: false,
223
229
  capabilities: Object.freeze({ accounts: true, models: true, quota: true, checkin: 'credits', onboarding: false }),
224
230
  methods: Object.freeze({}),
package/lib/client.js CHANGED
@@ -509,6 +509,8 @@ const OFFICIAL_MODEL_SPECS = Object.freeze({
509
509
  hy4flash: { context: 1_024_000, maxOutput: 65_536 },
510
510
  'hy4flash-free': { context: 1_024_000, maxOutput: 65_536 },
511
511
  'step-5-preview': { context: 1_048_576, maxOutput: 65_536 },
512
+ 'step-3-7-flash': { context: 262_144 },
513
+ 'step-3-5-flash': { context: 262_144 },
512
514
  'openpangu-2-0-pro': { context: 524_288, maxOutput: 131_072 },
513
515
  'openpangu-2-0-flash': { context: 524_288, maxOutput: 131_072 },
514
516
  'openpangu-2-1-pro': { context: 524_288, maxOutput: 393_216 },
@@ -883,7 +885,7 @@ const CHANNEL_SPECS = Object.freeze([
883
885
  // 只有代表账号池的 `raccoon` 置 claim —— `raccoon-pro` 再跑一次会重复调度同一账号。
884
886
  Object.freeze({
885
887
  id: 'raccoon',
886
- title: 'Raccoon 免费版',
888
+ title: 'Raccoon 体验版',
887
889
  kind: 'pack',
888
890
  card: true,
889
891
  claim: true,
@@ -994,16 +996,22 @@ const CHANNEL_SPECS = Object.freeze([
994
996
  capabilities: Object.freeze({ accounts: false, models: true, quota: true, consoleSession: true }),
995
997
  methods: Object.freeze({}),
996
998
  }),
999
+ Object.freeze({
1000
+ id: 'stepfun',
1001
+ title: 'Step Plan',
1002
+ kind: 'apikey',
1003
+ card: true,
1004
+ claim: false,
1005
+ accountPool: false,
1006
+ capabilities: Object.freeze({ accounts: false, models: true, quota: true, consoleSession: true }),
1007
+ methods: Object.freeze({}),
1008
+ }),
997
1009
  Object.freeze({
998
1010
  id: 'astudio',
999
1011
  title: 'AStudio',
1000
1012
  kind: 'managed',
1001
- // 停用:上游无法回报正确积分(用尽后仍显示满值,用户以为有额度却调不动)。
1002
- // 实现与契约保留在 lib/managed-providers/astudio.js,恢复时把 registered 与 card
1003
- // 一起改回 true,并在 lib/managed-providers/index.js 的注册表里加回来。
1004
- card: false,
1005
- registered: false,
1006
- claim: false,
1013
+ card: true,
1014
+ claim: true,
1007
1015
  accountPool: false,
1008
1016
  capabilities: Object.freeze({ accounts: true, models: true, quota: true, checkin: 'credits', onboarding: false }),
1009
1017
  methods: Object.freeze({}),
@@ -3077,6 +3085,9 @@ const CLIENT_STYLES = `
3077
3085
  /* ---------- 渠道 tab ---------- */
3078
3086
  /* 渠道选择器:**小卡片网格**(自动换行),不用横向滚动条 —— 滚动条挡住了半个渠道,
3079
3087
  而且藏起来的渠道要用户去猜(用户报障「最上面是左右拖动的滚动条,很难看」)。 */
3088
+ .eac-provider-groups{display:flex;flex-direction:column;gap:var(--eac-s2)}
3089
+ .eac-provider-group{display:flex;flex-direction:column;gap:var(--eac-s1)}
3090
+ .eac-provider-group-title{font-size:var(--eac-fs-xs);font-weight:620;letter-spacing:.04em;color:var(--eac-faint);padding:0 2px}
3080
3091
  .eac-providers{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:var(--eac-s1);padding:0 0 var(--eac-s1)}
3081
3092
  .eac-provider{display:flex;flex-direction:column;align-items:flex-start;gap:2px;min-width:0;min-height:46px;padding:6px var(--eac-s3);border:1px solid var(--eac-border);border-radius:var(--eac-r);background:var(--eac-surface);color:var(--eac-muted);cursor:pointer;text-align:left;transition:background .14s ease,color .14s ease,border-color .14s ease}
3082
3093
  .eac-provider:hover{background:var(--eac-subtle);color:var(--eac-text)}
@@ -4253,10 +4264,10 @@ function packSettings(provider) {
4253
4264
  id: accountId, name: nickname, enabled,
4254
4265
  toggle: ['save', accountId, nickname, !enabled],
4255
4266
  tags: [
4256
- // 统一模型开关打开后不再区分免费/订阅:合并的意义就是「一个模型面」,
4267
+ // 统一模型开关打开后不再区分体验/订阅:合并的意义就是「一个模型面」,
4257
4268
  // 再挂套餐标签会让人以为还要按套餐挑账号。关闭时照旧按套餐标注。
4258
4269
  caps.accountPlan && !unifiedModelsOn(state)
4259
- && (plan === 'pro' ? ['订阅', 'info'] : plan === 'free' ? ['免费', 'success'] : ['套餐未知', 'warn']),
4270
+ && (plan === 'pro' ? ['订阅', 'info'] : plan === 'free' ? ['体验版', 'success'] : ['套餐未知', 'warn']),
4260
4271
  !enabled && ['已停用'],
4261
4272
  account.expiresAt > 0 && account.expiresAt <= Date.now() && ['凭据过期', 'warn'],
4262
4273
  limited > 0 && [`受限 ${limited}`, 'warn'],
@@ -4332,13 +4343,13 @@ function packSettings(provider) {
4332
4343
  toggleLabel: state.statuses[side.id]?.closed !== false ? (family ? '打开模型提供方' : '打开渠道') : (family ? '关闭模型提供方' : '关闭渠道'),
4333
4344
  }))),
4334
4345
  ...(caps.unifiedModels && state.automation?.unifiedModelProviders?.includes(id) ? [{
4335
- id: 'unified-models', name: '统一免费与订阅模型',
4336
- // 合并后是一个模型面:说明按「谁有额度用谁」讲,不再强调免费/订阅的先后,
4346
+ id: 'unified-models', name: '统一体验与订阅模型',
4347
+ // 合并后是一个模型面:说明按「谁有额度用谁」讲,不再强调体验/订阅的先后,
4337
4348
  // 否则用户会以为还要按套餐挑账号。
4338
4349
  meta: '合并为一个模型面 · 额度用尽自动切换账号',
4339
4350
  enabled: state.automation?.config?.raccoonUnifiedModels === true,
4340
4351
  toggle: ['setAutomationConfig', { raccoonUnifiedModels: !(state.automation?.config?.raccoonUnifiedModels === true) }],
4341
- toggleLabel: '统一免费与订阅模型',
4352
+ toggleLabel: '统一体验与订阅模型',
4342
4353
  }] : []),
4343
4354
  ]
4344
4355
  },
@@ -4832,7 +4843,7 @@ const raccoon = {
4832
4843
  title: 'Raccoon',
4833
4844
  pack: true,
4834
4845
  family: [
4835
- { id: 'raccoon', title: '免费模型' },
4846
+ { id: 'raccoon', title: '体验模型' },
4836
4847
  { id: 'raccoon-pro', title: '订阅模型' },
4837
4848
  ],
4838
4849
  // 两个能力位是**不同维度**,不要合并:
@@ -5680,14 +5691,18 @@ const bailian = apiKeyChannel({
5680
5691
  consoleMeta: '用于读取百炼 Token Plan 个人版周期额度',
5681
5692
  })
5682
5693
 
5694
+ // ── src/client/providers/stepfun.js ──
5695
+ const stepfun = apiKeyChannel({
5696
+ id: 'stepfun',
5697
+ title: 'Step Plan',
5698
+ host: 'api.stepfun.com',
5699
+ consoleMeta: '用于读取阶跃星辰 Step Plan 周期与月度 Credit 额度',
5700
+ })
5701
+
5683
5702
  // ── src/client/providers/astudio.js ──
5684
5703
  const astudio = managedChannel({
5685
5704
  id: 'astudio',
5686
5705
  title: 'AStudio',
5687
- // ⚠️ 已停用(2026-11-24):上游无法回报正确积分——积分用尽后仍显示满值,
5688
- // 用户以为还有额度却调不动。`card: false` 让卡片从设置页消失;声明保留,
5689
- // 与后端 `lib/managed-providers/index.js` 的停用说明对应,恢复时一起改回。
5690
- card: false,
5691
5706
  authMethods: ['local', 'browser', 'credential'],
5692
5707
  credentialHint: '粘贴 modelBearerToken(JWT)或 astron-session.json 内容',
5693
5708
  checkin: true,
@@ -5723,9 +5738,18 @@ const codearts = managedChannel({
5723
5738
  })
5724
5739
 
5725
5740
  // ── src/client/providers/index.js ──
5726
- const registeredProviders = [raccoon, raccoonPro, qodercn, trae, sensenova, workbuddy, agnes, unisound, qianfan, bailian, astudio, codearts]
5741
+ // 按类型排布:Agent(账号池 + 自管多账号)在前,API(单 Key / Token Plan)在后。
5742
+ const registeredProviders = [
5743
+ raccoon, raccoonPro, qodercn, trae, workbuddy, astudio, codearts,
5744
+ sensenova, agnes, unisound, qianfan, bailian, stepfun,
5745
+ ]
5727
5746
  const PROVIDERS = Object.freeze(registeredProviders.filter(provider => provider.card !== false)
5728
5747
  .map(provider => provider.pack ? packSettings(provider) : provider))
5748
+ const AGENT_KINDS = new Set(['pack', 'workbuddy', 'managed'])
5749
+ const PROVIDER_GROUPS = Object.freeze([
5750
+ { id: 'agent', title: 'Agent', providers: Object.freeze(PROVIDERS.filter(p => AGENT_KINDS.has(channelSpec(p.id)?.kind))) },
5751
+ { id: 'api', title: 'API', providers: Object.freeze(PROVIDERS.filter(p => !AGENT_KINDS.has(channelSpec(p.id)?.kind))) },
5752
+ ].filter(group => group.providers.length > 0))
5729
5753
  const PACK_PROVIDERS = Object.freeze(registeredProviders.filter(provider => provider.pack))
5730
5754
  const PLAN_PROVIDER_ID = sensenova.id
5731
5755
  const RACCOON_FAMILY = Object.freeze(raccoon.family.map(side => side.id))
@@ -6097,7 +6121,7 @@ function quotaPillData(id, type, snapshot, selection, viewedId, model) {
6097
6121
  const packages = bal?.packages ?? []
6098
6122
  const shownPackages = displayCreditPackages(packages)
6099
6123
  return { id: account.id, label: account.nickname, at: bal?.updatedAt, stale: bal?.stale,
6100
- plan: account.plan === 'free' ? '免费' : account.plan === 'pro' ? '订阅' : '',
6124
+ plan: unified ? '' : (account.plan === 'free' ? '体验版' : account.plan === 'pro' ? '订阅' : ''),
6101
6125
  amount: bal?.total ?? null, unit: '积分', packages, details: shownPackages.map(pkg => ({
6102
6126
  label: pkg.name || '额度包', value: pkg.remaining === null ? '' : quotaValue(pkg.remaining, pkg.unit),
6103
6127
  expires: pkg.active === false ? null : pkg.expiresAt, note: pkg.active === false ? '已失效' : '',
@@ -6361,7 +6385,8 @@ function tabKeys(event, index, ids, activate) {
6361
6385
  }[event.key]
6362
6386
  if (typeof next !== 'number') return
6363
6387
  event.preventDefault()
6364
- event.currentTarget.parentElement.querySelectorAll('[role="tab"]')[next]?.focus()
6388
+ const list = event.currentTarget.closest?.('[role="tablist"]') ?? event.currentTarget.parentElement
6389
+ list?.querySelectorAll('[role="tab"]')[next]?.focus()
6365
6390
  activate(ids[next])
6366
6391
  }
6367
6392
 
@@ -6443,20 +6468,25 @@ function Settings({ ctx }) {
6443
6468
  const ui = { providerId: provider.id, invoke, act, disabled, isPending, loading: state.loading,
6444
6469
  failed: state.loadFailed || provider.snapshot?.failed(state), importOpen,
6445
6470
  query, setQuery, page, setPage, enabledFirst, setEnabledFirst, more, drafts, setDrafts, editParams, setPanel }
6471
+ const providerIds = PROVIDERS.map(item => item.id)
6446
6472
  return h('div', { className: 'eac-settings' },
6447
- h('nav', { className: 'eac-providers', role: 'tablist', 'aria-label': '选择渠道' },
6448
- ...PROVIDERS.map((item, index) => {
6449
- const value = item.statusFrom(state)
6450
- const selected = state.provider === item.id
6451
- return h('button', { key: item.id, id: `eac-provider-${item.id}`, type: 'button', role: 'tab', className: 'eac-provider',
6452
- 'aria-selected': selected, tabIndex: selected ? 0 : -1, 'aria-label': `切换到 ${item.title}`, 'aria-controls': 'eac-provider-workspace',
6453
- onClick: () => { if (!selected) selectProvider(item.id) },
6454
- onKeyDown: event => tabKeys(event, index, PROVIDERS.map(value => value.id), id => { if (id !== state.provider) selectProvider(id) }) },
6455
- h('span', { className: 'eac-provider-name' }, item.title),
6456
- h('span', { className: 'eac-provider-meta' },
6457
- h('span', { className: 'eac-provider-dot', 'data-tone': toneFor(value) }),
6458
- value ? value.cardMeta ?? (value.closed ? '已关闭' : `${value.totalAccounts ?? value.accounts ?? '—'} 账号 · ${value.models ?? '—'} 模型`) : '待读取'))
6459
- })),
6473
+ h('nav', { className: 'eac-provider-groups', role: 'tablist', 'aria-label': '选择渠道' },
6474
+ ...PROVIDER_GROUPS.map(group => h('div', { key: group.id, className: 'eac-provider-group', 'data-group': group.id },
6475
+ h('div', { className: 'eac-provider-group-title', 'aria-hidden': true }, group.title),
6476
+ h('div', { className: 'eac-providers' },
6477
+ ...group.providers.map(item => {
6478
+ const index = providerIds.indexOf(item.id)
6479
+ const value = item.statusFrom(state)
6480
+ const selected = state.provider === item.id
6481
+ return h('button', { key: item.id, id: `eac-provider-${item.id}`, type: 'button', role: 'tab', className: 'eac-provider',
6482
+ 'aria-selected': selected, tabIndex: selected ? 0 : -1, 'aria-label': `切换到 ${item.title}`, 'aria-controls': 'eac-provider-workspace',
6483
+ onClick: () => { if (!selected) selectProvider(item.id) },
6484
+ onKeyDown: event => tabKeys(event, index, providerIds, id => { if (id !== state.provider) selectProvider(id) }) },
6485
+ h('span', { className: 'eac-provider-name' }, item.title),
6486
+ h('span', { className: 'eac-provider-meta' },
6487
+ h('span', { className: 'eac-provider-dot', 'data-tone': toneFor(value) }),
6488
+ value ? value.cardMeta ?? (value.closed ? '已关闭' : `${value.totalAccounts ?? value.accounts ?? '—'} 账号 · ${value.models ?? '—'} 模型`) : '待读取'))
6489
+ }))))),
6460
6490
  h('div', { className: 'eac-workspace', 'data-panel': panel, role: 'tabpanel', id: 'eac-provider-workspace', 'aria-labelledby': `eac-provider-${state.provider}` },
6461
6491
  h('header', { className: 'eac-header' },
6462
6492
  h('h2', { className: 'eac-title' }, provider.title),
@@ -15,7 +15,7 @@ const RESPONSES_BASE_URL = `${GATEWAY_ORIGIN}/model-gateway/v1`
15
15
  const RESPONSES_PATH = '/model-gateway/v1/responses'
16
16
  const STUDIO_ORIGIN = 'https://agent.xfyun.cn'
17
17
  const SSO_ORIGIN = 'https://sso.xfyun.cn'
18
- const STUDIO_VERSION = '3.6.0'
18
+ const STUDIO_VERSION = '3.7.1'
19
19
  const CLIENT_TYPE = process.platform === 'darwin' ? '22' : '21'
20
20
 
21
21
  // 2026-11-20 实测确认存在的模型(实时目录 6 条 + 桌面端缓存可用补位 xdeepseek-flash-in)。
@@ -383,8 +383,12 @@ export const astudioSpec = {
383
383
  }, 6000)
384
384
  const rateMap = new Map()
385
385
  for (const item of Array.isArray(cfg?.data) ? cfg.data : []) {
386
- if (typeof item?.model === 'string' && Number.isFinite(Number(item.point_multiplier))) {
387
- rateMap.set(item.model, Number(item.point_multiplier))
386
+ // 实测(2026-11-26,AStudio 3.7.1):point_multiplier 常带前缀如 "x2.0" / "x0.5"。
387
+ const rawRate = typeof item?.point_multiplier === 'string'
388
+ ? Number(item.point_multiplier.trim().replace(/^[x×]/i, ''))
389
+ : Number(item?.point_multiplier)
390
+ if (typeof item?.model === 'string' && Number.isFinite(rawRate) && rawRate > 0) {
391
+ rateMap.set(item.model, rawRate)
388
392
  }
389
393
  }
390
394
  for (const row of rows) {
@@ -1,19 +1,11 @@
1
1
  // 自管多账号渠道注册表。
2
2
  // 新增自管多账号渠道只需在此目录添加渠道 spec 模块并登记到列表,
3
3
  // 宿主 RPC、快照、签到、任务与推理适配器全部按此表自动装配。
4
+ import { astudioSpec } from './astudio.js'
4
5
  import { codeartsSpec } from './codearts.js'
5
6
 
6
- /**
7
- * 已停用的渠道。
8
- *
9
- * ⚠️ **AStudio 停用**(2026-11-24):上游无法回报正确积分 —— 积分用尽后仍显示满值,
10
- * 用户据此以为还有额度却调不动,几乎无法正常使用。**实现文件 `astudio.js` 完整保留**,
11
- * 恢复时把 import 与列表登记加回来即可。
12
- *
13
- * 停用后 `MANAGED_PROVIDER_IDS` 不再含 `astudio`,因此它的 RPC(`managed.*`)会被
14
- * 白名单拒绝、快照/签到/任务不再装配、客户端卡片隐藏 —— 即「支持已移除」。
15
- */
16
7
  export const MANAGED_PROVIDERS = Object.freeze([
8
+ astudioSpec,
17
9
  codeartsSpec,
18
10
  ])
19
11
 
@@ -418,6 +418,8 @@ const OFFICIAL_MODEL_SPECS = Object.freeze({
418
418
  hy4flash: { context: 1_024_000, maxOutput: 65_536 },
419
419
  'hy4flash-free': { context: 1_024_000, maxOutput: 65_536 },
420
420
  'step-5-preview': { context: 1_048_576, maxOutput: 65_536 },
421
+ 'step-3-7-flash': { context: 262_144 },
422
+ 'step-3-5-flash': { context: 262_144 },
421
423
  'openpangu-2-0-pro': { context: 524_288, maxOutput: 131_072 },
422
424
  'openpangu-2-0-flash': { context: 524_288, maxOutput: 131_072 },
423
425
  'openpangu-2-1-pro': { context: 524_288, maxOutput: 393_216 },
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "dsh-unified-router",
3
- "version": "0.7.0",
3
+ "version": "0.7.2",
4
4
  "type": "module",
5
5
  "main": "lib/web-host.js",
6
6
  "license": "MIT",
7
7
  "displayName": "Unified Router",
8
- "description": "Raccoon、Qoder 中国版、TRAE、商汤 Token Plan、WorkBuddy、Agnes、云知声、千帆 Token Plan、阿里云百炼与 CodeArts 的模型、账号、额度与自动化管理:统一的 Web 设置页,仅 CN 版。",
8
+ "description": "Raccoon、Qoder 中国版、TRAE、WorkBuddy、AStudio、CodeArts、商汤 Token Plan、Agnes、云知声、千帆 Token Plan、阿里云百炼与 Step Plan 的模型、账号、额度与自动化管理:统一的 Web 设置页,仅 CN 版。",
9
9
  "keywords": [
10
10
  "dsh",
11
11
  "deepseek-harness",
@@ -20,6 +20,7 @@
20
20
  "unisound",
21
21
  "qianfan",
22
22
  "bailian",
23
+ "stepfun",
23
24
  "astudio",
24
25
  "codearts"
25
26
  ],