@deepseek-ai/dsh-llm-deepseek-api-key 0.2.2-rc.4 → 0.2.3-alpha.1

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.
package/README.i18n.yaml CHANGED
@@ -9,17 +9,17 @@
9
9
  en: b6871195e386cc64
10
10
  zh: 742b05a3ca80883c
11
11
  /deepseek-ai-dsh-llm-deepseek-api-key/summary:
12
- en: f937052cf8ff4812
13
- zh: 899d61f5021136d6
12
+ en: 3e86ef7b396d1ae2
13
+ zh: ce99f1095d90d0a7
14
14
  /deepseek-ai-dsh-llm-deepseek-api-key/table-of-contents:
15
15
  en: 23386452a66b2fbd
16
16
  zh: 4cf93c4bf17b3da2
17
17
  /deepseek-ai-dsh-llm-deepseek-api-key/use-this-package:
18
- en: 007427bed9bd469b
19
- zh: 5089b5781746357f
18
+ en: 382b0489976b8642
19
+ zh: 9bbff6c681a9ed86
20
20
  /deepseek-ai-dsh-llm-deepseek-api-key/understand-the-implementation:
21
- en: 1b9584855817eddb
22
- zh: feb2c883ca355d31
21
+ en: c12e159cb4d8b31c
22
+ zh: 20fc6c969391c3d8
23
23
  /deepseek-ai-dsh-llm-deepseek-api-key/further-exploration:
24
24
  en: 347659458510940c
25
25
  zh: ccfb03e18b356a39
package/README.md CHANGED
@@ -11,7 +11,7 @@ English | [中文](README.zh.md)
11
11
 
12
12
  Register authentication, model discovery, and the official model listing for `deepseek-official`. This plugin shares the [Messages transport](../llm-deepseek/README.md) and owns credential resolution, catalog availability, and model admission.
13
13
 
14
- Authentication resolution returns the validated API key in `x-api-key` for both Messages and Files requests.
14
+ Authentication resolution asks [`ctx.deepseekAuth`](../../account/deepseek-auth/README.md) for the validated API key in `x-api-key` for Messages, Files, and listing requests. The route connects its route id, base URL, and `apiKeyEnv` reference to that service, so the DeepSeek web providers send the same key as a bearer token to the same deployment. The key is released only for destinations under the origin of that base URL.
15
15
 
16
16
  ## Table of Contents
17
17
 
@@ -25,7 +25,7 @@ Authentication resolution returns the validated API key in `x-api-key` for both
25
25
  <a id="use-this-package"></a>
26
26
  ## Use this package
27
27
 
28
- `apiKeyEnv` defaults to `DEEPSEEK_API_KEY` and resolves per request and model discovery. When the credentials service exists, its precedence applies; only compositions without that service read the launch environment directly. Requests with missing credentials fail with `MISSING_CREDENTIAL`; malformed credentials fail with `INVALID_CREDENTIAL`. Model discovery returns an empty catalog when the credential is missing, hiding the route from model selectors while retaining its settings entry. Malformed credentials and other lookup failures propagate. Adding or removing a key affects the next discovery call.
28
+ `apiKeyEnv` defaults to `DEEPSEEK_API_KEY` and resolves per request and model discovery. `ctx.deepseekAuth` reads the key through the credential reference helpers of [`dsh-credentials`](../../credentials/credentials/README.md): when the credentials service exists, its precedence applies, and only compositions without that service read the launch environment directly. Requests with missing credentials fail with `MISSING_CREDENTIAL`; malformed credentials fail with `INVALID_CREDENTIAL`, whose diagnostic names this plugin's settings namespace and the credential reference. Model discovery returns an empty catalog when the credential is missing, hiding the route from model selectors while retaining its settings entry. Malformed credentials and other lookup failures propagate. Adding or removing a key affects the next discovery call. The plugin starts only in a composition that mounts `@deepseek-ai/dsh-deepseek-auth`; the `base` and `sdk-minimal` bundles mount it.
29
29
 
30
30
  ```yaml
31
31
  - id: llm-deepseek
@@ -35,7 +35,7 @@ Authentication resolution returns the validated API key in `x-api-key` for both
35
35
  apiKeyEnv: DEEPSEEK_API_KEY
36
36
  ```
37
37
 
38
- The endpoint and credential reference come from one configuration resolution. In-flight requests retain that snapshot; subsequent updates affect subsequent calls. Account login state cannot change this route’s credential.
38
+ The endpoint and credential reference come from one configuration resolution. In-flight requests retain that snapshot; subsequent updates affect subsequent calls. Account login state cannot change this route’s credential. For a destination at another origin, or a URL that embeds credentials, `ctx.deepseekAuth` releases no key and does not read the credential store.
39
39
 
