From beeade732ce42cdb2f49b5681a3f6941ceaa7cf2 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Thu, 15 Oct 2026 19:08:33 +0000 Subject: [PATCH 1/7] feat(cost): register Engy as OpenAI-compatible AI Gateway provider Add EngyProvider (https://api.engy.ai/v1/chat/completions, Bearer auth) and wire it into the provider registry, priorities, legacy URL-pattern mappings, heliconeProviderToModelProviderName/dbProviderToProvider helpers, and the OpenAI-compatible usage processor. --- packages/cost/models/provider-helpers.ts | 5 +++++ packages/cost/models/providers/engy.ts | 14 ++++++++++++++ packages/cost/models/providers/index.ts | 2 ++ packages/cost/models/providers/priorities.ts | 1 + packages/cost/providers/mappings.ts | 9 +++++++++ packages/cost/usage/getUsageProcessor.ts | 1 + 6 files changed, 32 insertions(+) create mode 100644 packages/cost/models/providers/engy.ts diff --git a/packages/cost/models/provider-helpers.ts b/packages/cost/models/provider-helpers.ts index ae00f70ee3..86c621d233 100644 --- a/packages/cost/models/provider-helpers.ts +++ b/packages/cost/models/provider-helpers.ts @@ -62,6 +62,8 @@ export function heliconeProviderToModelProviderName( return "fireworks"; case "CANOPYWAVE": return "canopywave"; + case "ENGY": + return "engy"; // new registry does not have case "LOCAL": case "HELICONE": @@ -156,6 +158,9 @@ export const dbProviderToProvider = ( if (provider === "chutes" || provider === "Chutes") { return "chutes"; } + if (provider === "engy" || provider === "Engy") { + return "engy"; + } if (provider === "nebius" || provider === "Nebius") { return "nebius"; } diff --git a/packages/cost/models/providers/engy.ts b/packages/cost/models/providers/engy.ts new file mode 100644 index 0000000000..77ac6b5507 --- /dev/null +++ b/packages/cost/models/providers/engy.ts @@ -0,0 +1,14 @@ +import { BaseProvider } from "./base"; +import type { Endpoint, RequestParams } from "../types"; + +export class EngyProvider extends BaseProvider { + readonly displayName = "Engy"; + readonly baseUrl = "https://api.engy.ai/"; + readonly auth = "api-key" as const; + readonly pricingPages = ["https://engy.ai/"]; + readonly modelPages = ["https://engy.ai/"]; + + buildUrl(endpoint: Endpoint, requestParams: RequestParams): string { + return `${this.baseUrl}v1/chat/completions`; + } +} diff --git a/packages/cost/models/providers/index.ts b/packages/cost/models/providers/index.ts index 963717d50d..536e597486 100644 --- a/packages/cost/models/providers/index.ts +++ b/packages/cost/models/providers/index.ts @@ -7,6 +7,7 @@ import { CerebrasProvider } from "./cerebras"; import { ChutesProvider } from "./chutes"; import { DeepInfraProvider } from "./deepinfra"; import { DeepSeekProvider } from "./deepseek"; +import { EngyProvider } from "./engy"; import { FireworksProvider } from "./fireworks"; import { GoogleProvider } from "./google"; import { GroqProvider } from "./groq"; @@ -31,6 +32,7 @@ export const providers = { chutes: new ChutesProvider(), deepinfra: new DeepInfraProvider(), deepseek: new DeepSeekProvider(), + engy: new EngyProvider(), fireworks: new FireworksProvider(), "google-ai-studio": new GoogleProvider(), groq: new GroqProvider(), diff --git a/packages/cost/models/providers/priorities.ts b/packages/cost/models/providers/priorities.ts index 38df67014c..2f5ff86461 100644 --- a/packages/cost/models/providers/priorities.ts +++ b/packages/cost/models/providers/priorities.ts @@ -29,6 +29,7 @@ export const PROVIDER_PRIORITIES: Record = { chutes: 4, deepinfra: 4, deepseek: 4, + engy: 4, fireworks: 4, groq: 4, mistral: 4, diff --git a/packages/cost/providers/mappings.ts b/packages/cost/providers/mappings.ts index 401d7a49f6..700b12fa46 100644 --- a/packages/cost/providers/mappings.ts +++ b/packages/cost/providers/mappings.ts @@ -98,6 +98,9 @@ const cerebras = /^https:\/\/api\.cerebras\.ai(\/|$)/; // https://inference.canopywave.io const canopywave = /^https:\/\/inference\.canopywave\.io(\/|$)/; +// https://api.engy.ai +const engy = /^https:\/\/api\.engy\.ai(\/|$)/; + export const providersNames = [ "OPENAI", "ANTHROPIC", @@ -136,6 +139,7 @@ export const providersNames = [ "CEREBRAS", "BASETEN", "CANOPYWAVE", + "ENGY", ] as const; export type ProviderName = (typeof providersNames)[number]; @@ -330,6 +334,11 @@ export const providers: { provider: "CANOPYWAVE", costs: [], }, + { + pattern: engy, + provider: "ENGY", + costs: [], + }, ]; // eslint-disable-next-line @typescript-eslint/no-non-null-assertion diff --git a/packages/cost/usage/getUsageProcessor.ts b/packages/cost/usage/getUsageProcessor.ts index 3dc612abf9..53ab5f627e 100644 --- a/packages/cost/usage/getUsageProcessor.ts +++ b/packages/cost/usage/getUsageProcessor.ts @@ -20,6 +20,7 @@ export function getUsageProcessor( case "canopywave": case "chutes": case "deepinfra": + case "engy": case "helicone": case "mistral": case "nebius": From c58cfca65f50b7127a9e6a94da9d37cc2b3f0213 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Thu, 15 Oct 2026 19:08:36 +0000 Subject: [PATCH 2/7] feat(cost): add Engy chat endpoints for eight models New model families with :engy endpoints (BYOK, ptbEnabled: false): - moonshotai/kimi-k3 (1,113,088 ctx, text+image) - zai/glm-5: glm-5.3, glm-5.3-flash, glm-5.2 - deepseek/deepseek-v4: deepseek-v4.1-flash, deepseek-v4-flash-0731 - alibaba/qwen3: qwen3.8-27b, qwen3.6-35b-a3b Per-token pricing converted from Engy USD/1M list prices; cacheMultipliers.cachedInput = cache_read / input. Registry snapshots regenerated with npx jest -u. --- .../registrySnapshots.test.ts.snap | 316 +++++++++++++++++- .../models/authors/alibaba/qwen3/endpoints.ts | 68 ++++ .../models/authors/alibaba/qwen3/models.ts | 22 ++ .../authors/deepseek/deepseek-v4/endpoints.ts | 79 +++++ .../authors/deepseek/deepseek-v4/models.ts | 28 ++ .../cost/models/authors/deepseek/index.ts | 4 + .../cost/models/authors/moonshotai/index.ts | 4 + .../authors/moonshotai/kimi-k3/endpoints.ts | 45 +++ .../authors/moonshotai/kimi-k3/models.ts | 17 + .../models/authors/zai/glm-5/endpoints.ts | 113 +++++++ .../cost/models/authors/zai/glm-5/models.ts | 39 +++ packages/cost/models/authors/zai/index.ts | 8 +- 12 files changed, 738 insertions(+), 5 deletions(-) create mode 100644 packages/cost/models/authors/deepseek/deepseek-v4/endpoints.ts create mode 100644 packages/cost/models/authors/deepseek/deepseek-v4/models.ts create mode 100644 packages/cost/models/authors/moonshotai/kimi-k3/endpoints.ts create mode 100644 packages/cost/models/authors/moonshotai/kimi-k3/models.ts create mode 100644 packages/cost/models/authors/zai/glm-5/endpoints.ts create mode 100644 packages/cost/models/authors/zai/glm-5/models.ts diff --git a/packages/__tests__/cost/__snapshots__/registrySnapshots.test.ts.snap b/packages/__tests__/cost/__snapshots__/registrySnapshots.test.ts.snap index ab023ddc00..c9849e648b 100644 --- a/packages/__tests__/cost/__snapshots__/registrySnapshots.test.ts.snap +++ b/packages/__tests__/cost/__snapshots__/registrySnapshots.test.ts.snap @@ -298,6 +298,54 @@ exports[`Registry Snapshots endpoint configurations snapshot 1`] = ` "*", ], }, + "qwen3.6-35b-a3b:engy": { + "context": 208192, + "crossRegion": false, + "maxTokens": 16384, + "modelId": "qwen3.6-35b-a3b", + "parameters": [ + "frequency_penalty", + "max_tokens", + "presence_penalty", + "response_format", + "seed", + "stop", + "stream", + "temperature", + "tool_choice", + "tools", + "top_p", + ], + "provider": "engy", + "ptbEnabled": false, + "regions": [ + "*", + ], + }, + "qwen3.8-27b:engy": { + "context": 1001536, + "crossRegion": false, + "maxTokens": 16384, + "modelId": "qwen3.8-27b", + "parameters": [ + "frequency_penalty", + "max_tokens", + "presence_penalty", + "response_format", + "seed", + "stop", + "stream", + "temperature", + "tool_choice", + "tools", + "top_p", + ], + "provider": "engy", + "ptbEnabled": false, + "regions": [ + "*", + ], + }, }, "anthropic/claude-3-haiku-20240307": { "claude-3-haiku-20240307:anthropic": { @@ -2127,6 +2175,56 @@ exports[`Registry Snapshots endpoint configurations snapshot 1`] = ` ], }, }, + "deepseek/deepseek-v4": { + "deepseek-v4-flash-0731:engy": { + "context": 1048576, + "crossRegion": false, + "maxTokens": 65536, + "modelId": "deepseek-v4-flash-0731", + "parameters": [ + "frequency_penalty", + "max_tokens", + "presence_penalty", + "response_format", + "seed", + "stop", + "stream", + "temperature", + "tool_choice", + "tools", + "top_p", + ], + "provider": "engy", + "ptbEnabled": false, + "regions": [ + "*", + ], + }, + "deepseek-v4.1-flash:engy": { + "context": 1048576, + "crossRegion": false, + "maxTokens": 65536, + "modelId": "deepseek-v4.1-flash", + "parameters": [ + "frequency_penalty", + "max_tokens", + "presence_penalty", + "response_format", + "seed", + "stop", + "stream", + "temperature", + "tool_choice", + "tools", + "top_p", + ], + "provider": "engy", + "ptbEnabled": false, + "regions": [ + "*", + ], + }, + }, "deepseek/r1-distill": { "deepseek-r1-distill-llama-70b:chutes": { "context": 128000, @@ -4049,6 +4147,32 @@ exports[`Registry Snapshots endpoint configurations snapshot 1`] = ` ], }, }, + "moonshotai/kimi-k3": { + "kimi-k3:engy": { + "context": 1113088, + "crossRegion": false, + "maxTokens": 16384, + "modelId": "kimi-k3", + "parameters": [ + "frequency_penalty", + "max_tokens", + "presence_penalty", + "response_format", + "seed", + "stop", + "stream", + "temperature", + "tool_choice", + "tools", + "top_p", + ], + "provider": "engy", + "ptbEnabled": false, + "regions": [ + "*", + ], + }, + }, "openai/gpt-4.1": { "gpt-4.1-mini:azure": { "context": 1047576, @@ -7292,6 +7416,80 @@ exports[`Registry Snapshots endpoint configurations snapshot 1`] = ` ], }, }, + "zai/glm-5": { + "glm-5.2:engy": { + "context": 262144, + "crossRegion": false, + "maxTokens": 131072, + "modelId": "glm-5.2", + "parameters": [ + "frequency_penalty", + "max_tokens", + "presence_penalty", + "response_format", + "seed", + "stop", + "stream", + "temperature", + "tool_choice", + "tools", + "top_p", + ], + "provider": "engy", + "ptbEnabled": false, + "regions": [ + "*", + ], + }, + "glm-5.3-flash:engy": { + "context": 327680, + "crossRegion": false, + "maxTokens": 131072, + "modelId": "glm-5.3-flash", + "parameters": [ + "frequency_penalty", + "max_tokens", + "presence_penalty", + "response_format", + "seed", + "stop", + "stream", + "temperature", + "tool_choice", + "tools", + "top_p", + ], + "provider": "engy", + "ptbEnabled": false, + "regions": [ + "*", + ], + }, + "glm-5.3:engy": { + "context": 327680, + "crossRegion": false, + "maxTokens": 131072, + "modelId": "glm-5.3", + "parameters": [ + "frequency_penalty", + "max_tokens", + "presence_penalty", + "response_format", + "seed", + "stop", + "stream", + "temperature", + "tool_choice", + "tools", + "top_p", + ], + "provider": "engy", + "ptbEnabled": false, + "regions": [ + "*", + ], + }, + }, } `; @@ -7306,6 +7504,8 @@ exports[`Registry Snapshots model coverage snapshot 1`] = ` "deepinfra", "deepinfra", "deepinfra", + "engy", + "engy", "groq", "nebius", "novita", @@ -7433,6 +7633,10 @@ exports[`Registry Snapshots model coverage snapshot 1`] = ` "novita", "openrouter", ], + "deepseek/deepseek-v4": [ + "engy", + "engy", + ], "deepseek/r1-distill": [ "chutes", "deepinfra", @@ -7550,6 +7754,9 @@ exports[`Registry Snapshots model coverage snapshot 1`] = ` "novita", "openrouter", ], + "moonshotai/kimi-k3": [ + "engy", + ], "openai/gpt-4.1": [ "azure", "azure", @@ -7732,6 +7939,11 @@ exports[`Registry Snapshots model coverage snapshot 1`] = ` "novita", "novita", ], + "zai/glm-5": [ + "engy", + "engy", + "engy", + ], } `; @@ -7761,6 +7973,16 @@ exports[`Registry Snapshots pricing snapshot 1`] = ` "threshold": 0, }, ], + "engy": [ + { + "cacheMultipliers": { + "cachedInput": 0.333, + }, + "input": 4.5e-8, + "output": 3e-7, + "threshold": 0, + }, + ], "groq": [ { "input": 2.9e-7, @@ -8798,6 +9020,18 @@ exports[`Registry Snapshots pricing snapshot 1`] = ` }, ], }, + "deepseek/deepseek-v4": { + "engy": [ + { + "cacheMultipliers": { + "cachedInput": 0.2, + }, + "input": 4.5e-8, + "output": 9e-8, + "threshold": 0, + }, + ], + }, "deepseek/r1-distill": { "chutes": [ { @@ -9428,6 +9662,18 @@ exports[`Registry Snapshots pricing snapshot 1`] = ` }, ], }, + "moonshotai/kimi-k3": { + "engy": [ + { + "cacheMultipliers": { + "cachedInput": 0.1, + }, + "input": 0.00000195, + "output": 0.00000975, + "threshold": 0, + }, + ], + }, "openai/gpt-4.1": { "azure": [ { @@ -9953,6 +10199,18 @@ exports[`Registry Snapshots pricing snapshot 1`] = ` }, ], }, + "zai/glm-5": { + "engy": [ + { + "cacheMultipliers": { + "cachedInput": 0.265, + }, + "input": 6.8e-7, + "output": 0.0000015, + "threshold": 0, + }, + ], + }, } `; @@ -10165,6 +10423,18 @@ exports[`Registry Snapshots verify registry state 1`] = ` "novita", ], }, + { + "model": "deepseek-v4-flash-0731", + "providers": [ + "engy", + ], + }, + { + "model": "deepseek-v4.1-flash", + "providers": [ + "engy", + ], + }, { "model": "ernie-4.5-21b-a3b-thinking", "providers": [ @@ -10278,6 +10548,24 @@ exports[`Registry Snapshots verify registry state 1`] = ` "novita", ], }, + { + "model": "glm-5.2", + "providers": [ + "engy", + ], + }, + { + "model": "glm-5.3", + "providers": [ + "engy", + ], + }, + { + "model": "glm-5.3-flash", + "providers": [ + "engy", + ], + }, { "model": "gpt-4.1", "providers": [ @@ -10626,6 +10914,12 @@ exports[`Registry Snapshots verify registry state 1`] = ` "openrouter", ], }, + { + "model": "kimi-k3", + "providers": [ + "engy", + ], + }, { "model": "llama-3.1-8b-instant", "providers": [ @@ -10813,6 +11107,18 @@ exports[`Registry Snapshots verify registry state 1`] = ` "novita", ], }, + { + "model": "qwen3.6-35b-a3b", + "providers": [ + "engy", + ], + }, + { + "model": "qwen3.8-27b", + "providers": [ + "engy", + ], + }, { "model": "sonar", "providers": [ @@ -10881,6 +11187,10 @@ exports[`Registry Snapshots verify registry state 1`] = ` "modelCount": 2, "provider": "deepseek", }, + { + "modelCount": 8, + "provider": "engy", + }, { "modelCount": 4, "provider": "fireworks", @@ -11049,9 +11359,9 @@ exports[`Registry Snapshots verify registry state 1`] = ` "claude-3.5-haiku:anthropic:*", ], "totalArchivedConfigs": 0, - "totalEndpoints": 329, - "totalModelProviderConfigs": 329, + "totalEndpoints": 337, + "totalModelProviderConfigs": 337, "totalModelsWithPtb": 108, - "totalProviders": 21, + "totalProviders": 22, } `; diff --git a/packages/cost/models/authors/alibaba/qwen3/endpoints.ts b/packages/cost/models/authors/alibaba/qwen3/endpoints.ts index 955201011a..0c74e3de34 100644 --- a/packages/cost/models/authors/alibaba/qwen3/endpoints.ts +++ b/packages/cost/models/authors/alibaba/qwen3/endpoints.ts @@ -367,6 +367,74 @@ export const endpoints = { "*": {}, }, }, + "qwen3.8-27b:engy": { + providerModelId: "qwen3.8-27b", + provider: "engy", + author: "qwen", + pricing: [ + { + threshold: 0, + input: 0.000000045, // $0.045/1M + output: 0.00000032, // $0.32/1M + cacheMultipliers: { + cachedInput: 0.333, // $0.015/1M cache read vs $0.045/1M input + }, + }, + ], + contextLength: 1_001_536, + maxCompletionTokens: 16_384, + supportedParameters: [ + "max_tokens", + "temperature", + "top_p", + "stop", + "stream", + "frequency_penalty", + "presence_penalty", + "seed", + "tools", + "tool_choice", + "response_format", + ], + ptbEnabled: false, + endpointConfigs: { + "*": {}, + }, + }, + "qwen3.6-35b-a3b:engy": { + providerModelId: "qwen3.6-35b-a3b", + provider: "engy", + author: "qwen", + pricing: [ + { + threshold: 0, + input: 0.000000045, // $0.045/1M + output: 0.0000003, // $0.30/1M + cacheMultipliers: { + cachedInput: 0.333, // $0.015/1M cache read vs $0.045/1M input + }, + }, + ], + contextLength: 208_192, + maxCompletionTokens: 16_384, + supportedParameters: [ + "max_tokens", + "temperature", + "top_p", + "stop", + "stream", + "frequency_penalty", + "presence_penalty", + "seed", + "tools", + "tool_choice", + "response_format", + ], + ptbEnabled: false, + endpointConfigs: { + "*": {}, + }, + }, } satisfies Partial< Record<`${Qwen3ModelName}:${ModelProviderName}`, ModelProviderConfig> >; diff --git a/packages/cost/models/authors/alibaba/qwen3/models.ts b/packages/cost/models/authors/alibaba/qwen3/models.ts index be8f0811d9..6de961c03b 100644 --- a/packages/cost/models/authors/alibaba/qwen3/models.ts +++ b/packages/cost/models/authors/alibaba/qwen3/models.ts @@ -81,6 +81,28 @@ export const models = { modality: { inputs: ["text"], outputs: ["text"] }, tokenizer: "Qwen", }, + "qwen3.8-27b": { + name: "Qwen3.8 27B", + author: "qwen", + description: + "Qwen3.8 27B is a 27 billion parameter multimodal model in the Qwen series, supporting text and image inputs with a 1M token context window for reasoning, coding, and agentic workloads.", + contextLength: 1_001_536, + maxOutputTokens: 16_384, + created: "2026-08-01T00:00:00.000Z", + modality: { inputs: ["text", "image"], outputs: ["text"] }, + tokenizer: "Qwen", + }, + "qwen3.6-35b-a3b": { + name: "Qwen3.6 35B A3B", + author: "qwen", + description: + "Qwen3.6 35B A3B is a Mixture-of-Experts model in the Qwen series with 35B total and 3B active parameters, offering strong efficiency for general dialogue and reasoning with a 208K token context window.", + contextLength: 208_192, + maxOutputTokens: 16_384, + created: "2026-05-01T00:00:00.000Z", + modality: { inputs: ["text"], outputs: ["text"] }, + tokenizer: "Qwen", + }, } satisfies Record; export type Qwen3ModelName = keyof typeof models; diff --git a/packages/cost/models/authors/deepseek/deepseek-v4/endpoints.ts b/packages/cost/models/authors/deepseek/deepseek-v4/endpoints.ts new file mode 100644 index 0000000000..3ad31ec747 --- /dev/null +++ b/packages/cost/models/authors/deepseek/deepseek-v4/endpoints.ts @@ -0,0 +1,79 @@ +import { ModelProviderName } from "../../../providers"; +import type { ModelProviderConfig } from "../../../types"; +import { DeepSeekV4ModelName } from "./models"; + +export const endpoints = { + "deepseek-v4.1-flash:engy": { + providerModelId: "deepseek-v4.1-flash", + provider: "engy", + author: "deepseek", + pricing: [ + { + threshold: 0, + input: 0.00000004, // $0.04/1M + output: 0.00000008, // $0.08/1M + cacheMultipliers: { + cachedInput: 0.2, // $0.008/1M cache read (20% of input) + }, + }, + ], + contextLength: 1_048_576, + maxCompletionTokens: 65_536, + supportedParameters: [ + "max_tokens", + "temperature", + "top_p", + "stop", + "stream", + "frequency_penalty", + "presence_penalty", + "seed", + "tools", + "tool_choice", + "response_format", + ], + ptbEnabled: false, + endpointConfigs: { + "*": {}, + }, + }, + "deepseek-v4-flash-0731:engy": { + providerModelId: "deepseek-v4-flash-0731", + provider: "engy", + author: "deepseek", + pricing: [ + { + threshold: 0, + input: 0.000000045, // $0.045/1M + output: 0.00000009, // $0.09/1M + cacheMultipliers: { + cachedInput: 0.2, // $0.009/1M cache read (20% of input) + }, + }, + ], + contextLength: 1_048_576, + maxCompletionTokens: 65_536, + supportedParameters: [ + "max_tokens", + "temperature", + "top_p", + "stop", + "stream", + "frequency_penalty", + "presence_penalty", + "seed", + "tools", + "tool_choice", + "response_format", + ], + ptbEnabled: false, + endpointConfigs: { + "*": {}, + }, + }, +} satisfies Partial< + Record< + `${DeepSeekV4ModelName}:${ModelProviderName}` | DeepSeekV4ModelName, + ModelProviderConfig + > +>; diff --git a/packages/cost/models/authors/deepseek/deepseek-v4/models.ts b/packages/cost/models/authors/deepseek/deepseek-v4/models.ts new file mode 100644 index 0000000000..a033755348 --- /dev/null +++ b/packages/cost/models/authors/deepseek/deepseek-v4/models.ts @@ -0,0 +1,28 @@ +import type { ModelConfig } from "../../../types"; + +export const models = { + "deepseek-v4.1-flash": { + name: "DeepSeek V4.1 Flash", + author: "deepseek", + description: + "DeepSeek V4.1 Flash is the fast multimodal variant of DeepSeek V4.1, supporting text and image inputs with a 1M token context window for latency-sensitive and high-throughput workloads.", + contextLength: 1_048_576, + maxOutputTokens: 65_536, + created: "2026-09-01T00:00:00.000Z", + modality: { inputs: ["text", "image"], outputs: ["text"] }, + tokenizer: "DeepSeek", + }, + "deepseek-v4-flash-0731": { + name: "DeepSeek V4 Flash (0731)", + author: "deepseek", + description: + "DeepSeek V4 Flash (0731) is the July 31 snapshot of DeepSeek V4 Flash, a cost-efficient general-purpose chat model with a 1M token context window.", + contextLength: 1_048_576, + maxOutputTokens: 65_536, + created: "2026-07-31T00:00:00.000Z", + modality: { inputs: ["text"], outputs: ["text"] }, + tokenizer: "DeepSeek", + }, +} satisfies Record; + +export type DeepSeekV4ModelName = keyof typeof models; diff --git a/packages/cost/models/authors/deepseek/index.ts b/packages/cost/models/authors/deepseek/index.ts index 479252640d..667f58c979 100644 --- a/packages/cost/models/authors/deepseek/index.ts +++ b/packages/cost/models/authors/deepseek/index.ts @@ -8,17 +8,20 @@ import type { ModelConfig, ModelProviderConfig } from "../../types"; // Import models import { models as r1Models } from "./r1-distill/models"; import { models as v3Models } from "./deepseek-v3/model"; +import { models as v4Models } from "./deepseek-v4/models"; import { models as reasonerModels } from "./deepseek-reasoner/model"; // Import endpoints import { endpoints as r1Endpoints } from "./r1-distill/endpoints"; import { endpoints as v3Endpoints } from "./deepseek-v3/endpoints"; +import { endpoints as v4Endpoints } from "./deepseek-v4/endpoints"; import { endpoints as reasonerEndpoints } from "./deepseek-reasoner/endpoints"; // Aggregate models export const deepseekModels = { ...r1Models, ...v3Models, + ...v4Models, ...reasonerModels, } satisfies Record; @@ -26,5 +29,6 @@ export const deepseekModels = { export const deepseekEndpointConfig = { ...r1Endpoints, ...v3Endpoints, + ...v4Endpoints, ...reasonerEndpoints, } satisfies Record; diff --git a/packages/cost/models/authors/moonshotai/index.ts b/packages/cost/models/authors/moonshotai/index.ts index 582adba43d..3061283fd6 100644 --- a/packages/cost/models/authors/moonshotai/index.ts +++ b/packages/cost/models/authors/moonshotai/index.ts @@ -8,19 +8,23 @@ import type { ModelConfig, ModelProviderConfig } from "../../types"; // Import models import { models as kimiK2Models } from "./kimi-k2/models"; import { models as kimiK25Models } from "./kimi-k2.5/models"; +import { models as kimiK3Models } from "./kimi-k3/models"; // Import endpoints import { endpoints as kimiK2Endpoints } from "./kimi-k2/endpoints"; import { endpoints as kimiK25Endpoints } from "./kimi-k2.5/endpoints"; +import { endpoints as kimiK3Endpoints } from "./kimi-k3/endpoints"; // Aggregate models export const moonshotaiModels = { ...kimiK2Models, ...kimiK25Models, + ...kimiK3Models, } satisfies Record; // Aggregate endpoints export const moonshotaiEndpointConfig = { ...kimiK2Endpoints, ...kimiK25Endpoints, + ...kimiK3Endpoints, } satisfies Record; diff --git a/packages/cost/models/authors/moonshotai/kimi-k3/endpoints.ts b/packages/cost/models/authors/moonshotai/kimi-k3/endpoints.ts new file mode 100644 index 0000000000..cda2a3e442 --- /dev/null +++ b/packages/cost/models/authors/moonshotai/kimi-k3/endpoints.ts @@ -0,0 +1,45 @@ +import { ModelProviderName } from "../../../providers"; +import type { ModelProviderConfig } from "../../../types"; +import { KimiK3ModelName } from "./models"; + +export const endpoints = { + "kimi-k3:engy": { + providerModelId: "kimi-k3", + provider: "engy", + author: "moonshotai", + pricing: [ + { + threshold: 0, + input: 0.00000195, // $1.95/1M + output: 0.00000975, // $9.75/1M + cacheMultipliers: { + cachedInput: 0.1, // $0.195/1M cache read (10% of input) + }, + }, + ], + contextLength: 1_113_088, + maxCompletionTokens: 16_384, + supportedParameters: [ + "max_tokens", + "temperature", + "top_p", + "stop", + "stream", + "frequency_penalty", + "presence_penalty", + "seed", + "tools", + "tool_choice", + "response_format", + ], + ptbEnabled: false, + endpointConfigs: { + "*": {}, + }, + }, +} satisfies Partial< + Record< + `${KimiK3ModelName}:${ModelProviderName}` | KimiK3ModelName, + ModelProviderConfig + > +>; diff --git a/packages/cost/models/authors/moonshotai/kimi-k3/models.ts b/packages/cost/models/authors/moonshotai/kimi-k3/models.ts new file mode 100644 index 0000000000..bbf0caa500 --- /dev/null +++ b/packages/cost/models/authors/moonshotai/kimi-k3/models.ts @@ -0,0 +1,17 @@ +import { ModelConfig } from "../../../types"; + +export const models = { + "kimi-k3": { + name: "Kimi K3", + author: "moonshotai", + description: + "Kimi K3 is Moonshot AI's flagship multimodal model with a 1.1M token context window, unifying vision and text understanding with strong reasoning, coding, and agentic capabilities.", + contextLength: 1_113_088, + maxOutputTokens: 16_384, + created: "2026-09-01T00:00:00.000Z", + modality: { inputs: ["text", "image"], outputs: ["text"] }, + tokenizer: "MoonshotAI", + }, +} satisfies Record; + +export type KimiK3ModelName = keyof typeof models; diff --git a/packages/cost/models/authors/zai/glm-5/endpoints.ts b/packages/cost/models/authors/zai/glm-5/endpoints.ts new file mode 100644 index 0000000000..0f18b7eea3 --- /dev/null +++ b/packages/cost/models/authors/zai/glm-5/endpoints.ts @@ -0,0 +1,113 @@ +import { ModelProviderName } from "../../../providers"; +import type { ModelProviderConfig } from "../../../types"; +import { ZaiGlm5ModelName } from "./models"; + +export const endpoints = { + "glm-5.3:engy": { + providerModelId: "glm-5.3", + provider: "engy", + author: "zai", + pricing: [ + { + threshold: 0, + input: 0.00000098, // $0.98/1M + output: 0.00000308, // $3.08/1M + cacheMultipliers: { + cachedInput: 0.184, // $0.18/1M cache read vs $0.98/1M input + }, + }, + ], + contextLength: 327_680, + maxCompletionTokens: 131_072, + supportedParameters: [ + "max_tokens", + "temperature", + "top_p", + "stop", + "stream", + "frequency_penalty", + "presence_penalty", + "seed", + "tools", + "tool_choice", + "response_format", + ], + ptbEnabled: false, + endpointConfigs: { + "*": {}, + }, + }, + "glm-5.3-flash:engy": { + providerModelId: "glm-5.3-flash", + provider: "engy", + author: "zai", + pricing: [ + { + threshold: 0, + input: 0.000000135, // $0.135/1M + output: 0.00000045, // $0.45/1M + cacheMultipliers: { + cachedInput: 0.2, // $0.027/1M cache read (20% of input) + }, + }, + ], + contextLength: 327_680, + maxCompletionTokens: 131_072, + supportedParameters: [ + "max_tokens", + "temperature", + "top_p", + "stop", + "stream", + "frequency_penalty", + "presence_penalty", + "seed", + "tools", + "tool_choice", + "response_format", + ], + ptbEnabled: false, + endpointConfigs: { + "*": {}, + }, + }, + "glm-5.2:engy": { + providerModelId: "glm-5.2", + provider: "engy", + author: "zai", + pricing: [ + { + threshold: 0, + input: 0.00000068, // $0.68/1M + output: 0.0000015, // $1.50/1M + cacheMultipliers: { + cachedInput: 0.265, // $0.18/1M cache read vs $0.68/1M input + }, + }, + ], + contextLength: 262_144, + maxCompletionTokens: 131_072, + supportedParameters: [ + "max_tokens", + "temperature", + "top_p", + "stop", + "stream", + "frequency_penalty", + "presence_penalty", + "seed", + "tools", + "tool_choice", + "response_format", + ], + ptbEnabled: false, + endpointConfigs: { + "*": {}, + }, + }, +} satisfies Partial< + Record< + `${ZaiGlm5ModelName}:${ModelProviderName}` | ZaiGlm5ModelName, + ModelProviderConfig + > +>; diff --git a/packages/cost/models/authors/zai/glm-5/models.ts b/packages/cost/models/authors/zai/glm-5/models.ts new file mode 100644 index 0000000000..13428624ef --- /dev/null +++ b/packages/cost/models/authors/zai/glm-5/models.ts @@ -0,0 +1,39 @@ +import { ModelConfig } from "../../../types"; + +export const models = { + "glm-5.3": { + name: "Zai GLM-5.3", + author: "zai", + description: + "GLM-5.3 is Zhipu AI's flagship model in the GLM-5 series, delivering major upgrades in coding, multi-step reasoning, and agentic orchestration with a 327K token context window.", + contextLength: 327_680, + maxOutputTokens: 131_072, + created: "2026-09-15T00:00:00.000Z", + modality: { inputs: ["text"], outputs: ["text"] }, + tokenizer: "Zai", + }, + "glm-5.3-flash": { + name: "Zai GLM-5.3 Flash", + author: "zai", + description: + "GLM-5.3 Flash is the fast, cost-efficient multimodal variant of GLM-5.3, supporting text and image inputs with a 327K token context window for high-throughput workloads.", + contextLength: 327_680, + maxOutputTokens: 131_072, + created: "2026-09-15T00:00:00.000Z", + modality: { inputs: ["text", "image"], outputs: ["text"] }, + tokenizer: "Zai", + }, + "glm-5.2": { + name: "Zai GLM-5.2", + author: "zai", + description: + "GLM-5.2 is Zhipu AI's previous-generation GLM-5 series model for general-purpose chat, reasoning, and coding workloads with a 262K token context window.", + contextLength: 262_144, + maxOutputTokens: 131_072, + created: "2026-06-15T00:00:00.000Z", + modality: { inputs: ["text"], outputs: ["text"] }, + tokenizer: "Zai", + }, +} satisfies Record; + +export type ZaiGlm5ModelName = keyof typeof models; diff --git a/packages/cost/models/authors/zai/index.ts b/packages/cost/models/authors/zai/index.ts index 4957ee5f06..c74349cf70 100644 --- a/packages/cost/models/authors/zai/index.ts +++ b/packages/cost/models/authors/zai/index.ts @@ -8,13 +8,17 @@ import type { ModelConfig, ModelProviderConfig } from "../../types"; // Import models and endpoints import { models as glm4Models } from "./glm-4/models"; import { endpoints as glm4Endpoints } from "./glm-4/endpoints"; +import { models as glm5Models } from "./glm-5/models"; +import { endpoints as glm5Endpoints } from "./glm-5/endpoints"; // Aggregate models export const zaiModels = { - ...glm4Models + ...glm4Models, + ...glm5Models } satisfies Record; // Aggregate endpoints export const zaiEndpointConfig = { - ...glm4Endpoints + ...glm4Endpoints, + ...glm5Endpoints } satisfies Record; From 83bb2e01fb3e0c96926eefa0f36bb1d261e7fd3f Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Thu, 15 Oct 2026 19:08:38 +0000 Subject: [PATCH 3/7] feat(web): add Engy provider card for BYOK key configuration --- web/data/providers.ts | 11 +++++++++++ web/public/assets/home/providers/engy.webp | Bin 0 -> 1664 bytes 2 files changed, 11 insertions(+) create mode 100644 web/public/assets/home/providers/engy.webp diff --git a/web/data/providers.ts b/web/data/providers.ts index 8a22235279..ad11c019e6 100644 --- a/web/data/providers.ts +++ b/web/data/providers.ts @@ -274,6 +274,17 @@ export const providers: Provider[] = [ apiKeyPlaceholder: "...", relevanceScore: 3, }, + { + id: "engy", + name: "Engy", + logoUrl: "/assets/home/providers/engy.webp", + description: + "Configure your Engy API keys for OpenAI-compatible inference across Engy's chat model catalog", + docsUrl: "https://docs.helicone.ai/getting-started/integration-methods", + apiKeyLabel: "Engy API Key", + apiKeyPlaceholder: "...", + relevanceScore: 3, + }, { id: "helicone", name: "Helicone Inference", diff --git a/web/public/assets/home/providers/engy.webp b/web/public/assets/home/providers/engy.webp new file mode 100644 index 0000000000000000000000000000000000000000..bc875bd25f8ab288d04f7bcd8e3b7b490af1f287 GIT binary patch literal 1664 zcmV-`27mcdNk&F^1^@t8MM6+kP&il$0000G000300093006|PpNc;c*009p${}B-a zZf)&tn@`CoF#<;6Xy9lZ1tXwT1PXvW|6{0}BKki8>XvF4wKP{#zoZ&3NLFs{ZWZRL z`OIW@=_NbYyW53cv5UP5c1GgVB*HbB@XehF&6^mSLd2$`l1AnvP0U3~jFU3s*KlWo z^kxRBFmVkPUcpG6ChEc^%55)Gp1V_Fdv9vkze2_1tN;H0{#~eed~a&lzdIGSmnqLB z%586=F5F0+L}>+uiEDT>gLG$tlo`K<#5ieUF4D-HBr%dyh}gV|p}7;G$%Jnb;hK>+ zH6qk4cCmN23%z9LdXwFyCp*pFt-@Tga&xlM!ffN0s8~dG0aj2rAXWtc01z(#odGHU z0RRC$F&K(Nq9LIZ#6%zi1hKbpxOYGwpdX+gz%&3qfIxtL0A5J{zZ?8n*(&9~z&}p^ za(}_{KKA$agDn%qzX1Nn{3H3l{SWd!;6IRbfPRJlTK+5j5B?wcPT(G3KSBSz{~h)K z{TBBD`g807{%`mPs^|I+un*uL&j0y)6aPK`dHx^w|Nl?er|fV15AS~hf2bey|3Cgf zJwtzhdVqfb^?&Iv^bf()dZmN=#J6G?%@@ILX@*?7bqlSJ4Q#3lKml;TWGw#&W6zYuR`3fz zlxN9Q6?;y=v77%zyJXL|Go1M4KpM^}749;QnO`R( z`AJkHsV3YEL{`yLIgbLeL2Y_%Xb!jFZj-_R(zYxXx3iKFo&Xwr18;ID0L1g{G4{;m zoq2W*<*8m^?#Xv{!PF11#aDH zA&f_}902xEfeKYuJ`NzD{{ZiFn*e5fG11?8GFA0g$D z>HZGzzzP|}$+Jm%1)Vvd2$*%IK6W!A{Q~t&e+Q+l4s9^YnB3!x0K^P5wvjjDkPwZL z-1x!JvXBGdK(|5v;=BKqfBgW;RWr~uc)11N>wkp~V&nEI;#&PLAF!UuLp`y`#)$Kh z+@IptVA6fd$NNgdl7#l5PzJ?yS*@MxMJlgK*t!{}rX_DGbr7JA~4} zEBU0iyea4$wQ;_3vjI+!v~Ar&fm-09!`+Xoy5VqV+RBnXjTX`T7DAp7aV2M)&fNm0 zrHmOL0YXhh&+?FC{l{q;3QldSgnhY6yxuVkbbui}!>r_3SxoiU4wh(fNtX_mLLbkl zcHK#I`CY7yRY>FgzTF8^|6qH{jLa+8bn8emdnF^Lh3HsQf7v$IAt22qKg1)f0cP-3 zwCd=i@fYai$}Tvx3=CIY^= zybY^+<07P{`X!k})Vl#5jS*Qp%O{DB>@(y)?2xPC?7FeVxXlZ^fyb}k6w8TZueU3k KzxaFr0000R4JlUu literal 0 HcmV?d00001 From f56daa16f081ed5518ab76e709beab53ce70d628 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Thu, 15 Oct 2026 19:08:38 +0000 Subject: [PATCH 4/7] test(worker): add Engy BYOK gateway tests and mock provider keys --- .../test/ai-gateway/registry-alibaba.spec.ts | 96 +++++++++++++++ .../test/ai-gateway/registry-deepseek.spec.ts | 96 +++++++++++++++ .../test/ai-gateway/registry-moonshot.spec.ts | 78 ++++++++++++ worker/test/ai-gateway/registry-zai.spec.ts | 116 ++++++++++++++++++ worker/test/setup.ts | 18 +++ 5 files changed, 404 insertions(+) diff --git a/worker/test/ai-gateway/registry-alibaba.spec.ts b/worker/test/ai-gateway/registry-alibaba.spec.ts index e02f1bbe03..9e3f2a61dd 100644 --- a/worker/test/ai-gateway/registry-alibaba.spec.ts +++ b/worker/test/ai-gateway/registry-alibaba.spec.ts @@ -35,6 +35,12 @@ const canopywaveAuthExpectations = { }, }; +const engyAuthExpectations = { + headers: { + Authorization: /^Bearer /, + }, +}; + describe("Alibaba Registry Tests", () => { beforeEach(() => { // Clear all mocks between tests @@ -5565,4 +5571,94 @@ describe("Alibaba Registry Tests", () => { }); }); + + describe("BYOK Tests - qwen3 with Engy Provider", () => { + describe("qwen3.8-27b", () => { + it("should handle engy provider", () => + runGatewayTest({ + model: "qwen3.8-27b/engy", + expected: { + providers: [ + { + url: "https://api.engy.ai/v1/chat/completions", + response: "success", + model: "qwen3.8-27b", + data: createOpenAIMockResponse("qwen3.8-27b"), + expects: engyAuthExpectations, + }, + ], + finalStatus: 200, + }, + })); + + it("should handle tool calls with engy provider", () => + runGatewayTest({ + model: "qwen3.8-27b/engy", + request: { + body: { + messages: [{ role: "user", content: "What's the weather?" }], + tools: [ + { + type: "function", + function: { + name: "get_weather", + description: "Get current weather", + parameters: { + type: "object", + properties: { + location: { type: "string" }, + }, + required: ["location"], + }, + }, + }, + ], + tool_choice: "auto", + temperature: 0.7, + max_tokens: 1000, + }, + }, + expected: { + providers: [ + { + url: "https://api.engy.ai/v1/chat/completions", + response: "success", + model: "qwen3.8-27b", + data: createOpenAIMockResponse("qwen3.8-27b"), + expects: { + ...engyAuthExpectations, + bodyContains: [ + "tools", + "tool_choice", + "get_weather", + "temperature", + "max_tokens", + ], + }, + }, + ], + finalStatus: 200, + }, + })); + }); + + describe("qwen3.6-35b-a3b", () => { + it("should handle engy provider", () => + runGatewayTest({ + model: "qwen3.6-35b-a3b/engy", + expected: { + providers: [ + { + url: "https://api.engy.ai/v1/chat/completions", + response: "success", + model: "qwen3.6-35b-a3b", + data: createOpenAIMockResponse("qwen3.6-35b-a3b"), + expects: engyAuthExpectations, + }, + ], + finalStatus: 200, + }, + })); + }); + }); }); diff --git a/worker/test/ai-gateway/registry-deepseek.spec.ts b/worker/test/ai-gateway/registry-deepseek.spec.ts index 125a740e44..6b9cb9754a 100644 --- a/worker/test/ai-gateway/registry-deepseek.spec.ts +++ b/worker/test/ai-gateway/registry-deepseek.spec.ts @@ -33,6 +33,12 @@ const canopywaveAuthExpectations = { }, }; +const engyAuthExpectations = { + headers: { + Authorization: /^Bearer /, + }, +}; + const chutesAuthExpectations = { headers: { Authorization: /^Bearer /, @@ -2156,4 +2162,94 @@ describe("DeepSeek Registry Tests", () => { })); }); }); + + describe("BYOK Tests - deepseek-v4 with Engy Provider", () => { + describe("deepseek-v4.1-flash", () => { + it("should handle engy provider", () => + runGatewayTest({ + model: "deepseek-v4.1-flash/engy", + expected: { + providers: [ + { + url: "https://api.engy.ai/v1/chat/completions", + response: "success", + model: "deepseek-v4.1-flash", + data: createOpenAIMockResponse("deepseek-v4.1-flash"), + expects: engyAuthExpectations, + }, + ], + finalStatus: 200, + }, + })); + + it("should handle tool calls with engy provider", () => + runGatewayTest({ + model: "deepseek-v4.1-flash/engy", + request: { + body: { + messages: [{ role: "user", content: "What's the weather?" }], + tools: [ + { + type: "function", + function: { + name: "get_weather", + description: "Get current weather", + parameters: { + type: "object", + properties: { + location: { type: "string" }, + }, + required: ["location"], + }, + }, + }, + ], + tool_choice: "auto", + temperature: 0.7, + max_tokens: 1000, + }, + }, + expected: { + providers: [ + { + url: "https://api.engy.ai/v1/chat/completions", + response: "success", + model: "deepseek-v4.1-flash", + data: createOpenAIMockResponse("deepseek-v4.1-flash"), + expects: { + ...engyAuthExpectations, + bodyContains: [ + "tools", + "tool_choice", + "get_weather", + "temperature", + "max_tokens", + ], + }, + }, + ], + finalStatus: 200, + }, + })); + }); + + describe("deepseek-v4-flash-0731", () => { + it("should handle engy provider", () => + runGatewayTest({ + model: "deepseek-v4-flash-0731/engy", + expected: { + providers: [ + { + url: "https://api.engy.ai/v1/chat/completions", + response: "success", + model: "deepseek-v4-flash-0731", + data: createOpenAIMockResponse("deepseek-v4-flash-0731"), + expects: engyAuthExpectations, + }, + ], + finalStatus: 200, + }, + })); + }); + }); }); diff --git a/worker/test/ai-gateway/registry-moonshot.spec.ts b/worker/test/ai-gateway/registry-moonshot.spec.ts index 237e160a62..5c151ac6fb 100644 --- a/worker/test/ai-gateway/registry-moonshot.spec.ts +++ b/worker/test/ai-gateway/registry-moonshot.spec.ts @@ -45,6 +45,13 @@ const canopywaveAuthExpectations = { }, }; +// Define auth expectations for Engy provider +const engyAuthExpectations = { + headers: { + Authorization: /^Bearer /, + }, +}; + describe("Moonshot AI Registry Tests", () => { beforeEach(() => { // Clear all mocks between tests @@ -3111,4 +3118,75 @@ describe("Moonshot AI Registry Tests", () => { })); }); }); + + describe("BYOK Tests - kimi-k3 with Engy Provider", () => { + describe("kimi-k3", () => { + it("should handle engy provider", () => + runGatewayTest({ + model: "kimi-k3/engy", + expected: { + providers: [ + { + url: "https://api.engy.ai/v1/chat/completions", + response: "success", + model: "kimi-k3", + data: createOpenAIMockResponse("kimi-k3"), + expects: engyAuthExpectations, + }, + ], + finalStatus: 200, + }, + })); + + it("should handle tool calls with engy provider", () => + runGatewayTest({ + model: "kimi-k3/engy", + request: { + body: { + messages: [{ role: "user", content: "What's the weather?" }], + tools: [ + { + type: "function", + function: { + name: "get_weather", + description: "Get current weather", + parameters: { + type: "object", + properties: { + location: { type: "string" }, + }, + required: ["location"], + }, + }, + }, + ], + tool_choice: "auto", + temperature: 0.7, + max_tokens: 1000, + }, + }, + expected: { + providers: [ + { + url: "https://api.engy.ai/v1/chat/completions", + response: "success", + model: "kimi-k3", + data: createOpenAIMockResponse("kimi-k3"), + expects: { + ...engyAuthExpectations, + bodyContains: [ + "tools", + "tool_choice", + "get_weather", + "temperature", + "max_tokens", + ], + }, + }, + ], + finalStatus: 200, + }, + })); + }); + }); }); diff --git a/worker/test/ai-gateway/registry-zai.spec.ts b/worker/test/ai-gateway/registry-zai.spec.ts index 0fd8930b99..38e7d2ae4d 100644 --- a/worker/test/ai-gateway/registry-zai.spec.ts +++ b/worker/test/ai-gateway/registry-zai.spec.ts @@ -17,6 +17,13 @@ const canopywaveAuthExpectations = { }, }; +// Define auth expectations for Engy provider +const engyAuthExpectations = { + headers: { + Authorization: /^Bearer /, + }, +}; + describe("Zai Registry Tests", () => { beforeEach(() => { // Clear all mocks between tests @@ -848,4 +855,113 @@ describe("Zai Registry Tests", () => { }, })); }); + + describe("BYOK Tests - glm-5 with Engy Provider", () => { + describe("glm-5.3", () => { + it("should handle engy provider", () => + runGatewayTest({ + model: "glm-5.3/engy", + expected: { + providers: [ + { + url: "https://api.engy.ai/v1/chat/completions", + response: "success", + model: "glm-5.3", + data: createOpenAIMockResponse("glm-5.3"), + expects: engyAuthExpectations, + }, + ], + finalStatus: 200, + }, + })); + + it("should handle tool calls with engy provider", () => + runGatewayTest({ + model: "glm-5.3/engy", + request: { + body: { + messages: [{ role: "user", content: "What's the weather?" }], + tools: [ + { + type: "function", + function: { + name: "get_weather", + description: "Get current weather", + parameters: { + type: "object", + properties: { + location: { type: "string" }, + }, + required: ["location"], + }, + }, + }, + ], + tool_choice: "auto", + temperature: 0.7, + max_tokens: 1000, + }, + }, + expected: { + providers: [ + { + url: "https://api.engy.ai/v1/chat/completions", + response: "success", + model: "glm-5.3", + data: createOpenAIMockResponse("glm-5.3"), + expects: { + ...engyAuthExpectations, + bodyContains: [ + "tools", + "tool_choice", + "get_weather", + "temperature", + "max_tokens", + ], + }, + }, + ], + finalStatus: 200, + }, + })); + }); + + describe("glm-5.3-flash", () => { + it("should handle engy provider", () => + runGatewayTest({ + model: "glm-5.3-flash/engy", + expected: { + providers: [ + { + url: "https://api.engy.ai/v1/chat/completions", + response: "success", + model: "glm-5.3-flash", + data: createOpenAIMockResponse("glm-5.3-flash"), + expects: engyAuthExpectations, + }, + ], + finalStatus: 200, + }, + })); + }); + + describe("glm-5.2", () => { + it("should handle engy provider", () => + runGatewayTest({ + model: "glm-5.2/engy", + expected: { + providers: [ + { + url: "https://api.engy.ai/v1/chat/completions", + response: "success", + model: "glm-5.2", + data: createOpenAIMockResponse("glm-5.2"), + expects: engyAuthExpectations, + }, + ], + finalStatus: 200, + }, + })); + }); + }); }); diff --git a/worker/test/setup.ts b/worker/test/setup.ts index 5c4865510d..d18c413260 100644 --- a/worker/test/setup.ts +++ b/worker/test/setup.ts @@ -237,6 +237,15 @@ vi.mock("@supabase/supabase-js", () => ({ config: null, byok_enabled: isByokEnabled, }, + engy: { + org_id: "test-org-id", + provider_name: "engy", + decrypted_provider_key: "test-engy-api-key", + decrypted_provider_secret_key: null, + auth_type: "api_key", + config: null, + byok_enabled: isByokEnabled, + }, nebius: { org_id: "test-org-id", provider_name: "nebius", @@ -431,6 +440,15 @@ vi.mock("@supabase/supabase-js", () => ({ config: null, byok_enabled: true, }, + engy: { + org_id: "0afe3a6e-d095-4ec0-bc1e-2af6f57bd2a5", + provider_name: "engy", + decrypted_provider_key: "helicone-engy-api-key", + decrypted_provider_secret_key: null, + auth_type: "api_key", + config: null, + byok_enabled: true, + }, nebius: { org_id: "0afe3a6e-d095-4ec0-bc1e-2af6f57bd2a5", provider_name: "nebius", From 1296cc3195b080a4ec570047667b294c25fea712 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Fri, 23 Oct 2026 06:42:07 +0000 Subject: [PATCH 5/7] fix(cost): update Engy deepseek-v4.1-flash token prices Match live Engy /v1/models: $0.03 input, $0.12 output, and $0.006 cache read per 1M tokens. cachedInput stays 0.2 because 0.006 / 0.03. Co-authored-by: crabbytt --- .../cost/models/authors/deepseek/deepseek-v4/endpoints.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/cost/models/authors/deepseek/deepseek-v4/endpoints.ts b/packages/cost/models/authors/deepseek/deepseek-v4/endpoints.ts index 3ad31ec747..b90285c2b9 100644 --- a/packages/cost/models/authors/deepseek/deepseek-v4/endpoints.ts +++ b/packages/cost/models/authors/deepseek/deepseek-v4/endpoints.ts @@ -10,10 +10,10 @@ export const endpoints = { pricing: [ { threshold: 0, - input: 0.00000004, // $0.04/1M - output: 0.00000008, // $0.08/1M + input: 0.00000003, // $0.03/1M + output: 0.00000012, // $0.12/1M cacheMultipliers: { - cachedInput: 0.2, // $0.008/1M cache read (20% of input) + cachedInput: 0.2, // $0.006/1M cache read (20% of input) }, }, ], From 38f8e85758edc700f2c5c9264a1d49666aa87a4f Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Tue, 10 Nov 2026 03:38:46 +0000 Subject: [PATCH 6/7] feat(cost): add Engy kimi-k3.1-pro chat endpoint Register kimi-k3.1-pro (moonshotai/Kimi-K3.1-Pro) in the kimi-k3 model family with an Engy gateway endpoint: 1,113,088 token context, text + image + video input, $1.40/$7.00 per 1M tokens input/output with cachedInput multiplier 0.1 ($0.14/1M cache read), matching the other Engy endpoints. --- .../registrySnapshots.test.ts.snap | 41 ++++++++++++++++--- .../authors/moonshotai/kimi-k3/endpoints.ts | 34 +++++++++++++++ .../authors/moonshotai/kimi-k3/models.ts | 11 +++++ 3 files changed, 81 insertions(+), 5 deletions(-) diff --git a/packages/__tests__/cost/__snapshots__/registrySnapshots.test.ts.snap b/packages/__tests__/cost/__snapshots__/registrySnapshots.test.ts.snap index c9849e648b..08850c3f44 100644 --- a/packages/__tests__/cost/__snapshots__/registrySnapshots.test.ts.snap +++ b/packages/__tests__/cost/__snapshots__/registrySnapshots.test.ts.snap @@ -4148,6 +4148,30 @@ exports[`Registry Snapshots endpoint configurations snapshot 1`] = ` }, }, "moonshotai/kimi-k3": { + "kimi-k3.1-pro:engy": { + "context": 1113088, + "crossRegion": false, + "maxTokens": 16384, + "modelId": "kimi-k3.1-pro", + "parameters": [ + "frequency_penalty", + "max_tokens", + "presence_penalty", + "response_format", + "seed", + "stop", + "stream", + "temperature", + "tool_choice", + "tools", + "top_p", + ], + "provider": "engy", + "ptbEnabled": false, + "regions": [ + "*", + ], + }, "kimi-k3:engy": { "context": 1113088, "crossRegion": false, @@ -7756,6 +7780,7 @@ exports[`Registry Snapshots model coverage snapshot 1`] = ` ], "moonshotai/kimi-k3": [ "engy", + "engy", ], "openai/gpt-4.1": [ "azure", @@ -9668,8 +9693,8 @@ exports[`Registry Snapshots pricing snapshot 1`] = ` "cacheMultipliers": { "cachedInput": 0.1, }, - "input": 0.00000195, - "output": 0.00000975, + "input": 0.0000014, + "output": 0.000007, "threshold": 0, }, ], @@ -10920,6 +10945,12 @@ exports[`Registry Snapshots verify registry state 1`] = ` "engy", ], }, + { + "model": "kimi-k3.1-pro", + "providers": [ + "engy", + ], + }, { "model": "llama-3.1-8b-instant", "providers": [ @@ -11188,7 +11219,7 @@ exports[`Registry Snapshots verify registry state 1`] = ` "provider": "deepseek", }, { - "modelCount": 8, + "modelCount": 9, "provider": "engy", }, { @@ -11359,8 +11390,8 @@ exports[`Registry Snapshots verify registry state 1`] = ` "claude-3.5-haiku:anthropic:*", ], "totalArchivedConfigs": 0, - "totalEndpoints": 337, - "totalModelProviderConfigs": 337, + "totalEndpoints": 338, + "totalModelProviderConfigs": 338, "totalModelsWithPtb": 108, "totalProviders": 22, } diff --git a/packages/cost/models/authors/moonshotai/kimi-k3/endpoints.ts b/packages/cost/models/authors/moonshotai/kimi-k3/endpoints.ts index cda2a3e442..00c2b97555 100644 --- a/packages/cost/models/authors/moonshotai/kimi-k3/endpoints.ts +++ b/packages/cost/models/authors/moonshotai/kimi-k3/endpoints.ts @@ -37,6 +37,40 @@ export const endpoints = { "*": {}, }, }, + "kimi-k3.1-pro:engy": { + providerModelId: "kimi-k3.1-pro", + provider: "engy", + author: "moonshotai", + pricing: [ + { + threshold: 0, + input: 0.0000014, // $1.40/1M + output: 0.000007, // $7.00/1M + cacheMultipliers: { + cachedInput: 0.1, // $0.14/1M cache read (10% of input) + }, + }, + ], + contextLength: 1_113_088, + maxCompletionTokens: 16_384, + supportedParameters: [ + "max_tokens", + "temperature", + "top_p", + "stop", + "stream", + "frequency_penalty", + "presence_penalty", + "seed", + "tools", + "tool_choice", + "response_format", + ], + ptbEnabled: false, + endpointConfigs: { + "*": {}, + }, + }, } satisfies Partial< Record< `${KimiK3ModelName}:${ModelProviderName}` | KimiK3ModelName, diff --git a/packages/cost/models/authors/moonshotai/kimi-k3/models.ts b/packages/cost/models/authors/moonshotai/kimi-k3/models.ts index bbf0caa500..1b10dc61d4 100644 --- a/packages/cost/models/authors/moonshotai/kimi-k3/models.ts +++ b/packages/cost/models/authors/moonshotai/kimi-k3/models.ts @@ -12,6 +12,17 @@ export const models = { modality: { inputs: ["text", "image"], outputs: ["text"] }, tokenizer: "MoonshotAI", }, + "kimi-k3.1-pro": { + name: "Kimi K3.1 Pro", + author: "moonshotai", + description: + "Kimi K3.1 Pro (moonshotai/Kimi-K3.1-Pro) is Moonshot AI's flagship multimodal model with a 1.1M token context window, unifying text, image, and video understanding with strong reasoning, coding, and agentic capabilities.", + contextLength: 1_113_088, + maxOutputTokens: 16_384, + created: "2026-11-01T00:00:00.000Z", + modality: { inputs: ["text", "image", "video"], outputs: ["text"] }, + tokenizer: "MoonshotAI", + }, } satisfies Record; export type KimiK3ModelName = keyof typeof models; From 37a9175d89ae1955d9b4e84c75f9ceaf68911a21 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Tue, 10 Nov 2026 03:38:46 +0000 Subject: [PATCH 7/7] test(worker): add Engy kimi-k3.1-pro BYOK gateway tests --- .../test/ai-gateway/registry-moonshot.spec.ts | 69 +++++++++++++++++++ 1 file changed, 69 insertions(+) diff --git a/worker/test/ai-gateway/registry-moonshot.spec.ts b/worker/test/ai-gateway/registry-moonshot.spec.ts index 5c151ac6fb..6397236571 100644 --- a/worker/test/ai-gateway/registry-moonshot.spec.ts +++ b/worker/test/ai-gateway/registry-moonshot.spec.ts @@ -3188,5 +3188,74 @@ describe("Moonshot AI Registry Tests", () => { }, })); }); + + describe("kimi-k3.1-pro", () => { + it("should handle engy provider", () => + runGatewayTest({ + model: "kimi-k3.1-pro/engy", + expected: { + providers: [ + { + url: "https://api.engy.ai/v1/chat/completions", + response: "success", + model: "kimi-k3.1-pro", + data: createOpenAIMockResponse("kimi-k3.1-pro"), + expects: engyAuthExpectations, + }, + ], + finalStatus: 200, + }, + })); + + it("should handle tool calls with engy provider", () => + runGatewayTest({ + model: "kimi-k3.1-pro/engy", + request: { + body: { + messages: [{ role: "user", content: "What's the weather?" }], + tools: [ + { + type: "function", + function: { + name: "get_weather", + description: "Get current weather", + parameters: { + type: "object", + properties: { + location: { type: "string" }, + }, + required: ["location"], + }, + }, + }, + ], + tool_choice: "auto", + temperature: 0.7, + max_tokens: 1000, + }, + }, + expected: { + providers: [ + { + url: "https://api.engy.ai/v1/chat/completions", + response: "success", + model: "kimi-k3.1-pro", + data: createOpenAIMockResponse("kimi-k3.1-pro"), + expects: { + ...engyAuthExpectations, + bodyContains: [ + "tools", + "tool_choice", + "get_weather", + "temperature", + "max_tokens", + ], + }, + }, + ], + finalStatus: 200, + }, + })); + }); }); });