Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1762,6 +1762,34 @@ exports[`Registry Snapshots endpoint configurations snapshot 1`] = `
"*",
],
},
"deepseek-v3:canopywave": {
"context": 131072,
"crossRegion": false,
"maxTokens": 65536,
"modelId": "deepseek/deepseek-chat-v3.1",
"parameters": [
"frequency_penalty",
"function_call",
"functions",
"logprobs",
"max_tokens",
"presence_penalty",
"response_format",
"seed",
"stop",
"stream",
"temperature",
"tool_choice",
"tools",
"top_logprobs",
"top_p",
],
"provider": "canopywave",
"ptbEnabled": true,
"regions": [
"*",
],
},
"deepseek-v3:deepinfra": {
"context": 128000,
"crossRegion": false,
Expand Down Expand Up @@ -5553,6 +5581,7 @@ exports[`Registry Snapshots model coverage snapshot 1`] = `
"openrouter",
],
"deepseek/deepseek-v3": [
"canopywave",
"deepinfra",
"deepinfra",
"deepseek",
Expand Down Expand Up @@ -6656,6 +6685,13 @@ exports[`Registry Snapshots pricing snapshot 1`] = `
],
},
"deepseek/deepseek-v3": {
"canopywave": [
{
"input": 2.7e-7,
"output": 0.000001,
"threshold": 0,
},
],
"deepinfra": [
{
"cacheMultipliers": {
Expand Down Expand Up @@ -7568,6 +7604,7 @@ exports[`Registry Snapshots verify registry state 1`] = `
{
"model": "deepseek-v3",
"providers": [
"canopywave",
"deepinfra",
"deepseek",
"openrouter",
Expand Down Expand Up @@ -8117,7 +8154,7 @@ exports[`Registry Snapshots verify registry state 1`] = `
"provider": "bedrock",
},
{
"modelCount": 2,
"modelCount": 3,
"provider": "canopywave",
},
{
Expand Down Expand Up @@ -8287,8 +8324,8 @@ exports[`Registry Snapshots verify registry state 1`] = `
"claude-3.5-haiku:anthropic:*",
],
"totalArchivedConfigs": 0,
"totalEndpoints": 242,
"totalModelProviderConfigs": 242,
"totalEndpoints": 243,
"totalModelProviderConfigs": 243,
"totalModelsWithPtb": 91,
"totalProviders": 21,
}
Expand Down
35 changes: 35 additions & 0 deletions packages/cost/models/authors/deepseek/deepseek-v3/endpoints.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,41 @@ export const endpoints = {
"*": {},
},
},
"deepseek-v3:canopywave": {
provider: "canopywave",
author: "deepseek",
providerModelId: "deepseek/deepseek-chat-v3.1",
pricing: [
{
threshold: 0,
input: 0.00000027, // $0.27 per 1M tokens
output: 0.000001, // $1.00 per 1M tokens
},
],
contextLength: 131_072,
maxCompletionTokens: 65_536,
supportedParameters: [
"frequency_penalty",
"function_call",
"functions",
"logprobs",
"max_tokens",
"presence_penalty",
"response_format",
"seed",
"stop",
"stream",
"temperature",
"tool_choice",
"tools",
"top_logprobs",
"top_p",
],
ptbEnabled: true,
endpointConfigs: {
"*": {},
},
},
"deepseek-v3.1-terminus:deepinfra": {
provider: "deepinfra",
author: "deepseek",
Expand Down
160 changes: 160 additions & 0 deletions worker/test/ai-gateway/registry-deepseek.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ const chutesAuthExpectations = {
},
};

const canopywaveAuthExpectations = {
headers: {
Authorization: /^Bearer /,
},
};

