@opengeni/config 0.10.0 → 0.10.3

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/dist/index.d.ts CHANGED
@@ -163,6 +163,7 @@ declare const SettingsSchema: z.ZodObject<{
163
163
  openaiBaseUrl: z.ZodOptional<z.ZodString>;
164
164
  openaiModel: z.ZodDefault<z.ZodString>;
165
165
  openaiAllowedModels: z.ZodDefault<z.ZodString>;
166
+ vercelAiGatewayApiKey: z.ZodOptional<z.ZodString>;
166
167
  voiceInputMaxDurationSeconds: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
167
168
  voiceInputMaxSizeBytes: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
168
169
  voiceInputProviderOrder: z.ZodDefault<z.ZodString>;
@@ -189,6 +190,7 @@ declare const SettingsSchema: z.ZodObject<{
189
190
  openaiReasoningEffort: z.ZodDefault<z.ZodEnum<{
190
191
  high: "high";
191
192
  low: "low";
193
+ max: "max";
192
194
  medium: "medium";
193
195
  minimal: "minimal";
194
196
  none: "none";
@@ -527,6 +529,7 @@ export declare const ModelCapabilitiesV1Schema: z.ZodObject<{
527
529
  efforts: z.ZodArray<z.ZodEnum<{
528
530
  high: "high";
529
531
  low: "low";
532
+ max: "max";
530
533
  medium: "medium";
531
534
  minimal: "minimal";
532
535
  none: "none";
@@ -535,6 +538,7 @@ export declare const ModelCapabilitiesV1Schema: z.ZodObject<{
535
538
  defaultEffort: z.ZodNullable<z.ZodEnum<{
536
539
  high: "high";
537
540
  low: "low";
541
+ max: "max";
538
542
  medium: "medium";
539
543
  minimal: "minimal";
540
544
  none: "none";
@@ -620,6 +624,19 @@ export declare const ModelCapabilitiesV1Schema: z.ZodObject<{
620
624
  runnable: z.ZodBoolean;
621
625
  }, z.core.$strip>;
622
626
  }, z.core.$strip>;
627
+ promptCaching: z.ZodOptional<z.ZodObject<{
628
+ upstream: z.ZodEnum<{
629
+ supported: "supported";
630
+ unknown: "unknown";
631
+ unsupported: "unsupported";
632
+ }>;
633
+ runnable: z.ZodBoolean;
634
+ mode: z.ZodEnum<{
635
+ automatic: "automatic";
636
+ implicit: "implicit";
637
+ none: "none";
638
+ }>;
639
+ }, z.core.$strip>>;
623
640
  latencyModes: z.ZodArray<z.ZodObject<{
624
641
  id: z.ZodEnum<{
625
642
  fast: "fast";
@@ -680,6 +697,8 @@ export type ModelProviderApi = z.infer<typeof ModelProviderApi>;
680
697
  export declare const RegistryProviderKind: z.ZodEnum<{
681
698
  "api-key": "api-key";
682
699
  "codex-subscription": "codex-subscription";
700
+ "vercel-gateway-managed": "vercel-gateway-managed";
701
+ "vercel-gateway-workspace": "vercel-gateway-workspace";
683
702
  }>;
684
703
  export type RegistryProviderKind = z.infer<typeof RegistryProviderKind>;
685
704
  /** A non-built-in provider declared by the host via OPENGENI_MODEL_PROVIDERS_JSON. */
@@ -687,6 +706,8 @@ declare const RegistryProviderSchema: z.ZodObject<{
687
706
  kind: z.ZodDefault<z.ZodEnum<{
688
707
  "api-key": "api-key";
689
708
  "codex-subscription": "codex-subscription";
709
+ "vercel-gateway-managed": "vercel-gateway-managed";
710
+ "vercel-gateway-workspace": "vercel-gateway-workspace";
690
711
  }>>;
691
712
  id: z.ZodString;
692
713
  label: z.ZodOptional<z.ZodString>;
@@ -725,6 +746,7 @@ declare const RegistryProviderSchema: z.ZodObject<{
725
746
  efforts: z.ZodArray<z.ZodEnum<{
726
747
  high: "high";
727
748
  low: "low";
749
+ max: "max";
728
750
  medium: "medium";
729
751
  minimal: "minimal";
730
752
  none: "none";
@@ -733,6 +755,7 @@ declare const RegistryProviderSchema: z.ZodObject<{
733
755
  defaultEffort: z.ZodNullable<z.ZodEnum<{
734
756
  high: "high";
735
757
  low: "low";
758
+ max: "max";
736
759
  medium: "medium";
737
760
  minimal: "minimal";
738
761
  none: "none";
@@ -818,6 +841,19 @@ declare const RegistryProviderSchema: z.ZodObject<{
818
841
  runnable: z.ZodBoolean;
819
842
  }, z.core.$strip>;
820
843
  }, z.core.$strip>;
844
+ promptCaching: z.ZodOptional<z.ZodObject<{
845
+ upstream: z.ZodEnum<{
846
+ supported: "supported";
847
+ unknown: "unknown";
848
+ unsupported: "unsupported";
849
+ }>;
850
+ runnable: z.ZodBoolean;
851
+ mode: z.ZodEnum<{
852
+ automatic: "automatic";
853
+ implicit: "implicit";
854
+ none: "none";
855
+ }>;
856
+ }, z.core.$strip>>;
821
857
  latencyModes: z.ZodArray<z.ZodObject<{
822
858
  id: z.ZodEnum<{
823
859
  fast: "fast";
@@ -907,6 +943,12 @@ export interface ConfiguredModel {
907
943
  credentialSource: CredentialSourceV1;
908
944
  billing: BillingAttributionV1;
909
945
  capabilities: ModelCapabilitiesV1;
946
+ requestPolicy?: {
947
+ gateway: {
948
+ only: [string, ...string[]];
949
+ caching: "auto" | "none";
950
+ };
951
+ };
910
952
  pricing?: ModelPricingScheduleV1 | undefined;
911
953
  definitionVersion: string;
912
954
  contextWindowTokens?: number | undefined;
@@ -916,6 +958,63 @@ export interface ConfiguredModel {
916
958
  reasoningEffort: boolean;
917
959
  hostedWebSearch: boolean;
918
960
  }
961
+ export declare const VERCEL_AI_GATEWAY_BASE_URL: "https://ai-gateway.vercel.sh/v1";
962
+ export declare const VERCEL_AI_GATEWAY_AI_SDK_BASE_URL: "https://ai-gateway.vercel.sh/v4/ai";
963
+ export declare const OPENGENI_GATEWAY_PROVIDER_ID: "opengeni-gateway";
964
+ export declare const WORKSPACE_GATEWAY_PROVIDER_ID: "workspace-gateway";
965
+ export declare const WORKSPACE_GATEWAY_MODEL_ID_PREFIX: "workspace-gateway/";
966
+ export declare const VERCEL_AI_GATEWAY_CONNECTION_DOMAIN: "ai-gateway.vercel.sh";
967
+ export declare const VERCEL_AI_GATEWAY_CONNECTION_ROLE: "vercel_ai_gateway";
968
+ export declare const CODEX_REALTIME_MODEL_ID: "gpt-live-1-boulder-alpha";
969
+ export declare const OPENGENI_REALTIME_MODEL_ID_PREFIX: "opengeni-gateway/";
970
+ export declare const WORKSPACE_REALTIME_MODEL_ID_PREFIX: "workspace-gateway/";
971
+ /** Curated voice models exposed through AI Gateway's normalized realtime API. */
972
+ export declare const AI_GATEWAY_REALTIME_MODELS: {
973
+ readonly openaiRealtime21: {
974
+ readonly upstreamModelId: "openai/gpt-realtime-2.1";
975
+ readonly managedModelId: "opengeni-gateway/openai/gpt-realtime-2.1";
976
+ readonly workspaceModelId: "workspace-gateway/openai/gpt-realtime-2.1";
977
+ readonly label: "GPT Realtime 2.1";
978
+ readonly description: "Best overall voice intelligence";
979
+ };
980
+ readonly openaiRealtimeMini: {
981
+ readonly upstreamModelId: "openai/gpt-realtime-mini";
982
+ readonly managedModelId: "opengeni-gateway/openai/gpt-realtime-mini";
983
+ readonly workspaceModelId: "workspace-gateway/openai/gpt-realtime-mini";
984
+ readonly label: "GPT Realtime Mini";
985
+ readonly description: "Faster, lighter live voice";
986
+ };
987
+ readonly grokVoiceThinkFast20: {
988
+ readonly upstreamModelId: "xai/grok-voice-think-fast-2.0";
989
+ readonly managedModelId: "opengeni-gateway/xai/grok-voice-think-fast-2.0";
990
+ readonly workspaceModelId: "workspace-gateway/xai/grok-voice-think-fast-2.0";
991
+ readonly label: "Grok Voice Think Fast 2.0";
992
+ readonly description: "Fast, natural xAI voice";
993
+ };
994
+ };
995
+ export type AiGatewayRealtimeModel = (typeof AI_GATEWAY_REALTIME_MODELS)[keyof typeof AI_GATEWAY_REALTIME_MODELS];
996
+ export declare function resolveAiGatewayRealtimeModel(modelId: string): {
997
+ source: "managed" | "workspace";
998
+ upstreamModelId: string;
999
+ } | null;
1000
+ export declare const OPENGENI_GATEWAY_MODELS: {
1001
+ readonly deepseek: {
1002
+ readonly productId: "deepseek-v4-flash-0731";
1003
+ readonly workspaceProductId: "workspace-gateway/deepseek-v4-flash-0731";
1004
+ readonly upstreamModelId: "deepseek/deepseek-v4-flash-0731";
1005
+ readonly label: "DeepSeek V4 Flash 0731";
1006
+ readonly providers: readonly ["baseten", "novita", "deepinfra"];
1007
+ readonly implicitCaching: true;
1008
+ };
1009
+ readonly kimi: {
1010
+ readonly productId: "kimi-k3";
1011
+ readonly workspaceProductId: "workspace-gateway/kimi-k3";
1012
+ readonly upstreamModelId: "moonshotai/kimi-k3";
1013
+ readonly label: "Kimi K3";
1014
+ readonly providers: readonly ["baseten", "fireworks"];
1015
+ readonly implicitCaching: true;
1016
+ };
1017
+ };
919
1018
  /**
920
1019
  * Built-in OpenGeni credit pricing schedules.
921
1020
  *
@@ -977,6 +1076,11 @@ export declare function collectSandboxEnvironment(settings: Settings, source?: N
977
1076
  * explicit environment in tests.
978
1077
  */
979
1078
  export declare function resolveProviderApiKey(provider: Pick<RegistryProvider, "apiKey" | "apiKeyEnv">, source?: NodeJS.ProcessEnv): string | undefined;
1079
+ export declare function gatewayRequestPolicyForUpstreamModel(upstreamModelId: string): ConfiguredModel["requestPolicy"];
1080
+ /** Static catalog overlay; it contains no concrete workspace credential. */
1081
+ export declare function withWorkspaceGatewayCatalogProvider(settings: Settings): Settings;
1082
+ /** Runtime overlay after the worker resolves the workspace's encrypted key. */
1083
+ export declare function withWorkspaceGatewayCredential(settings: Settings, apiKey: string): Settings;
980
1084
  /**
981
1085
  * Product display label for catalog/picker UI.
982
1086
  * Same string for OpenAI and Codex copies of a slug (`gpt-5.6-luna` and
@@ -1118,6 +1222,14 @@ export declare function configuredEntitlements(settings: Settings): Entitlements
1118
1222
  export declare function calculateModelUsageCostMicros(settings: Settings, model: string, usage: ModelUsageInput, options?: {
1119
1223
  latencyMode?: LatencyMode;
1120
1224
  }): number;
1225
+ /**
1226
+ * Convert AI Gateway's exact USD inference cost to OpenGeni credit micros and
1227
+ * apply the configured model margin. Decimal arithmetic is integer-only so a
1228
+ * sub-micro provider charge cannot be lost to floating-point rounding.
1229
+ */
1230
+ export declare function calculateGatewayReportedCostMicros(settings: Settings, model: string, inferenceCostUsd: string, options?: {
1231
+ inputTokens?: number;
1232
+ }): number;
1121
1233
  export declare function configuredAllowedReasoningEfforts(settings: Settings): Array<z.infer<typeof ReasoningEffort>>;
1122
1234
  /**
1123
1235
  * Decodes OPENGENI_ENVIRONMENTS_ENCRYPTION_KEY (base64, exactly 32 bytes) for