40
40
  `models` is an independently configurable catalog for this provider; defaults and protocol capabilities come from the shared transport. While `models` equals the built-in catalog and the Messages origin is the official API, `https://api.deepseek.com`, the route serves the official `GET https://api.deepseek.com/models` listing instead. Listing requests carry the API key in `x-api-key` and the harness `User-Agent`, and reject redirects; without an API key the route requests nothing. Any other endpoint, including one named by `baseURL` or `$DEEPSEEK_BASE_URL`, serves `models` and requests no listing. Discovery does not probe inference endpoints.
41
41
 
@@ -55,7 +55,7 @@ The settings namespace is the Cordis entry id, or the plugin name without an ent
55
55
  <a id="understand-the-implementation"></a>
56
56
  ## Understand the implementation
57
57
 
58
- API-key lookup calls `resolveDeepSeekApiKey` from the [shared credential module](../llm-deepseek/src/credential.ts). Registrations and listeners dispose with the plugin, and disposal aborts an in-flight listing request. Shared Host wiring supplies attachments, request extensions, anonymous identity, and atomic retry-policy updates; this plugin registers only its own route and uses the transport's `connect` and `admit` hooks for the listed catalog and the gate. The listing request, its cache, and catalog resolution come from the shared transport; the cache lives in memory and is keyed by endpoint and a SHA-256 of the key, so another key loads its own listing. A `loader/volatile-update` listener discards the cached listing whenever the route starts or stops following it.
58
+ API-key lookup goes through `ctx.deepseekAuth`, which reads the key under the route's `apiKeyEnv` reference and checks that it can travel in an HTTP header; this plugin reports an unusable key as `INVALID_CREDENTIAL`, and the shared transport reads no credential. Registrations and listeners dispose with the plugin, and disposal aborts an in-flight listing request. Shared Host wiring supplies attachments, request extensions, anonymous identity, and atomic retry-policy updates; this plugin registers only its own route and uses the transport's `connect` and `admit` hooks for the listed catalog and the gate. The listing request, its cache, and catalog resolution come from the shared transport; the cache lives in memory and is keyed by endpoint and a SHA-256 of the key, so another key loads its own listing. A `loader/volatile-update` listener discards the cached listing whenever the route starts or stops following it.
59
59
 
60
60
  <a id="further-exploration"></a>
61
61
  ## Further Exploration
package/README.zh.md CHANGED
@@ -11,7 +11,7 @@ kind: "package-reference"
11
11
 
12
12
  为 `deepseek-official` 注册鉴权、模型发现和官方模型列表。通过 [llm-deepseek](../llm-deepseek/README.zh.md) 共用 Messages 请求实现;本包拥有凭据解析、目录可用性判断和模型准入。
13
13
 
14
- 鉴权解析将验证后的 API key 放入 `x-api-key`,供 Messages 和 Files 请求共同使用。
14
+ 鉴权解析向 [`ctx.deepseekAuth`](../../account/deepseek-auth/README.zh.md) 索取验证后的 API key,放入 `x-api-key`,供 Messages、Files 和列表请求使用。路由把自己的路由 id、基础地址和 `apiKeyEnv` 引用登记到该服务,使 DeepSeek Web 提供方以 Bearer 令牌把同一密钥发往同一部署。密钥只对该基础地址所在 origin 下的目的地释放。
15
15
 
16
16
  ## 目录
17
17
 
@@ -25,7 +25,7 @@ kind: "package-reference"
25
25
  <a id="use-this-package"></a>
26
26
  ## 使用此包
27
27
 
28
- `apiKeyEnv` 默认为 `DEEPSEEK_API_KEY`,在每次请求和模型发现时解析凭据。已组合 credentials 服务时,按其优先级解析;只有未组合该服务时才直接读取启动环境。请求时凭据缺失以 `MISSING_CREDENTIAL` 失败;格式错误以 `INVALID_CREDENTIAL` 失败。模型发现在凭据缺失时返回空目录,在模型选择器中隐藏该路由,但保留其设置入口。凭据格式错误和其他读取失败继续上报。添加或删除密钥会影响下一次模型发现。
28
+ `apiKeyEnv` 默认为 `DEEPSEEK_API_KEY`,在每次请求和模型发现时解析凭据。密钥由 `ctx.deepseekAuth` 通过 [`dsh-credentials`](../../credentials/credentials/README.zh.md) 的凭据引用函数读取:已组合 credentials 服务时,按其优先级解析;只有未组合该服务时才直接读取启动环境。请求时凭据缺失以 `MISSING_CREDENTIAL` 失败;格式错误以 `INVALID_CREDENTIAL` 失败,其诊断点名本插件的设置命名空间与凭据引用。模型发现在凭据缺失时返回空目录,在模型选择器中隐藏该路由,但保留其设置入口。凭据格式错误和其他读取失败继续上报。添加或删除密钥会影响下一次模型发现。本插件只在挂载了 `@deepseek-ai/dsh-deepseek-auth` 的组合中启动;`base` 与 `sdk-minimal` 两个组合包挂载它。
29
29
 