describe("DeepSeek Registry Tests", () => {
beforeEach(() => {
// Clear all mocks between tests
Expand Down Expand Up @@ -124,6 +130,22 @@ describe("DeepSeek Registry Tests", () => {
},
}));

it("should handle canopywave provider", () =>
runGatewayTest({
model: "deepseek-v3/canopywave",
expected: {
providers: [
{
url: "https://inference.canopywave.io/v1/chat/completions",
response: "success",
model: "deepseek/deepseek-chat-v3.1",
expects: canopywaveAuthExpectations,
},
],
finalStatus: 200,
},
}));

it("should auto-select deepseek provider when none specified", () =>
runGatewayTest({
model: "deepseek-reasoner",
Expand Down Expand Up @@ -531,6 +553,7 @@ describe("DeepSeek Registry Tests", () => {
},
}));
});

describe("Error scenarios - Groq Provider with DeepSeek Model", () => {
it("should handle Groq provider failure", () =>
runGatewayTest({
Expand Down Expand Up @@ -781,6 +804,56 @@ describe("DeepSeek Registry Tests", () => {
}));
});

describe("Error scenarios - Canopy Wave Provider with DeepSeek V3.1", () => {
it("should handle canopywave provider failure for DeepSeek V3.1", () =>
runGatewayTest({
model: "deepseek-v3/canopywave",
expected: {
providers: [
{
url: "https://inference.canopywave.io/v1/chat/completions",
response: "failure",
statusCode: 500,
errorMessage: "Canopy Wave service unavailable",
},
],
finalStatus: 500,
},
}));

it("should handle rate limiting from Canopy Wave for DeepSeek V3.1", () =>
runGatewayTest({
model: "deepseek-v3/canopywave",
expected: {
providers: [
{
url: "https://inference.canopywave.io/v1/chat/completions",
response: "failure",
statusCode: 429,
errorMessage: "Rate limit exceeded",
},
],
finalStatus: 429,
},
}));

it("should handle authentication failure from Canopy Wave for DeepSeek V3.1", () =>
runGatewayTest({
model: "deepseek-v3/canopywave",
expected: {
providers: [
{
url: "https://inference.canopywave.io/v1/chat/completions",
response: "failure",
statusCode: 401,
errorMessage: "Invalid API key",
},
],
finalStatus: 401,
},
}));
});

describe("Provider URL validation and model mapping", () => {
it("should construct correct DeepInfra URL for DeepSeek V3", () =>
runGatewayTest({
Expand Down Expand Up @@ -1216,6 +1289,68 @@ describe("DeepSeek Registry Tests", () => {
finalStatus: 200,
},
}));

it("should construct correct Canopy Wave URL for DeepSeek V3.1", () =>
runGatewayTest({
model: "deepseek-v3/canopywave",
expected: {
providers: [
{
url: "https://inference.canopywave.io/v1/chat/completions",
response: "success",
model: "deepseek/deepseek-chat-v3.1",
data: createOpenAIMockResponse("deepseek/deepseek-chat-v3.1"),
expects: canopywaveAuthExpectations,
customVerify: (_call) => {
// Verify that the URL is correctly constructed
// Base URL: https://inference.canopywave.io/
// Built URL: https://inference.canopywave.io/v1/chat/completions
},
},
],
finalStatus: 200,
},
}));

it("should handle provider model ID mapping correctly for Canopy Wave", () =>
runGatewayTest({
model: "deepseek-v3/canopywave",
expected: {
providers: [
{
url: "https://inference.canopywave.io/v1/chat/completions",
response: "success",
model: "deepseek/deepseek-chat-v3.1", // Should map to the correct provider model ID
data: createOpenAIMockResponse("deepseek/deepseek-chat-v3.1"),
expects: canopywaveAuthExpectations,
},
],
finalStatus: 200,
},
}));

it("should handle request body mapping for Canopy Wave", () =>
runGatewayTest({
model: "deepseek-v3/canopywave",
request: {
bodyMapping: "NO_MAPPING",
},
expected: {
providers: [
{
url: "https://inference.canopywave.io/v1/chat/completions",
response: "success",
model: "deepseek/deepseek-chat-v3.1",
data: createOpenAIMockResponse("deepseek/deepseek-chat-v3.1"),
expects: {
...canopywaveAuthExpectations,
bodyContains: ["user", "Test"],
},
},
],
finalStatus: 200,
},
}));
});

describe("Passthrough billing tests", () => {
Expand Down Expand Up @@ -1296,6 +1431,31 @@ describe("DeepSeek Registry Tests", () => {
}));
});

describe("deepseek-v3.1 with Canopy Wave", () => {
it("should handle passthrough billing with canopywave provider", () =>
runGatewayTest({
model: "deepseek-v3/canopywave",
request: {
body: {
messages: [{ role: "user", content: "Test passthrough billing" }],
passthroughBilling: true,
},
},
expected: {
providers: [
{
url: "https://inference.canopywave.io/v1/chat/completions",
response: "success",
model: "deepseek/deepseek-chat-v3.1",
data: createOpenAIMockResponse("deepseek/deepseek-chat-v3.1"),
expects: canopywaveAuthExpectations,
},
],
finalStatus: 200,
},
}));
});

describe("deepseek-tng-r1t2-chimera with Chutes", () => {
it("should handle passthrough billing with chutes provider", () =>
runGatewayTest({
Expand Down
Loading