@oh-my-pi/pi-catalog 16.3.6 → 16.3.7

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.
Files changed (54) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/types/build.d.ts +1 -1
  3. package/dist/types/compat/anthropic.d.ts +1 -1
  4. package/dist/types/compat/devin.d.ts +1 -1
  5. package/dist/types/compat/openai.d.ts +8 -8
  6. package/dist/types/discovery/antigravity.d.ts +2 -2
  7. package/dist/types/discovery/codex.d.ts +1 -1
  8. package/dist/types/discovery/cursor.d.ts +1 -1
  9. package/dist/types/discovery/devin-gen/exa/analytics_pb/analytics_pb.d.ts +4 -4
  10. package/dist/types/discovery/devin-gen/exa/api_server_pb/api_server_pb.d.ts +8 -8
  11. package/dist/types/discovery/devin-gen/exa/auth_pb/auth_pb.d.ts +1 -1
  12. package/dist/types/discovery/devin-gen/exa/auto_cascade_common_pb/auto_cascade_common_pb.d.ts +1 -1
  13. package/dist/types/discovery/devin-gen/exa/cascade_plugins_pb/cascade_plugins_pb.d.ts +1 -1
  14. package/dist/types/discovery/devin-gen/exa/chat_pb/chat_pb.d.ts +2 -2
  15. package/dist/types/discovery/devin-gen/exa/code_edit/code_edit_pb/code_edit_pb.d.ts +3 -3
  16. package/dist/types/discovery/devin-gen/exa/context_module_pb/context_module_pb.d.ts +2 -2
  17. package/dist/types/discovery/devin-gen/exa/cortex_pb/cortex_pb.d.ts +6 -6
  18. package/dist/types/discovery/devin-gen/exa/diff_action_pb/diff_action_pb.d.ts +1 -1
  19. package/dist/types/discovery/devin-gen/exa/index_pb/index_pb.d.ts +1 -1
  20. package/dist/types/discovery/devin-gen/exa/knowledge_base_pb/knowledge_base_pb.d.ts +3 -3
  21. package/dist/types/discovery/devin-gen/exa/language_server_pb/language_server_pb.d.ts +11 -11
  22. package/dist/types/discovery/devin-gen/exa/opensearch_clients_pb/opensearch_clients_pb.d.ts +3 -3
  23. package/dist/types/discovery/devin-gen/exa/prompt_pb/prompt_pb.d.ts +5 -5
  24. package/dist/types/discovery/devin.d.ts +1 -1
  25. package/dist/types/discovery/gemini.d.ts +1 -1
  26. package/dist/types/discovery/gitlab-duo-workflow.d.ts +1 -1
  27. package/dist/types/discovery/index.d.ts +5 -5
  28. package/dist/types/discovery/openai-compatible.d.ts +1 -1
  29. package/dist/types/identity/bundled.d.ts +1 -1
  30. package/dist/types/identity/family.d.ts +9 -2
  31. package/dist/types/identity/index.d.ts +8 -8
  32. package/dist/types/identity/reference.d.ts +1 -1
  33. package/dist/types/index.d.ts +17 -17
  34. package/dist/types/model-cache.d.ts +1 -1
  35. package/dist/types/model-manager.d.ts +1 -1
  36. package/dist/types/model-thinking.d.ts +2 -2
  37. package/dist/types/models.d.ts +1 -1
  38. package/dist/types/provider-models/bundled-references.d.ts +2 -2
  39. package/dist/types/provider-models/descriptor-types.d.ts +2 -2
  40. package/dist/types/provider-models/descriptors.d.ts +52 -52
  41. package/dist/types/provider-models/google.d.ts +2 -2
  42. package/dist/types/provider-models/index.d.ts +6 -6
  43. package/dist/types/provider-models/ollama.d.ts +2 -2
  44. package/dist/types/provider-models/openai-compat.d.ts +5 -3
  45. package/dist/types/provider-models/special.d.ts +3 -3
  46. package/dist/types/types.d.ts +16 -7
  47. package/dist/types/variant-collapse.d.ts +2 -2
  48. package/package.json +3 -3
  49. package/src/compat/openai.ts +8 -9
  50. package/src/identity/family.ts +15 -4
  51. package/src/models.json +370 -108
  52. package/src/models.ts +4 -3
  53. package/src/provider-models/openai-compat.ts +39 -6
  54. package/src/types.ts +14 -5
package/src/models.ts CHANGED
@@ -44,9 +44,10 @@ export function getBundledModels(provider: GeneratedProvider): Model<Api>[] {
44
44
  }
45
45
 