30
30
  ```yaml
31
31
  - id: llm-deepseek
@@ -35,7 +35,7 @@ kind: "package-reference"
35
35
  apiKeyEnv: DEEPSEEK_API_KEY
36
36
  ```
37
37
 
38
- 端点和凭据引用来自同一次配置解析;进行中的请求保留该快照,后续配置更新仅影响后续请求。账号登录态不影响该路由使用的凭据。
38
+ 端点和凭据引用来自同一次配置解析;进行中的请求保留该快照,后续配置更新仅影响后续请求。账号登录态不影响该路由使用的凭据。对其他 origin 的目的地或内嵌凭据的 URL,`ctx.deepseekAuth` 不释放密钥,也不读取凭据存储。
39
39
 
40
40
  `models` 是该 provider 独立的可配置目录;默认值和协议能力来自共享传输包。当 `models` 等于内置目录、且 Messages 的 origin 是官方 API `https://api.deepseek.com` 时,路由改为提供官方 `GET https://api.deepseek.com/models` 列表。列表请求用 `x-api-key` 携带 API key,带上 harness 的 `User-Agent`,并拒绝重定向;没有 API key 时不发任何请求。其他端点,包括由 `baseURL` 或 `$DEEPSEEK_BASE_URL` 指定的端点,提供 `models`,不请求列表。目录判断不探测推理端点。
41
41
 
@@ -55,7 +55,7 @@ kind: "package-reference"
55
55
  <a id="understand-the-implementation"></a>
56
56
  ## 理解实现
57
57
 
58
- API key 读取调用[共享凭据模块](../llm-deepseek/src/credential.ts)的 `resolveDeepSeekApiKey`。注册和监听随插件生命周期释放,释放时会中止进行中的列表请求。共享 Host 绑定提供附件访问、请求扩展、匿名标识和重试策略的原子更新;本包只注册自己的路由,并通过传输层的 `connect` 与 `admit` 钩子接入列表目录和门控。列表请求、缓存和目录解析来自共享传输包;缓存只在内存中,以端点和 API key 的 SHA-256 为键,因此换一个 key 会加载它自己的列表。一个 `loader/volatile-update` 监听器在路由开始或停止使用列表时丢弃缓存的列表。
58
+ API key 的读取经由 `ctx.deepseekAuth`:它按路由的 `apiKeyEnv` 引用读取密钥,并检查密钥能否放进 HTTP 请求头;本插件把不可用的密钥报告为 `INVALID_CREDENTIAL`,共享传输层不读取任何凭据。注册和监听随插件生命周期释放,释放时会中止进行中的列表请求。共享 Host 绑定提供附件访问、请求扩展、匿名标识和重试策略的原子更新;本包只注册自己的路由,并通过传输层的 `connect` 与 `admit` 钩子接入列表目录和门控。列表请求、缓存和目录解析来自共享传输包;缓存只在内存中,以端点和 API key 的 SHA-256 为键,因此换一个 key 会加载它自己的列表。一个 `loader/volatile-update` 监听器在路由开始或停止使用列表时丢弃缓存的列表。
59
59
 
60
60
  <a id="further-exploration"></a>
61
61
  ## 进一步探索
package/lib/index.js CHANGED
@@ -1,6 +1,7 @@
1
- import { APP_IDENTITY, LlmError } from "@deepseek-ai/dsh-llm";
1
+ import { APP_IDENTITY, INVALID_CREDENTIAL_CODE, LlmError } from "@deepseek-ai/dsh-llm";
2
+ import { DeepSeekAuthError } from "@deepseek-ai/dsh-deepseek-auth";
2
3
  import { launchEnvironmentOf } from "@deepseek-ai/dsh-launch-environment";
3
- import { PUBLIC_BASE_URL, catalogModelInfo, createModelListingCache, deepSeekConfigFields, isBuiltInCatalog, modelListingConfigFields, modelListingURL, plainOptions as plainOptions$1, refuseListedModel, registerDeepSeekProvider, requestModelListing, resolveAdapterOptions as resolveAdapterOptions$1, resolveDeepSeekApiKey, resolveListedCatalog, resolveListingTiming } from "@deepseek-ai/dsh-llm-deepseek";
4
+ import { PUBLIC_BASE_URL, catalogModelInfo, createModelListingCache, deepSeekConfigFields, isBuiltInCatalog, modelListingConfigFields, modelListingURL, plainOptions, refuseListedModel, registerDeepSeekProvider, resolveAdapterOptions, resolveListedCatalog, resolveListingTiming } from "@deepseek-ai/dsh-llm-deepseek";
4
5
  import z from "@deepseek-ai/schemastery";
