@ai-sdk/gmicloud 3.0.52 → 3.0.54

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/CHANGELOG.md CHANGED
@@ -1,5 +1,32 @@
1
1
  # @ai-sdk/gmicloud
2
2
 
3
+ ## 3.0.54
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [4ae6986]
8
+ - Updated dependencies [51ca5b7]
9
+ - Updated dependencies [dc6f1c3]
10
+ - Updated dependencies [5006d83]
11
+ - Updated dependencies [4ae6986]
12
+ - @ai-sdk/openai-compatible@3.0.83
13
+ - @ai-sdk/provider-utils@5.0.73
14
+
15
+ ## 3.0.53
16
+
17
+ ### Patch Changes
18
+
19
+ - 7716e18: Support promises and synchronous or asynchronous callbacks in provider API key and token settings. Resolve credentials per authenticated request while preserving existing authentication behavior and synchronous credential serialization.
20
+
21
+ The experimental OpenAI Live `getServerWebSocketConfig()` method can now resolve asynchronously. Await its result before using the connection settings.
22
+
23
+ - Updated dependencies [7716e18]
24
+ - Updated dependencies [5c247e9]
25
+ - Updated dependencies [dcd2f8d]
26
+ - @ai-sdk/openai-compatible@3.0.82
27
+ - @ai-sdk/provider-utils@5.0.72
28
+ - @ai-sdk/provider@4.0.35
29
+
3
30
  ## 3.0.52
4
31
 
5
32
  ### Patch Changes
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { LanguageModelV4, ProviderV4 } from "@ai-sdk/provider";
2
- import { FetchFunction } from "@ai-sdk/provider-utils";
2
+ import { FetchFunction, Resolvable } from "@ai-sdk/provider-utils";
3
3
  import "@ai-sdk/openai-compatible";
4
4
  import { z } from "zod/v4";
5
5
  //#region src/gmicloud-chat-options.d.ts
