@rulvar/openai 1.8.0 → 1.10.0

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
@@ -1,4 +1,4 @@
1
- import { CanonicalId, ChatEvent, ChatRequest, Effort, ModelCaps, ProviderAdapter, Usage, WireError } from "@rulvar/core";
1
+ import { CanonicalId, ChatEvent, ChatRequest, Effort, ModelCaps, PriceTable, ProviderAdapter, Usage, WireError } from "@rulvar/core";
2
2
 
3
3
  //#region src/caps.d.ts
4
4
  interface OpenAiModelInfo {
@@ -18,6 +18,17 @@ declare const OPENAI_MODELS: Record<string, OpenAiModelInfo>;
18
18
  * until then its usage surfaces in CostReport.unpriced and a run ceiling
19
19
  * warns that it cannot bound the model.
20
20
  */
21
+ /**
22
+ * The seed pricing rows as a versioned price table, keyed by full
23
+ * ModelRef under the adapter's fixed id 'openai' (long-context tiers
24
+ * included; the 'gpt-5.6' alias carries the same row as its Sol
25
+ * target). Pass it to createEngine({ pricing }) so the run journals a
26
+ * concrete pricingVersion instead of 'unpriced': the versioned table
27
+ * wins over the caps fallback by rule, and a later table revision
28
+ * surfaces as explicit configuration drift on resume rather than a
29
+ * silent reinterpretation.
30
+ */
31
+ declare const OPENAI_PRICING: PriceTable;
21
32
  declare function openAiModelInfo(model: string): OpenAiModelInfo;
22
33
  //#endregion
23
34
  //#region src/adapter.d.ts
@@ -134,4 +145,4 @@ declare function buildChatCompletionsParams(req: ChatRequest, ids: OpenAiIdMap):
134
145
  */
135
146
  declare function mapChatCompletionsStream(stream: AsyncIterable<Record<string, unknown>>, ids: OpenAiIdMap): AsyncGenerator<ChatEvent, void>;
136
147
  //#endregion
137
- export { CONSERVATIVE_COMPATIBLE_CAPS, OPENAI_MODELS, type OpenAiAdapterOptions, type OpenAiClientLike, type OpenAiCompatibleConfig, OpenAiIdMap, type OpenAiModelInfo, type ResponsesStreamEvent, buildChatCompletionsParams, buildResponsesParams, mapChatCompletionsStream, mapOpenAiEffort, mapResponsesStream, normalizeOpenAiUsage, openAiErrorToWire, openAiModelInfo, openai, openaiCompatible };
148
+ export { CONSERVATIVE_COMPATIBLE_CAPS, OPENAI_MODELS, OPENAI_PRICING, type OpenAiAdapterOptions, type OpenAiClientLike, type OpenAiCompatibleConfig, OpenAiIdMap, type OpenAiModelInfo, type ResponsesStreamEvent, buildChatCompletionsParams, buildResponsesParams, mapChatCompletionsStream, mapOpenAiEffort, mapResponsesStream, normalizeOpenAiUsage, openAiErrorToWire, openAiModelInfo, openai, openaiCompatible };
package/dist/index.js CHANGED
@@ -72,6 +72,24 @@ const OPENAI_MODELS = {
72
72
  * until then its usage surfaces in CostReport.unpriced and a run ceiling
73
73
  * warns that it cannot bound the model.
74
74
  */
75
+ /**
76
+ * The seed pricing rows as a versioned price table, keyed by full
77
+ * ModelRef under the adapter's fixed id 'openai' (long-context tiers
78
+ * included; the 'gpt-5.6' alias carries the same row as its Sol
79
+ * target). Pass it to createEngine({ pricing }) so the run journals a
80
+ * concrete pricingVersion instead of 'unpriced': the versioned table
81
+ * wins over the caps fallback by rule, and a later table revision
82
+ * surfaces as explicit configuration drift on resume rather than a
83
+ * silent reinterpretation.
84
+ */
85
+ const OPENAI_PRICING = {
86
+ pricingVersion: "openai-2026-07-16",
87
+ models: (() => {
88
+ const models = {};
89
+ for (const [name, info] of Object.entries(OPENAI_MODELS)) if (info.caps.pricing !== void 0) models[`openai:${name}`] = info.caps.pricing;
90
+ return models;
91
+ })()
92
+ };
75
93
  function openAiModelInfo(model) {
76
94
  const exact = OPENAI_MODELS[model];
77
95
  if (exact !== void 0) return exact;
@@ -711,4 +729,4 @@ function openaiCompatible(cfg) {
711
729
  };
712
730
  }
713
731
  //#endregion
714
- export { CONSERVATIVE_COMPATIBLE_CAPS, OPENAI_MODELS, OpenAiIdMap, buildChatCompletionsParams, buildResponsesParams, mapChatCompletionsStream, mapOpenAiEffort, mapResponsesStream, normalizeOpenAiUsage, openAiErrorToWire, openAiModelInfo, openai, openaiCompatible };
732
+ export { CONSERVATIVE_COMPATIBLE_CAPS, OPENAI_MODELS, OPENAI_PRICING, OpenAiIdMap, buildChatCompletionsParams, buildResponsesParams, mapChatCompletionsStream, mapOpenAiEffort, mapResponsesStream, normalizeOpenAiUsage, openAiErrorToWire, openAiModelInfo, openai, openaiCompatible };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rulvar/openai",
3
- "version": "1.8.0",
3
+ "version": "1.10.0",
4
4
  "description": "Rulvar first-class provider adapter for the OpenAI Responses API, plus the openaiCompatible factory.",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
@@ -23,7 +23,7 @@
23
23
  },
24
24
  "dependencies": {
25
25
  "openai": "^6.45.0",
26
- "@rulvar/core": "1.8.0"
26
+ "@rulvar/core": "1.10.0"
27
27
  },
28
28
  "devDependencies": {
29
29
  "@types/node": "^22.20.0",