5
6
  import { credentialRef } from "@deepseek-ai/dsh-credentials";
6
7
  //#region lib/types/config.js
@@ -15,9 +16,9 @@ const Config = z.object({
15
16
  * @param config - live plugin configuration.
16
17
  * @returns detached resolver inputs.
17
18
  */
18
- function plainOptions(config) {
19
+ function plainOptions$1(config) {
19
20
  return {
20
- ...plainOptions$1(config),
21
+ ...plainOptions(config),
21
22
  apiKeyEnv: config.apiKeyEnv.get()
22
23
  };
23
24
  }
@@ -26,10 +27,10 @@ function plainOptions(config) {
26
27
  * @param environment - application launch environment.
27
28
  * @returns validated endpoint facts, the matching credential reference, and the listing the catalog follows.
28
29
  */
29
- function resolveAdapterOptions(config, environment) {
30
+ function resolveAdapterOptions$1(config, environment) {
30
31
  const { modelsTimeoutMs: _timeout, modelsMaxAgeMs: _maxAge, apiKeyEnv, ...messages } = config;
31
32
  const timing = resolveListingTiming(config, "llm-deepseek-api-key");
32
- const connection = resolveAdapterOptions$1(messages, environment);
33
+ const connection = resolveAdapterOptions(messages, environment);
33
34
  const listed = new URL(connection.baseURL).origin === OFFICIAL_ORIGIN && isBuiltInCatalog(connection.models);
34
35
  return {
35
36
  ...connection,
@@ -43,32 +44,50 @@ function resolveAdapterOptions(config, environment) {
43
44
  //#endregion
44
45
  //#region lib/types/index.js
45
46
  const name = "llm-deepseek-api-key";
46
- const inject = ["llm"];
47
+ const inject = ["llm", "deepseekAuth"];
47
48
  const PROVIDER = "deepseek-official";
48
49
  /** Console tag of listing diagnostics; product profiles mount no console exporter for `ctx.logger`. */
49
50
  const LOG_TAG = "[llm-deepseek-api-key]";
50
51
  function apply(ctx, config) {
51
- const options = () => resolveAdapterOptions(plainOptions(config), launchEnvironmentOf(ctx));
52
+ /** Settings namespace of this mount, which the provider directory lists and credential diagnostics name. */
53
+ const settingsNs = ctx.fiber.entry?.options.id ?? "llm-deepseek-api-key";
54
+ const options = () => resolveAdapterOptions$1(plainOptions$1(config), launchEnvironmentOf(ctx));
52
55
  options();
53
- const resolveApiKey = async (connection) => {
54
- const ref = connection.apiKeyEnv;
55
- const key = await resolveDeepSeekApiKey(ctx, ref);
56
- if (key !== void 0) return key;
57
- throw new LlmError(`llm-deepseek: no API key for provider route "${PROVIDER}"; store ${ref} through the credentials service (the web Models page writes it), or export ${ref} in the launching environment`, "MISSING_CREDENTIAL");
58
- };
59
- /** The API key, or `undefined` when none is configured; other credential failures propagate. */
60
- const presentApiKey = async (connection) => {
56
+ ctx.effect(() => ctx.deepseekAuth.connect("api-key", PROVIDER, () => {
57
+ const connection = options();
58
+ return {
59
+ baseURL: connection.baseURL,
60
+ reference: connection.apiKeyEnv,
61
+ owner: settingsNs
62
+ };
63
+ }), "llm-deepseek-api-key: API-key deployment");
64
+ /**
65
+ * The key `ctx.deepseekAuth` releases for `endpoint` from one configuration generation, in the header Messages
66
+ * expects; `undefined` when none is configured or `endpoint` is outside the route's deployment. An unusable key fails
67
+ * as this route's `INVALID_CREDENTIAL`; store failures propagate.
68
+ */
69
+ const resolveAuth = async (connection, endpoint) => {
61
70
  try {
62
- return await resolveApiKey(connection);
71
+ return await ctx.deepseekAuth.authorize({
72
+ consumer: settingsNs,
73
+ accepts: ["api-key"],
74
+ billing: "api-key",
75
+ destination: { url: endpoint },
76
+ connections: { "api-key": {
77
+ baseURL: connection.baseURL,
78
+ reference: connection.apiKeyEnv
79
+ } },
80
+ apiKeyHeaders: ["x-api-key"]
81
+ });
63
82
  } catch (error) {
64
- if (error instanceof LlmError && error.code === "MISSING_CREDENTIAL") return void 0;
83
+ if (error instanceof DeepSeekAuthError && error.code === "INVALID_CREDENTIAL") throw new LlmError(error.message, INVALID_CREDENTIAL_CODE, { cause: error });
65
84
  throw error;
66
85
  }
67
86
  };
87
+ const missingCredential = (connection) => new LlmError(`llm-deepseek: no API key for provider route "${PROVIDER}"; store ${connection.apiKeyEnv} through the credentials service (the web Models page writes it), or export ${connection.apiKeyEnv} in the launching environment`, "MISSING_CREDENTIAL");
68
88
  const listings = createModelListingCache(ctx, name, PROVIDER, {
69
89
  settings: () => options().listing,
70
- credential: async () => presentApiKey(options()),
71
- load: (url, apiKey, signal) => requestModelListing(url, { "x-api-key": apiKey }, signal)
90
+ credential: async (url) => (await resolveAuth(options(), url))?.headers
72
91
  });
73
92
  let reportedListing;
74
93
  /** Resolve the catalog, reporting each listing's hidden entries and dropped badges once. */
@@ -100,12 +119,12 @@ function apply(ctx, config) {
100
119
  };
101
120
  ctx.llm.registerConfigurableProviders([{
102
121
  provider: PROVIDER,
103
- displayName: "DeepSeek",
104
- settingsNs: ctx.fiber.entry?.options.id ?? "llm-deepseek-api-key",
122
+ displayName: "DeepSeek API",
123
+ settingsNs,
105
124
  settingsPath: []
106
125
  }]);
107
126
  registerDeepSeekProvider(ctx, PROVIDER, {
108
- providerName: "DeepSeek",
127
+ providerName: "DeepSeek API",
109
128
  options: () => {
110
129
  const connection = options();
111
130
  return connectionOf(connection, connection.listing === void 0 ? void 0 : listings.current());
@@ -122,14 +141,15 @@ function apply(ctx, config) {
122
141
  }
123
142
  return connectionOf(connection, view);
124
143
  },
125
- resolveAuth: async (connection) => ({ headers: { "x-api-key": await resolveApiKey(connection) } }),
144
+ resolveAuth,
145
+ missingCredential,
126
146
  admit: (connection, model) => {
127
147
  refuseListedModel(model, connection.refusals.get(model));
128
148
  },
129
149
  discoverModels: async (provider) => {
130
150
  const connection = options();
131
151
  if (connection.listing === void 0) {
132
- if (await presentApiKey(connection) === void 0) return [];
152
+ if (await resolveAuth(connection, connection.baseURL) === void 0) return [];
133
153
  return connection.models.map((model) => catalogModelInfo(provider, model));
134
154
  }
135
155
  const view = await listings.view(connection.listing);
@@ -151,4 +171,4 @@ function apply(ctx, config) {
151
171
  });
152
172
  }
153
173
  //#endregion
154
- export { Config, apply, inject, name, plainOptions, resolveAdapterOptions };
174
+ export { Config, apply, inject, name };
@@ -26,6 +26,9 @@ export declare const Config: z<Schemastery.ObjectS<NoInfer<{
26
26
  imageOffloadByteQuantum: z<number, number, "volatile-defined">;
27
27
  inlineImageOffloadByteQuantum: z<number, number, "volatile-defined">;
28
28
  imageOffloadCountQuantum: z<number, number, "volatile-defined">;
29
+ fileUploadConcurrency: z<number, number, "volatile-defined">;
30
+ fileUploadMaxRetries: z<number, number, "volatile-defined">;
31
+ fileUploadRetryDelayMs: z<number, number, "volatile-defined">;
29
32
  filesApiTimeoutMs: z<number, number, "volatile-defined">;
30
33
  fileExpiresAfterSeconds: z<number, number, "volatile-defined">;
31
34
  fileRefreshMarginSeconds: z<number, number, "volatile-defined">;
@@ -48,6 +51,9 @@ export declare const Config: z<Schemastery.ObjectS<NoInfer<{
48
51
  imageOffloadByteQuantum: z<number, number, "volatile-defined">;
49
52
  inlineImageOffloadByteQuantum: z<number, number, "volatile-defined">;
50
53
  imageOffloadCountQuantum: z<number, number, "volatile-defined">;
54
+ fileUploadConcurrency: z<number, number, "volatile-defined">;
55
+ fileUploadMaxRetries: z<number, number, "volatile-defined">;
56
+ fileUploadRetryDelayMs: z<number, number, "volatile-defined">;
51
57
  filesApiTimeoutMs: z<number, number, "volatile-defined">;
52
58
  fileExpiresAfterSeconds: z<number, number, "volatile-defined">;
53
59
  fileRefreshMarginSeconds: z<number, number, "volatile-defined">;
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":"AAAA,2GAA2G;AAC3G,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AACnD,OAAO,CAAC,MAAM,0BAA0B,CAAA;AACxC,OAAO,EAAiB,KAAK,aAAa,EAAE,MAAM,8BAA8B,CAAA;AAChF,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,qCAAqC,CAAA;AAKpF,OAAO,KAAK,EACV,MAAM,IAAI,cAAc,EAAE,yBAAyB,EAAE,eAAe,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,OAAO,IAAI,eAAe,EAC1I,MAAM,+BAA+B,CAAA;AAKtC,mEAAmE;AACnE,MAAM,WAAW,MAAO,SAAQ,cAAc,EAAE,kBAAkB;IAChE,+EAA+E;IAC/E,SAAS,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAA;CAC5B;AACD,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;aAIjB,CAAA;AACF,wDAAwD;AACxD,MAAM,MAAM,OAAO,GAAG,eAAe,GAAG,mBAAmB,GAAG;IAAE,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,CAAA;AACpF,yFAAyF;AACzF,MAAM,WAAW,uBAAwB,SAAQ,yBAAyB;IACxE,mEAAmE;IACnE,SAAS,EAAE,aAAa,CAAA;IACxB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AAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAEpD;AACD;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,OAAO,EAAE,WAAW,CAAC,EAAE,yBAAyB,GAAG,uBAAuB,CAUvH"}
@@ -1,7 +1,7 @@
1
1
  /** API-key authentication, credential-gated discovery, and the official model listing for the official DeepSeek route. */
2
2
  import type { Context } from '@deepseek-ai/cordis';
3
3
  import { Config } from './config.ts';
4
- export { Config, plainOptions, resolveAdapterOptions } from './config.ts';
4
+ export { Config } from './config.ts';
5
5
  export type { Options, ResolvedDeepSeekOptions } from './config.ts';
6
6
  export declare const name = "llm-deepseek-api-key";
7
7
  export declare const inject: string[];
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,0HAA0H;AAC1H,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAUlD,OAAO,EAAE,MAAM,EAAuC,MAAM,aAAa,CAAA;AAGzE,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAA;AACzE,YAAY,EAAE,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAA;AACnE,eAAO,MAAM,IAAI,yBAAyB,CAAA;AAC1C,eAAO,MAAM,MAAM,UAAU,CAAA;AAgB7B,wBAAgB,KAAK,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CA0FxD"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,0HAA0H;AAC1H,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAUlD,OAAO,EAAE,MAAM,EAAuC,MAAM,aAAa,CAAA;AAGzE,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,YAAY,EAAE,OAAO,EAAE,uBAAuB,EAAE,MAAM,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,CAAC,IAAI,CAAC,aAAa;gBAAE,OAAO,EAAE,CAAA;YAClC,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,YAAY,CAAC,UAAU,EAAE,IAAI,CAAC,CAAA;YAC1D,OAAO,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,gBAAgB,CAAC,QAAQ,EAAE,KAAK,EAAE,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,CAAA;QACtF,CAAC;KACF,CAAC,CAAA;IACF,oFAAoF;IACpF,wEAAwE;IACxE,IAAI,SAAS,GAAG,OAAO,EAAE,CAAC,OAAO,KAAK,SAAS,CAAA;IAC/C,GAAG,CAAC,EAAE,CAAC,wBAAwB,EAAE,GAAG,EAAE;QACpC,IAAI,IAAa,CAAA;QACjB,4EAA4E;QAC5E,IAAI,CAAC;YAAC,IAAI,GAAG,OAAO,EAAE,CAAC,OAAO,KAAK,SAAS,CAAA;QAAC,CAAC;QAC9C,OAAO,sBAAsB,EAAE,CAAC;YAAC,OAAM;QAAC,CAAC;QACzC,IAAI,IAAI,KAAK,SAAS;YAAE,QAAQ,CAAC,UAAU,EAAE,CAAA;QAC7C,SAAS,GAAG,IAAI,CAAA;IAClB,CAAC,CAAC,CAAA;AACJ,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@deepseek-ai/dsh-llm-deepseek-api-key",
3
3
  "description": "DeepSeek api-key provider authentication and discovery",
4
- "version": "0.2.2-rc.4",
4
+ "version": "0.2.3-alpha.1",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -33,19 +33,21 @@
33
33
  "license": "MIT",
34
34
  "peerDependencies": {
35
35
  "@deepseek-ai/cordis": "~4.1.0",
36
- "@deepseek-ai/dsh-llm": "0.2.2-rc.4",
37
- "@deepseek-ai/dsh-llm-deepseek": "0.2.2-rc.4",
38
- "@deepseek-ai/dsh-launch-environment": "0.2.2-rc.4",
39
- "@deepseek-ai/dsh-credentials": "0.2.2-rc.4",
40
- "@deepseek-ai/cordis-plugin-loader": "~1.1.0"
36
+ "@deepseek-ai/dsh-llm": "0.2.3-alpha.1",
37
+ "@deepseek-ai/dsh-llm-deepseek": "0.2.3-alpha.1",
38
+ "@deepseek-ai/dsh-launch-environment": "0.2.3-alpha.1",
39
+ "@deepseek-ai/dsh-credentials": "0.2.3-alpha.1",
40
+ "@deepseek-ai/cordis-plugin-loader": "~1.1.0",
41
+ "@deepseek-ai/dsh-deepseek-auth": "0.2.3-alpha.1"
41
42
  },
42
43
  "devDependencies": {
43
44
  "@deepseek-ai/cordis": "~4.1.0",
44
- "@deepseek-ai/dsh-llm": "0.2.2-rc.4",
45
- "@deepseek-ai/dsh-llm-deepseek": "0.2.2-rc.4",
46
- "@deepseek-ai/dsh-launch-environment": "0.2.2-rc.4",
47
- "@deepseek-ai/dsh-credentials": "0.2.2-rc.4",
48
- "@deepseek-ai/cordis-plugin-loader": "~1.1.0"
45
+ "@deepseek-ai/dsh-llm": "0.2.3-alpha.1",
46
+ "@deepseek-ai/dsh-llm-deepseek": "0.2.3-alpha.1",
47
+ "@deepseek-ai/dsh-launch-environment": "0.2.3-alpha.1",
48
+ "@deepseek-ai/dsh-credentials": "0.2.3-alpha.1",
49
+ "@deepseek-ai/cordis-plugin-loader": "~1.1.0",
50
+ "@deepseek-ai/dsh-deepseek-auth": "0.2.3-alpha.1"
49
51
  },
50
52
  "peerDependenciesMeta": {
51
53
  "@deepseek-ai/cordis-plugin-loader": {
package/src/index.ts CHANGED
@@ -1,21 +1,21 @@
1
1
  /** API-key authentication, credential-gated discovery, and the official model listing for the official DeepSeek route. */
2
2
  import type { Context } from '@deepseek-ai/cordis'
3
- import { APP_IDENTITY, LlmError } from '@deepseek-ai/dsh-llm'
3
+ import { APP_IDENTITY, INVALID_CREDENTIAL_CODE, LlmError } from '@deepseek-ai/dsh-llm'
4
4
  import type { LlmModelBadge } from '@deepseek-ai/dsh-llm'
5
5
  import type {} from '@deepseek-ai/cordis-plugin-loader'
6
+ import { DeepSeekAuthError } from '@deepseek-ai/dsh-deepseek-auth'
6
7
  import { launchEnvironmentOf } from '@deepseek-ai/dsh-launch-environment'
7
8
  import {
8
- catalogModelInfo, createModelListingCache, refuseListedModel, registerDeepSeekProvider, requestModelListing, resolveListedCatalog,
9
- resolveDeepSeekApiKey,
9
+ catalogModelInfo, createModelListingCache, refuseListedModel, registerDeepSeekProvider, resolveListedCatalog,
10
10
  } from '@deepseek-ai/dsh-llm-deepseek'
11
- import type { CatalogRefusal, DeepSeekCatalogModel, ListingView, ModelListing } from '@deepseek-ai/dsh-llm-deepseek'
11
+ import type { CatalogRefusal, DeepSeekCatalogModel, DeepSeekRequestAuth, ListingView, ModelListing } from '@deepseek-ai/dsh-llm-deepseek'
12
12
  import { Config, plainOptions, resolveAdapterOptions } from './config.ts'
13
13
  import type { ResolvedDeepSeekOptions } from './config.ts'
14
14
 
15
- export { Config, plainOptions, resolveAdapterOptions } from './config.ts'
15
+ export { Config } from './config.ts'
16
16
  export type { Options, ResolvedDeepSeekOptions } from './config.ts'
17
17
  export const name = 'llm-deepseek-api-key'
18
- export const inject = ['llm']
18
+ export const inject = ['llm', 'deepseekAuth']
19
19
 
20
20
  const PROVIDER = 'deepseek-official'
21
21
  /** Console tag of listing diagnostics; product profiles mount no console exporter for `ctx.logger`. */
@@ -32,30 +32,42 @@ interface OfficialConnection extends ResolvedDeepSeekOptions {
32
32
  }
33
33
 
34
34
  export function apply(ctx: Context, config: Config): void {
35
+ /** Settings namespace of this mount, which the provider directory lists and credential diagnostics name. */
36
+ const settingsNs = ctx.fiber.entry?.options.id ?? name
35
37
  const options = () => resolveAdapterOptions(plainOptions(config), launchEnvironmentOf(ctx))
36
38
  options()
37
- const resolveApiKey = async (connection: ResolvedDeepSeekOptions): Promise<string> => {
38
- const ref = connection.apiKeyEnv
39
- const key = await resolveDeepSeekApiKey(ctx, ref)
40
- if (key !== undefined) return key
41
- throw new LlmError(
42
- `llm-deepseek: no API key for provider route "${PROVIDER}"; store ${ref} through the credentials`
43
- + ` service (the web Models page writes it), or export ${ref} in the launching environment`,
44
- 'MISSING_CREDENTIAL',
45
- )
46
- }
47
- /** The API key, or `undefined` when none is configured; other credential failures propagate. */
48
- const presentApiKey = async (connection: ResolvedDeepSeekOptions): Promise<string | undefined> => {
49
- try { return await resolveApiKey(connection) }
50
- catch (error) {
51
- if (error instanceof LlmError && error.code === 'MISSING_CREDENTIAL') return undefined
39
+ // Every other DeepSeek consumer billed by the API key sends this route's key to this route's deployment.
40
+ ctx.effect(() => ctx.deepseekAuth.connect('api-key', PROVIDER, () => {
41
+ const connection = options()
42
+ return { baseURL: connection.baseURL, reference: connection.apiKeyEnv, owner: settingsNs }
43
+ }), 'llm-deepseek-api-key: API-key deployment')
44
+ /**
45
+ * The key `ctx.deepseekAuth` releases for `endpoint` from one configuration generation, in the header Messages
46
+ * expects; `undefined` when none is configured or `endpoint` is outside the route's deployment. An unusable key fails
47
+ * as this route's `INVALID_CREDENTIAL`; store failures propagate.
48
+ */
49
+ const resolveAuth = async (connection: ResolvedDeepSeekOptions, endpoint: string): Promise<DeepSeekRequestAuth | undefined> => {
50
+ try {
51
+ return await ctx.deepseekAuth.authorize({
52
+ consumer: settingsNs, accepts: ['api-key'], billing: 'api-key', destination: { url: endpoint },
53
+ connections: { 'api-key': { baseURL: connection.baseURL, reference: connection.apiKeyEnv } },
54
+ apiKeyHeaders: ['x-api-key'],
55
+ })
56
+ } catch (error) {
57
+ if (error instanceof DeepSeekAuthError && error.code === 'INVALID_CREDENTIAL') {
58
+ throw new LlmError(error.message, INVALID_CREDENTIAL_CODE, { cause: error })
59
+ }
52
60
  throw error
53
61
  }
54
62
  }
63
+ const missingCredential = (connection: ResolvedDeepSeekOptions) => new LlmError(
64
+ `llm-deepseek: no API key for provider route "${PROVIDER}"; store ${connection.apiKeyEnv} through the credentials`
65
+ + ` service (the web Models page writes it), or export ${connection.apiKeyEnv} in the launching environment`,
66
+ 'MISSING_CREDENTIAL',
67
+ )
55
68
  const listings = createModelListingCache(ctx, name, PROVIDER, {
56
69
  settings: () => options().listing,
57
- credential: async () => presentApiKey(options()),
58
- load: (url, apiKey, signal) => requestModelListing(url, { 'x-api-key': apiKey }, signal),
70
+ credential: async url => (await resolveAuth(options(), url))?.headers,
59
71
  })
60
72
  let reportedListing: ModelListing | undefined
61
73
  /** Resolve the catalog, reporting each listing's hidden entries and dropped badges once. */
@@ -75,10 +87,10 @@ export function apply(ctx: Context, config: Config): void {
75
87
  return { ...connection, models: catalog.resolution, offered: catalog.offered, refusals: catalog.refusals, badges: catalog.badges }
76
88
  }
77
89
  ctx.llm.registerConfigurableProviders([
78
- { provider: PROVIDER, displayName: 'DeepSeek', settingsNs: ctx.fiber.entry?.options.id ?? name, settingsPath: [] },
90
+ { provider: PROVIDER, displayName: 'DeepSeek API', settingsNs, settingsPath: [] },
79
91
  ])
80
92
  registerDeepSeekProvider<OfficialConnection>(ctx, PROVIDER, {
81
- providerName: 'DeepSeek',
93
+ providerName: 'DeepSeek API',
82
94
  options: () => {
83
95
  const connection = options()
84
96
  return connectionOf(connection, connection.listing === undefined ? undefined : listings.current())
@@ -96,12 +108,13 @@ export function apply(ctx: Context, config: Config): void {
96
108
  }
97
109
  return connectionOf(connection, view)
98
110
  },
99
- resolveAuth: async connection => ({ headers: { 'x-api-key': await resolveApiKey(connection) } }),
111
+ resolveAuth,
112
+ missingCredential,
100
113
  admit: (connection, model) => { refuseListedModel(model, connection.refusals.get(model)) },
101
114
  discoverModels: async (provider) => {
102
115
  const connection = options()
103
116
  if (connection.listing === undefined) {
104
- if (await presentApiKey(connection) === undefined) return []
117
+ if (await resolveAuth(connection, connection.baseURL) === undefined) return []
105
118
  return connection.models.map(model => catalogModelInfo(provider, model))
106
119
  }
107
120
  const view = await listings.view(connection.listing)