@@ -11,7 +11,7 @@ interface GmicloudProviderSettings {
11
11
  * GMI Cloud API key. Defaults to the `GMI_CLOUD_APIKEY` environment
12
12
  * variable (matching GMI's own SDK package).
13
13
  */
14
- apiKey?: string;
14
+ apiKey?: Resolvable<string>;
15
15
  /**
16
16
  * Base URL for the API calls. Defaults to
17
17
  * `https://api.gmi-serving.com/v1`.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../src/gmicloud-chat-options.ts","../src/gmicloud-provider.ts","../src/gmicloud-error.ts","../src/version.ts"],"mappings":";;;;;KACY;;;UCeK;;;;;EAKf;;;;;EAKA;;;;EAIA,UAAU;;;;;EAKV,QAAQ;;UAGO,yBAAyB;;;;GAIvC,SAAS,sBAAsB;;;;EAKhC,cAAc,SAAS,sBAAsB;;;;EAK7C,KAAK,SAAS,sBAAsB;;;;EAKpC,mBAAmB;;wBAGL,eACd,UAAS,2BACR;qBA8CU,UAAQ;;;cCxGR,yBAAuB,EAAA;;;;;;;;GAQlC,EAAA,KAAA;KAEU,oBAAoB,EAAE,aAAa;;;qBCZlC"}
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../src/gmicloud-chat-options.ts","../src/gmicloud-provider.ts","../src/gmicloud-error.ts","../src/version.ts"],"mappings":";;;;;KACY;;;UCiBK;;;;;EAKf,SAAS;;;;;EAKT;;;;EAIA,UAAU;;;;;EAKV,QAAQ;;UAGO,yBAAyB;;;;GAIvC,SAAS,sBAAsB;;;;EAKhC,cAAc,SAAS,sBAAsB;;;;EAK7C,KAAK,SAAS,sBAAsB;;;;EAKpC,mBAAmB;;wBAGL,eACd,UAAS,2BACR;qBAgDU,UAAQ;;;cC5GR,yBAAuB,EAAA;;;;;;;;GAQlC,EAAA,KAAA;KAEU,oBAAoB,EAAE,aAAa;;;qBCZlC"}
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { NoSuchModelError } from "@ai-sdk/provider";
2
- import { WORKFLOW_DESERIALIZE, WORKFLOW_SERIALIZE, loadApiKey, secureJsonParse, serializeModelOptions, withUserAgentSuffix, withoutTrailingSlash } from "@ai-sdk/provider-utils";
2
+ import { WORKFLOW_DESERIALIZE, WORKFLOW_SERIALIZE, loadApiKey, resolveWith, secureJsonParse, serializeModelOptions, withUserAgentSuffix, withoutTrailingSlash } from "@ai-sdk/provider-utils";
3
3
  import { OpenAICompatibleChatLanguageModel } from "@ai-sdk/openai-compatible";
4
4
  import { z } from "zod/v4";
5
5
  //#region src/gmicloud-chat-language-model.ts
@@ -46,19 +46,19 @@ const gmicloudErrorStructure = {
46
46
  };
47
47
  //#endregion
48
48
  //#region src/version.ts
49
- const VERSION = "3.0.52";
49
+ const VERSION = "3.0.54";
50
50
  //#endregion
51
51
  //#region src/gmicloud-provider.ts
52
52
  function createGmicloud(options = {}) {
53
53
  const baseURL = withoutTrailingSlash(options.baseURL ?? "https://api.gmi-serving.com/v1");
54
- const getHeaders = () => withUserAgentSuffix({
54
+ const getHeaders = () => resolveWith(options.apiKey, (apiKey) => withUserAgentSuffix({
55
55
  Authorization: `Bearer ${loadApiKey({
56
- apiKey: options.apiKey,
56
+ apiKey,
57
57
  environmentVariableName: "GMI_CLOUD_APIKEY",
58
58
  description: "GMI Cloud API key"
59
59
  })}`,
60
60
  ...options.headers
61
- }, `ai-sdk-gmicloud/${VERSION}`);
61
+ }, `ai-sdk-gmicloud/${VERSION}`));
62
62
  const createLanguageModel = (modelId) => {
63
63
  return new GmicloudChatLanguageModel(modelId, {
64
64
  provider: `gmicloud.chat`,
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../src/gmicloud-chat-language-model.ts","../src/gmicloud-error.ts","../src/version.ts","../src/gmicloud-provider.ts"],"sourcesContent":["import { OpenAICompatibleChatLanguageModel } from '@ai-sdk/openai-compatible';\nimport type { LanguageModelV4 } from '@ai-sdk/provider';\nimport {\n serializeModelOptions,\n WORKFLOW_DESERIALIZE,\n WORKFLOW_SERIALIZE,\n} from '@ai-sdk/provider-utils';\nimport type { GmicloudChatModelId } from './gmicloud-chat-language-model-options';\n\ntype GmicloudChatConfig = ConstructorParameters<\n typeof OpenAICompatibleChatLanguageModel\n>[1];\n\n/**\n * GMI Cloud chat completions over the OpenAI-compatible protocol. The only\n * customization is the error structure (see ./gmicloud-error.ts): GMI's edge\n * nests the backend engine's diagnostic in `error.details`, which the default\n * OpenAI-compatible error handling drops.\n */\nexport class GmicloudChatLanguageModel\n extends OpenAICompatibleChatLanguageModel\n implements LanguageModelV4\n{\n static [WORKFLOW_SERIALIZE](model: GmicloudChatLanguageModel) {\n return serializeModelOptions({\n modelId: model.modelId,\n config: model.config,\n });\n }\n\n static [WORKFLOW_DESERIALIZE](options: {\n modelId: GmicloudChatModelId;\n config: GmicloudChatConfig;\n }) {\n return new GmicloudChatLanguageModel(options.modelId, options.config);\n }\n}\n","import type { ProviderErrorStructure } from '@ai-sdk/openai-compatible';\nimport { secureJsonParse } from '@ai-sdk/provider-utils';\nimport { z } from 'zod/v4';\n\nexport const gmicloudErrorDataSchema = z.object({\n error: z.object({\n message: z.string(),\n type: z.string().nullish(),\n param: z.any().nullish(),\n code: z.union([z.string(), z.number()]).nullish(),\n details: z.string().nullish(),\n }),\n});\n\nexport type GmicloudErrorData = z.infer<typeof gmicloudErrorDataSchema>;\n\nfunction unwrapDetailsMessage(details: string | null | undefined) {\n if (details == null || details === '') {\n return undefined;\n }\n let parsed: unknown;\n try {\n parsed = secureJsonParse(details);\n } catch {\n return undefined;\n }\n const message = (parsed as { error?: { message?: unknown } })?.error?.message;\n return typeof message === 'string' && message.trim() !== ''\n ? message\n : undefined;\n}\n\nexport const gmicloudErrorStructure: ProviderErrorStructure<GmicloudErrorData> =\n {\n errorSchema: gmicloudErrorDataSchema,\n errorToMessage: data =>\n unwrapDetailsMessage(data.error.details) ?? data.error.message,\n };\n","// Version string of this package injected at build time.\ndeclare const __PACKAGE_VERSION__: string | undefined;\nexport const VERSION: string =\n typeof __PACKAGE_VERSION__ !== 'undefined'\n ? __PACKAGE_VERSION__\n : '0.0.0-test';\n","import {\n NoSuchModelError,\n type LanguageModelV4,\n type ProviderV4,\n} from '@ai-sdk/provider';\nimport {\n loadApiKey,\n withoutTrailingSlash,\n withUserAgentSuffix,\n type FetchFunction,\n} from '@ai-sdk/provider-utils';\nimport { GmicloudChatLanguageModel } from './gmicloud-chat-language-model';\nimport type { GmicloudChatModelId } from './gmicloud-chat-options';\nimport { gmicloudErrorStructure } from './gmicloud-error';\nimport { VERSION } from './version';\n\nexport interface GmicloudProviderSettings {\n /**\n * GMI Cloud API key. Defaults to the `GMI_CLOUD_APIKEY` environment\n * variable (matching GMI's own SDK package).\n */\n apiKey?: string;\n /**\n * Base URL for the API calls. Defaults to\n * `https://api.gmi-serving.com/v1`.\n */\n baseURL?: string;\n /**\n * Custom headers to include in the requests.\n */\n headers?: Record<string, string>;\n /**\n * Custom fetch implementation. You can use it as a middleware to intercept\n * requests, or to provide a custom fetch implementation for e.g. testing.\n */\n fetch?: FetchFunction;\n}\n\nexport interface GmicloudProvider extends ProviderV4 {\n /**\n * Creates a GMI Cloud model for text generation.\n */\n (modelId: GmicloudChatModelId): LanguageModelV4;\n\n /**\n * Creates a GMI Cloud model for text generation.\n */\n languageModel(modelId: GmicloudChatModelId): LanguageModelV4;\n\n /**\n * Creates a GMI Cloud chat model for text generation.\n */\n chat(modelId: GmicloudChatModelId): LanguageModelV4;\n\n /**\n * @deprecated Use `embeddingModel` instead.\n */\n textEmbeddingModel(modelId: string): never;\n}\n\nexport function createGmicloud(\n options: GmicloudProviderSettings = {},\n): GmicloudProvider {\n const baseURL = withoutTrailingSlash(\n options.baseURL ?? 'https://api.gmi-serving.com/v1',\n );\n const getHeaders = () =>\n withUserAgentSuffix(\n {\n Authorization: `Bearer ${loadApiKey({\n apiKey: options.apiKey,\n environmentVariableName: 'GMI_CLOUD_APIKEY',\n description: 'GMI Cloud API key',\n })}`,\n ...options.headers,\n },\n `ai-sdk-gmicloud/${VERSION}`,\n );\n\n const createLanguageModel = (modelId: GmicloudChatModelId) => {\n return new GmicloudChatLanguageModel(modelId, {\n provider: `gmicloud.chat`,\n url: ({ path }) => `${baseURL}${path}`,\n headers: getHeaders,\n fetch: options.fetch,\n errorStructure: gmicloudErrorStructure,\n includeUsage: true,\n });\n };\n\n const provider = (modelId: GmicloudChatModelId) =>\n createLanguageModel(modelId);\n\n provider.specificationVersion = 'v4' as const;\n provider.languageModel = createLanguageModel;\n provider.chat = createLanguageModel;\n\n provider.embeddingModel = (modelId: string) => {\n throw new NoSuchModelError({ modelId, modelType: 'embeddingModel' });\n };\n provider.textEmbeddingModel = provider.embeddingModel;\n provider.imageModel = (modelId: string) => {\n throw new NoSuchModelError({ modelId, modelType: 'imageModel' });\n };\n\n return provider;\n}\n\nexport const gmicloud = createGmicloud();\n"],"mappings":";;;;;;;;;;;AAmBA,IAAa,4BAAb,MAAa,kCACH,kCAEV;CACE,QAAQ,oBAAoB,OAAkC;EAC5D,OAAO,sBAAsB;GAC3B,SAAS,MAAM;GACf,QAAQ,MAAM;EAChB,CAAC;CACH;CAEA,QAAQ,sBAAsB,SAG3B;EACD,OAAO,IAAI,0BAA0B,QAAQ,SAAS,QAAQ,MAAM;CACtE;AACF;;;AChCA,MAAa,0BAA0B,EAAE,OAAO,EAC9C,OAAO,EAAE,OAAO;CACd,SAAS,EAAE,OAAO;CAClB,MAAM,EAAE,OAAO,CAAC,CAAC,QAAQ;CACzB,OAAO,EAAE,IAAI,CAAC,CAAC,QAAQ;CACvB,MAAM,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,QAAQ;CAChD,SAAS,EAAE,OAAO,CAAC,CAAC,QAAQ;AAC9B,CAAC,EACH,CAAC;AAID,SAAS,qBAAqB,SAAoC;CAChE,IAAI,WAAW,QAAQ,YAAY,IACjC;CAEF,IAAI;CACJ,IAAI;EACF,SAAS,gBAAgB,OAAO;CAClC,QAAQ;EACN;CACF;CACA,MAAM,UAAW,QAA8C,OAAO;CACtE,OAAO,OAAO,YAAY,YAAY,QAAQ,KAAK,MAAM,KACrD,UACA,KAAA;AACN;AAEA,MAAa,yBACX;CACE,aAAa;CACb,iBAAgB,SACd,qBAAqB,KAAK,MAAM,OAAO,KAAK,KAAK,MAAM;AAC3D;;;ACnCF,MAAa,UAAA;;;AC0Db,SAAgB,eACd,UAAoC,CAAC,GACnB;CAClB,MAAM,UAAU,qBACd,QAAQ,WAAW,gCACrB;CACA,MAAM,mBACJ,oBACE;EACE,eAAe,UAAU,WAAW;GAClC,QAAQ,QAAQ;GAChB,yBAAyB;GACzB,aAAa;EACf,CAAC;EACD,GAAG,QAAQ;CACb,GACA,mBAAmB,SACrB;CAEF,MAAM,uBAAuB,YAAiC;EAC5D,OAAO,IAAI,0BAA0B,SAAS;GAC5C,UAAU;GACV,MAAM,EAAE,WAAW,GAAG,UAAU;GAChC,SAAS;GACT,OAAO,QAAQ;GACf,gBAAgB;GAChB,cAAc;EAChB,CAAC;CACH;CAEA,MAAM,YAAY,YAChB,oBAAoB,OAAO;CAE7B,SAAS,uBAAuB;CAChC,SAAS,gBAAgB;CACzB,SAAS,OAAO;CAEhB,SAAS,kBAAkB,YAAoB;EAC7C,MAAM,IAAI,iBAAiB;GAAE;GAAS,WAAW;EAAiB,CAAC;CACrE;CACA,SAAS,qBAAqB,SAAS;CACvC,SAAS,cAAc,YAAoB;EACzC,MAAM,IAAI,iBAAiB;GAAE;GAAS,WAAW;EAAa,CAAC;CACjE;CAEA,OAAO;AACT;AAEA,MAAa,WAAW,eAAe"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../src/gmicloud-chat-language-model.ts","../src/gmicloud-error.ts","../src/version.ts","../src/gmicloud-provider.ts"],"sourcesContent":["import { OpenAICompatibleChatLanguageModel } from '@ai-sdk/openai-compatible';\nimport type { LanguageModelV4 } from '@ai-sdk/provider';\nimport {\n serializeModelOptions,\n WORKFLOW_DESERIALIZE,\n WORKFLOW_SERIALIZE,\n} from '@ai-sdk/provider-utils';\nimport type { GmicloudChatModelId } from './gmicloud-chat-language-model-options';\n\ntype GmicloudChatConfig = ConstructorParameters<\n typeof OpenAICompatibleChatLanguageModel\n>[1];\n\n/**\n * GMI Cloud chat completions over the OpenAI-compatible protocol. The only\n * customization is the error structure (see ./gmicloud-error.ts): GMI's edge\n * nests the backend engine's diagnostic in `error.details`, which the default\n * OpenAI-compatible error handling drops.\n */\nexport class GmicloudChatLanguageModel\n extends OpenAICompatibleChatLanguageModel\n implements LanguageModelV4\n{\n static [WORKFLOW_SERIALIZE](model: GmicloudChatLanguageModel) {\n return serializeModelOptions({\n modelId: model.modelId,\n config: model.config,\n });\n }\n\n static [WORKFLOW_DESERIALIZE](options: {\n modelId: GmicloudChatModelId;\n config: GmicloudChatConfig;\n }) {\n return new GmicloudChatLanguageModel(options.modelId, options.config);\n }\n}\n","import type { ProviderErrorStructure } from '@ai-sdk/openai-compatible';\nimport { secureJsonParse } from '@ai-sdk/provider-utils';\nimport { z } from 'zod/v4';\n\nexport const gmicloudErrorDataSchema = z.object({\n error: z.object({\n message: z.string(),\n type: z.string().nullish(),\n param: z.any().nullish(),\n code: z.union([z.string(), z.number()]).nullish(),\n details: z.string().nullish(),\n }),\n});\n\nexport type GmicloudErrorData = z.infer<typeof gmicloudErrorDataSchema>;\n\nfunction unwrapDetailsMessage(details: string | null | undefined) {\n if (details == null || details === '') {\n return undefined;\n }\n let parsed: unknown;\n try {\n parsed = secureJsonParse(details);\n } catch {\n return undefined;\n }\n const message = (parsed as { error?: { message?: unknown } })?.error?.message;\n return typeof message === 'string' && message.trim() !== ''\n ? message\n : undefined;\n}\n\nexport const gmicloudErrorStructure: ProviderErrorStructure<GmicloudErrorData> =\n {\n errorSchema: gmicloudErrorDataSchema,\n errorToMessage: data =>\n unwrapDetailsMessage(data.error.details) ?? data.error.message,\n };\n","// Version string of this package injected at build time.\ndeclare const __PACKAGE_VERSION__: string | undefined;\nexport const VERSION: string =\n typeof __PACKAGE_VERSION__ !== 'undefined'\n ? __PACKAGE_VERSION__\n : '0.0.0-test';\n","import {\n NoSuchModelError,\n type LanguageModelV4,\n type ProviderV4,\n} from '@ai-sdk/provider';\nimport {\n resolveWith,\n type Resolvable,\n loadApiKey,\n withoutTrailingSlash,\n withUserAgentSuffix,\n type FetchFunction,\n} from '@ai-sdk/provider-utils';\nimport { GmicloudChatLanguageModel } from './gmicloud-chat-language-model';\nimport type { GmicloudChatModelId } from './gmicloud-chat-options';\nimport { gmicloudErrorStructure } from './gmicloud-error';\nimport { VERSION } from './version';\n\nexport interface GmicloudProviderSettings {\n /**\n * GMI Cloud API key. Defaults to the `GMI_CLOUD_APIKEY` environment\n * variable (matching GMI's own SDK package).\n */\n apiKey?: Resolvable<string>;\n /**\n * Base URL for the API calls. Defaults to\n * `https://api.gmi-serving.com/v1`.\n */\n baseURL?: string;\n /**\n * Custom headers to include in the requests.\n */\n headers?: Record<string, string>;\n /**\n * Custom fetch implementation. You can use it as a middleware to intercept\n * requests, or to provide a custom fetch implementation for e.g. testing.\n */\n fetch?: FetchFunction;\n}\n\nexport interface GmicloudProvider extends ProviderV4 {\n /**\n * Creates a GMI Cloud model for text generation.\n */\n (modelId: GmicloudChatModelId): LanguageModelV4;\n\n /**\n * Creates a GMI Cloud model for text generation.\n */\n languageModel(modelId: GmicloudChatModelId): LanguageModelV4;\n\n /**\n * Creates a GMI Cloud chat model for text generation.\n */\n chat(modelId: GmicloudChatModelId): LanguageModelV4;\n\n /**\n * @deprecated Use `embeddingModel` instead.\n */\n textEmbeddingModel(modelId: string): never;\n}\n\nexport function createGmicloud(\n options: GmicloudProviderSettings = {},\n): GmicloudProvider {\n const baseURL = withoutTrailingSlash(\n options.baseURL ?? 'https://api.gmi-serving.com/v1',\n );\n const getHeaders = () =>\n resolveWith(options.apiKey, apiKey =>\n withUserAgentSuffix(\n {\n Authorization: `Bearer ${loadApiKey({\n apiKey,\n environmentVariableName: 'GMI_CLOUD_APIKEY',\n description: 'GMI Cloud API key',\n })}`,\n ...options.headers,\n },\n `ai-sdk-gmicloud/${VERSION}`,\n ),\n );\n\n const createLanguageModel = (modelId: GmicloudChatModelId) => {\n return new GmicloudChatLanguageModel(modelId, {\n provider: `gmicloud.chat`,\n url: ({ path }) => `${baseURL}${path}`,\n headers: getHeaders,\n fetch: options.fetch,\n errorStructure: gmicloudErrorStructure,\n includeUsage: true,\n });\n };\n\n const provider = (modelId: GmicloudChatModelId) =>\n createLanguageModel(modelId);\n\n provider.specificationVersion = 'v4' as const;\n provider.languageModel = createLanguageModel;\n provider.chat = createLanguageModel;\n\n provider.embeddingModel = (modelId: string) => {\n throw new NoSuchModelError({ modelId, modelType: 'embeddingModel' });\n };\n provider.textEmbeddingModel = provider.embeddingModel;\n provider.imageModel = (modelId: string) => {\n throw new NoSuchModelError({ modelId, modelType: 'imageModel' });\n };\n\n return provider;\n}\n\nexport const gmicloud = createGmicloud();\n"],"mappings":";;;;;;;;;;;AAmBA,IAAa,4BAAb,MAAa,kCACH,kCAEV;CACE,QAAQ,oBAAoB,OAAkC;EAC5D,OAAO,sBAAsB;GAC3B,SAAS,MAAM;GACf,QAAQ,MAAM;EAChB,CAAC;CACH;CAEA,QAAQ,sBAAsB,SAG3B;EACD,OAAO,IAAI,0BAA0B,QAAQ,SAAS,QAAQ,MAAM;CACtE;AACF;;;AChCA,MAAa,0BAA0B,EAAE,OAAO,EAC9C,OAAO,EAAE,OAAO;CACd,SAAS,EAAE,OAAO;CAClB,MAAM,EAAE,OAAO,CAAC,CAAC,QAAQ;CACzB,OAAO,EAAE,IAAI,CAAC,CAAC,QAAQ;CACvB,MAAM,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,QAAQ;CAChD,SAAS,EAAE,OAAO,CAAC,CAAC,QAAQ;AAC9B,CAAC,EACH,CAAC;AAID,SAAS,qBAAqB,SAAoC;CAChE,IAAI,WAAW,QAAQ,YAAY,IACjC;CAEF,IAAI;CACJ,IAAI;EACF,SAAS,gBAAgB,OAAO;CAClC,QAAQ;EACN;CACF;CACA,MAAM,UAAW,QAA8C,OAAO;CACtE,OAAO,OAAO,YAAY,YAAY,QAAQ,KAAK,MAAM,KACrD,UACA,KAAA;AACN;AAEA,MAAa,yBACX;CACE,aAAa;CACb,iBAAgB,SACd,qBAAqB,KAAK,MAAM,OAAO,KAAK,KAAK,MAAM;AAC3D;;;ACnCF,MAAa,UAAA;;;AC4Db,SAAgB,eACd,UAAoC,CAAC,GACnB;CAClB,MAAM,UAAU,qBACd,QAAQ,WAAW,gCACrB;CACA,MAAM,mBACJ,YAAY,QAAQ,SAAQ,WAC1B,oBACE;EACE,eAAe,UAAU,WAAW;GAClC;GACA,yBAAyB;GACzB,aAAa;EACf,CAAC;EACD,GAAG,QAAQ;CACb,GACA,mBAAmB,SACrB,CACF;CAEF,MAAM,uBAAuB,YAAiC;EAC5D,OAAO,IAAI,0BAA0B,SAAS;GAC5C,UAAU;GACV,MAAM,EAAE,WAAW,GAAG,UAAU;GAChC,SAAS;GACT,OAAO,QAAQ;GACf,gBAAgB;GAChB,cAAc;EAChB,CAAC;CACH;CAEA,MAAM,YAAY,YAChB,oBAAoB,OAAO;CAE7B,SAAS,uBAAuB;CAChC,SAAS,gBAAgB;CACzB,SAAS,OAAO;CAEhB,SAAS,kBAAkB,YAAoB;EAC7C,MAAM,IAAI,iBAAiB;GAAE;GAAS,WAAW;EAAiB,CAAC;CACrE;CACA,SAAS,qBAAqB,SAAS;CACvC,SAAS,cAAc,YAAoB;EACzC,MAAM,IAAI,iBAAiB;GAAE;GAAS,WAAW;EAAa,CAAC;CACjE;CAEA,OAAO;AACT;AAEA,MAAa,WAAW,eAAe"}
@@ -87,7 +87,11 @@ You can use the following optional settings to customize the GMI Cloud provider
87
87
  Use a different URL prefix for API calls.
88
88
  The default prefix is `https://api.gmi-serving.com/v1`.
89
89
 
90
- - **apiKey** _string_
90
+ - **apiKey** _string | PromiseLike&lt;string&gt; | (() =&gt; string | PromiseLike&lt;string&gt;)_
91
+
92
+ Pass a function to resolve credentials before each request, including when keys
93
+ rotate. The function can return a string or a promise. Credential caching and
94
+ refresh are managed by the function.
91
95
 
92
96
  API key that is being sent using the `Authorization` header. It defaults to
93
97
  the `GMI_CLOUD_APIKEY` environment variable.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-sdk/gmicloud",
3
- "version": "3.0.52",
3
+ "version": "3.0.54",
4
4
  "type": "module",
5
5
  "license": "Apache-2.0",
6
6
  "sideEffects": false,
@@ -29,9 +29,9 @@
29
29
  }
30
30
  },
