Skip to content

Commit d268748

Browse files
yrooogerglidge-jun
authored andcommitted
fix(providers): preserve Volcengine custom destinations
1 parent 4e7f5a5 commit d268748

2 files changed

Lines changed: 32 additions & 0 deletions

File tree

src/providers/registry.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1107,6 +1107,7 @@ export const PROVIDER_REGISTRY: readonly ProviderRegistryEntry[] = [
11071107
baseUrl: "https://ark.cn-beijing.volces.com/api/v3",
11081108
adapter: "openai-chat",
11091109
authKind: "key",
1110+
preserveCustomDestination: true,
11101111
dashboardUrl: "https://console.volcengine.com/ark/region:ark+cn-beijing/apikey",
11111112
defaultModel: "doubao-seed-2-1-pro-260628",
11121113
models: VOLCENGINE_ARK_MODELS,
@@ -1139,6 +1140,7 @@ export const PROVIDER_REGISTRY: readonly ProviderRegistryEntry[] = [
11391140
baseUrl: "https://ark.cn-beijing.volces.com/api/coding/v3",
11401141
adapter: "openai-chat",
11411142
authKind: "key",
1143+
preserveCustomDestination: true,
11421144
dashboardUrl: "https://console.volcengine.com/ark/region:ark+cn-beijing/overview",
11431145
defaultModel: "ark-code-latest",
11441146
models: VOLCENGINE_CODING_PLAN_MODELS,
@@ -1160,6 +1162,7 @@ export const PROVIDER_REGISTRY: readonly ProviderRegistryEntry[] = [
11601162
responsesPath: "/responses",
11611163
adapter: "openai-responses",
11621164
authKind: "key",
1165+
preserveCustomDestination: true,
11631166
dashboardUrl: "https://console.volcengine.com/ark/region:ark+cn-beijing/overview",
11641167
defaultModel: "deepseek-v4-pro",
11651168
models: VOLCENGINE_AGENT_PLAN_MODELS,

tests/volcengine-providers.test.ts

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ describe("Volcengine Ark providers", () => {
2121
baseUrl: "https://ark.cn-beijing.volces.com/api/v3",
2222
adapter: "openai-chat",
2323
authKind: "key",
24+
preserveCustomDestination: true,
2425
defaultModel: "doubao-seed-2-1-pro-260628",
2526
models: [
2627
"doubao-seed-2-1-pro-260628",
@@ -44,6 +45,7 @@ describe("Volcengine Ark providers", () => {
4445
baseUrl: "https://ark.cn-beijing.volces.com/api/coding/v3",
4546
adapter: "openai-chat",
4647
authKind: "key",
48+
preserveCustomDestination: true,
4749
defaultModel: "ark-code-latest",
4850
models: [
4951
"ark-code-latest",
@@ -75,6 +77,7 @@ describe("Volcengine Ark providers", () => {
7577
responsesPath: "/responses",
7678
adapter: "openai-responses",
7779
authKind: "key",
80+
preserveCustomDestination: true,
7881
defaultModel: "deepseek-v4-pro",
7982
models: [
8083
"deepseek-v4-pro",
@@ -144,6 +147,32 @@ describe("Volcengine Ark providers", () => {
144147
expect(request.url).toBe("https://ark.cn-beijing.volces.com/api/plan/v3/responses");
145148
});
146149

150+
test.each([
151+
["volcengine", "openai-chat", "https://custom.example.com/api/v3"],
152+
["volcengine-coding-plan", "openai-chat", "https://custom.example.com/api/coding/v3"],
153+
["volcengine-agent-plan", "openai-responses", "https://custom.example.com/api/plan/v3"],
154+
] as const)(
155+
"preserves an existing same-name custom %s destination",
156+
(providerId, adapter, baseUrl) => {
157+
const config: OcxConfig = {
158+
port: 10100,
159+
defaultProvider: providerId,
160+
providers: {
161+
[providerId]: {
162+
adapter,
163+
baseUrl,
164+
authMode: "key",
165+
apiKey: "test-key",
166+
},
167+
},
168+
};
169+
170+
const route = routeModel(config, `${providerId}/custom-model`);
171+
expect(route.provider.baseUrl).toBe(baseUrl);
172+
expect(route.provider.adapter).toBe(adapter);
173+
},
174+
);
175+
147176
test("maps the documented Ark thinking toggle on the pay-as-you-go Chat wire", () => {
148177
const config: OcxConfig = {
149178
port: 10100,

0 commit comments

Comments
 (0)