46
46
  export function calculateCost<TApi extends Api>(model: Model<TApi>, usage: Usage): Usage["cost"] {
47
- usage.cost.input = (model.cost.input / 1000000) * usage.input;
48
- usage.cost.output = (model.cost.output / 1000000) * usage.output;
49
- usage.cost.cacheRead = (model.cost.cacheRead / 1000000) * usage.cacheRead;
47
+ const orchestration = usage.orchestration;
48
+ usage.cost.input = (model.cost.input / 1000000) * (usage.input + (orchestration?.input ?? 0));
49
+ usage.cost.output = (model.cost.output / 1000000) * (usage.output + (orchestration?.output ?? 0));
50
+ usage.cost.cacheRead = (model.cost.cacheRead / 1000000) * (usage.cacheRead + (orchestration?.cacheRead ?? 0));
50
51
  usage.cost.cacheWrite = (model.cost.cacheWrite / 1000000) * usage.cacheWrite;
51
52
  usage.cost.total = usage.cost.input + usage.cost.output + usage.cost.cacheRead + usage.cost.cacheWrite;
52
53
  return usage.cost;
@@ -5,7 +5,12 @@ import {
5
5
  } from "../discovery/openai-compatible";
6
6
  import { Effort } from "../effort";
7
7
  import { FIREWORKS_FAST_SUFFIX, toFireworksPublicModelId } from "../fireworks-model-id";
8
- import { isGlmVisionModelId, isGrokReasoningEffortCapable, isReasoningGlmModelId } from "../identity/family";
8
+ import {
9
+ isGlmVisionModelId,
10
+ isGrokReasoningEffortCapable,
11
+ isKimiModelId,
12
+ isReasoningGlmModelId,
13
+ } from "../identity/family";
9
14
  import type { ModelManagerOptions } from "../model-manager";
10
15
  import { getBundledModels } from "../models";
11
16
  import type { Api, FetchImpl, Model, ModelSpec, OpenAICompat, Provider, ThinkingConfig } from "../types";
@@ -1718,6 +1723,36 @@ function readWaferRecord(entry: OpenAICompatibleModelRecord): WaferRecord | unde
1718
1723
  return raw && typeof raw === "object" ? (raw as WaferRecord) : undefined;
1719
1724
  }
1720
1725
 
1726
+ type WaferThinkingFormat = "zai" | "qwen";
1727
+
1728
+ export function resolveWaferServerlessThinkingFormat(
1729
+ modelId: string,
1730
+ upstreamProvider: unknown,
1731
+ ): WaferThinkingFormat | undefined {
1732
+ const upstream = typeof upstreamProvider === "string" ? upstreamProvider.trim().toLowerCase() : "";
1733
+ if (upstream) {
1734
+ if (
1735
+ upstream === "zai" ||
1736
+ upstream === "z.ai" ||
1737
+ upstream === "z-ai" ||
1738
+ upstream.includes("zhipu") ||
1739
+ upstream.includes("moonshot") ||
1740
+ upstream.includes("kimi")
1741
+ ) {
1742
+ return "zai";
1743
+ }
1744
+ if (upstream.includes("qwen") || upstream.includes("alibaba") || upstream.includes("dashscope")) {
1745
+ return "qwen";
1746
+ }
1747
+ return undefined;
1748
+ }
1749
+
1750
+ // Older Wafer snapshots (and some endpoint responses) do not carry the
1751
+ // upstream-provider hint. Only GLM/Kimi need a sparse override: qwen and
1752
+ // deepseek IDs are resolved safely by `buildOpenAICompat` from the model id.
1753
+ return isReasoningGlmModelId(modelId.toLowerCase()) || isKimiModelId(modelId) ? "zai" : undefined;
1754
+ }
1755
+
1721
1756
  function mapWaferModel(
1722
1757
  providerId: "wafer-serverless",
1723
1758
  baseUrl: string,
@@ -1766,11 +1801,9 @@ function mapWaferModel(
1766
1801
  // - deepseek → `reasoning_effort` (DeepSeek effort map; the model always
1767
1802
  // reasons when invoked, replay of `reasoning_content` is required on
1768
1803
  // tool-call turns — both handled by `detectOpenAICompat` from the id).
1769
- // For unknown upstreams we omit `thinkingFormat` and let the per-id
1770
- // detection in `detectOpenAICompat` pick a safe default.
1771
- const upstream = typeof wafer?.provider === "string" ? wafer.provider : undefined;
1772
- const thinkingFormat: "zai" | "qwen" | undefined =
1773
- upstream === "zai" || upstream === "moonshotai" ? "zai" : upstream === "qwen" ? "qwen" : undefined;
1804
+ // Unknown upstreams stay unset; missing upstreams fall back only for
1805
+ // model families that cannot be inferred safely from Wafer's host.
1806
+ const thinkingFormat = resolveWaferServerlessThinkingFormat(defaults.id, wafer?.provider);
1774
1807
  return {
1775
1808
  ...base,
1776
1809
  compat: {
package/src/types.ts CHANGED
@@ -93,16 +93,25 @@ export type Provider = string;
93
93
  export type ThinkingBudgets = { [key in Effort]?: number };
94
94
 
95
95
  export interface Usage {
96
- /** Non-cached input tokens (matches the bucket the provider bills as new input). */
96
+ /** Non-cached conversation input tokens (matches the bucket the provider bills as new input). */
97
97
  input: number;
98
- /** Total output tokens for the turn, including thinking, assistant text, and tool-call argument tokens. */
98
+ /** Total conversation output tokens for the turn, including thinking, assistant text, and tool-call argument tokens. */
99
99
  output: number;
100
- /** Tokens read from the prompt cache. */
100
+ /** Conversation tokens read from the prompt cache. */
101
101
  cacheRead: number;
102
- /** Tokens written to the prompt cache (cache creation). */
102
+ /** Conversation tokens written to the prompt cache (cache creation). */
103
103
  cacheWrite: number;
104
- /** Sum of input + output + cacheRead + cacheWrite. */
104
+ /** Sum of input + output + cacheRead + cacheWrite plus provider-side orchestration tokens when reported. */
105
105
  totalTokens: number;
106
+ /** Provider-side orchestration tokens, billed but not part of the conversation prompt/cache buckets. */
107
+ orchestration?: {
108
+ /** Non-cached orchestration input tokens. */
109
+ input?: number;
110
+ /** Orchestration tokens read from provider-side cache. */
111
+ cacheRead?: number;
112
+ /** Orchestration output tokens. */
113
+ output?: number;
114
+ };
106
115
  /** Copilot premium-request counter, when applicable. */
107
116
  premiumRequests?: number;
108
117
  /**