31
31
  "dependencies": {
32
- "@ai-sdk/openai-compatible": "3.0.81",
33
- "@ai-sdk/provider": "4.0.34",
34
- "@ai-sdk/provider-utils": "5.0.71"
32
+ "@ai-sdk/openai-compatible": "3.0.83",
33
+ "@ai-sdk/provider": "4.0.35",
34
+ "@ai-sdk/provider-utils": "5.0.73"
35
35
  },
36
36
  "devDependencies": {
37
37
  "@types/node": "22.19.19",
@@ -4,6 +4,8 @@ import {
4
4
  type ProviderV4,
5
5
  } from '@ai-sdk/provider';
6
6
  import {
7
+ resolveWith,
8
+ type Resolvable,
7
9
  loadApiKey,
8
10
  withoutTrailingSlash,
9
11
  withUserAgentSuffix,
@@ -19,7 +21,7 @@ export interface GmicloudProviderSettings {
19
21
  * GMI Cloud API key. Defaults to the `GMI_CLOUD_APIKEY` environment
20
22
  * variable (matching GMI's own SDK package).
21
23
  */
22
- apiKey?: string;
24
+ apiKey?: Resolvable<string>;
23
25
  /**
24
26
  * Base URL for the API calls. Defaults to
25
27
  * `https://api.gmi-serving.com/v1`.
@@ -65,16 +67,18 @@ export function createGmicloud(
65
67
  options.baseURL ?? 'https://api.gmi-serving.com/v1',
66
68
  );
67
69
  const getHeaders = () =>
68
- withUserAgentSuffix(
69
- {
70
- Authorization: `Bearer ${loadApiKey({
71
- apiKey: options.apiKey,
72
- environmentVariableName: 'GMI_CLOUD_APIKEY',
73
- description: 'GMI Cloud API key',
74
- })}`,
75
- ...options.headers,
76
- },
77
- `ai-sdk-gmicloud/${VERSION}`,
70
+ resolveWith(options.apiKey, apiKey =>
71
+ withUserAgentSuffix(
72
+ {
73
+ Authorization: `Bearer ${loadApiKey({
74
+ apiKey,
75
+ environmentVariableName: 'GMI_CLOUD_APIKEY',
76
+ description: 'GMI Cloud API key',
77
+ })}`,
78
+ ...options.headers,
79
+ },
80
+ `ai-sdk-gmicloud/${VERSION}`,
81
+ ),
78
82
  );
79
83
 
80
84
  const createLanguageModel = (modelId: GmicloudChatModelId) => {