Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Avian costs #3158

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
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
44 changes: 44 additions & 0 deletions bifrost/packages/cost/providers/avian/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import { ModelRow } from "../../interfaces/Cost";

export const costs: ModelRow[] = [
{
model: {
operator: "equals",
value: "Meta-Llama-3.1-405B-Instruct",
},
cost: {
prompt_token: 0.0000015,
completion_token: 0.0000015,
},
},
{
model: {
operator: "equals",
value: "Meta-Llama-3.3-70B-Instruct",
},
cost: {
prompt_token: 0.00000045,
completion_token: 0.00000045,
},
},
{
model: {
operator: "equals",
value: "Meta-Llama-3.1-70B-Instruct",
},
cost: {
prompt_token: 0.00000045,
completion_token: 0.00000045,
},
},
{
model: {
operator: "equals",
value: "Meta-Llama-3.1-8B-Instruct",
},
cost: {
prompt_token: 0.0000001,
completion_token: 0.0000001,
},
},
];
17 changes: 17 additions & 0 deletions bifrost/packages/cost/providers/mappings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ import { openAIProvider } from "./openai";
import { anthropicProvider } from "./anthropic";
import { costs as awsBedrockCosts } from "./awsBedrock";
import { costs as deepseekCosts } from "./deepseek";
import { costs as xCosts } from "./x";
import { costs as avianCosts } from "./avian";

const openAiPattern = /^https:\/\/api\.openai\.com/;
const anthropicPattern = /^https:\/\/api\.anthropic\.com/;
Expand Down Expand Up @@ -52,6 +54,9 @@ const firecrawl = /^https:\/\/api\.firecrawl\.dev/;
const awsBedrock = /^https:\/\/bedrock-runtime\.[a-z0-9-]+\.amazonaws\.com\/.*/;
// https://api.deepseek.com
const deepseek = /^https:\/\/api\.deepseek\.com/;
// https://api.x.ai
const x = /^https:\/\/api\.x\.ai/;
const avianPattern = /^https:\/\/api\.avian\.io/;

export const providersNames = [
"OPENAI",
Expand All @@ -78,6 +83,8 @@ export const providersNames = [
"FIRECRAWL",
"AWS",
"DEEPSEEK",
"X",
"AVIAN"
] as const;

export type ProviderName = (typeof providersNames)[number];
Expand Down Expand Up @@ -127,6 +134,11 @@ export const providers: {
pattern: cloudflareAiGatewayPattern,
provider: "CLOUDFLARE",
},
{
pattern: x,
provider: "X",
costs: xCosts,
},
{
pattern: twoYFV,
provider: "2YFV",
Expand Down Expand Up @@ -206,6 +218,11 @@ export const providers: {
provider: "DEEPSEEK",
costs: deepseekCosts,
},
{
pattern: avianPattern,
provider: "AVIAN",
costs: avianCosts,
},
];

export const playgroundModels: {
Expand Down
18 changes: 18 additions & 0 deletions costs/__tests__/ensureOnlyOne.ts
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,15 @@ WHEN (request_response_rmt.model ILIKE 'o1-mini-2024-09-12') THEN 3000 * request
ELSE 0
END
)
WHEN (request_response_rmt.provider = 'X') THEN (
CASE
WHEN (request_response_rmt.model ILIKE 'grok-beta') THEN 5000 * request_response_rmt.prompt_tokens + 15000 * request_response_rmt.completion_tokens
WHEN (request_response_rmt.model ILIKE 'grok-vision-beta') THEN 5000 * request_response_rmt.prompt_tokens + 15000 * request_response_rmt.completion_tokens
WHEN (request_response_rmt.model ILIKE 'grok-2-1212') THEN 2000 * request_response_rmt.prompt_tokens + 10000 * request_response_rmt.completion_tokens
WHEN (request_response_rmt.model ILIKE 'grok-2-vision-1212') THEN 2000 * request_response_rmt.prompt_tokens + 10000 * request_response_rmt.completion_tokens
ELSE 0
END
)
WHEN (request_response_rmt.provider = 'TOGETHER') THEN (
CASE
WHEN (request_response_rmt.model ILIKE 'allenai/OLMo-7B-Instruct') THEN 200 * request_response_rmt.prompt_tokens + 200 * request_response_rmt.completion_tokens
Expand Down Expand Up @@ -802,6 +811,15 @@ WHEN (request_response_rmt.provider = 'DEEPSEEK') THEN (
WHEN (request_response_rmt.model ILIKE 'deepseek-chat') THEN 14 * request_response_rmt.prompt_tokens + 28 * request_response_rmt.completion_tokens
ELSE 0
END
)
WHEN (request_response_rmt.provider = 'AVIAN') THEN (
CASE
WHEN (request_response_rmt.model ILIKE 'Meta-Llama-3.1-405B-Instruct') THEN 1500 * request_response_rmt.prompt_tokens + 1500 * request_response_rmt.completion_tokens
WHEN (request_response_rmt.model ILIKE 'Meta-Llama-3.3-70B-Instruct') THEN 450 * request_response_rmt.prompt_tokens + 450 * request_response_rmt.completion_tokens
WHEN (request_response_rmt.model ILIKE 'Meta-Llama-3.1-70B-Instruct') THEN 450 * request_response_rmt.prompt_tokens + 450 * request_response_rmt.completion_tokens
WHEN (request_response_rmt.model ILIKE 'Meta-Llama-3.1-8B-Instruct') THEN 100 * request_response_rmt.prompt_tokens + 100 * request_response_rmt.completion_tokens
ELSE 0
END
)
ELSE
CASE
Expand Down
44 changes: 44 additions & 0 deletions costs/src/providers/avian/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import { ModelRow } from "../../interfaces/Cost";

export const costs: ModelRow[] = [
{
model: {
operator: "equals",
value: "Meta-Llama-3.1-405B-Instruct",
},
cost: {
prompt_token: 0.0000015,
completion_token: 0.0000015,
},
},
{
model: {
operator: "equals",
value: "Meta-Llama-3.3-70B-Instruct",
},
cost: {
prompt_token: 0.00000045,
completion_token: 0.00000045,
},
},
{
model: {
operator: "equals",
value: "Meta-Llama-3.1-70B-Instruct",
},
cost: {
prompt_token: 0.00000045,
completion_token: 0.00000045,
},
},
{
model: {
operator: "equals",
value: "Meta-Llama-3.1-8B-Instruct",
},
cost: {
prompt_token: 0.0000001,
completion_token: 0.0000001,
},
},
];
8 changes: 8 additions & 0 deletions costs/src/providers/mappings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { anthropicProvider } from "./anthropic";
import { costs as awsBedrockCosts } from "./awsBedrock";
import { costs as deepseekCosts } from "./deepseek";
import { costs as xCosts } from "./x";
import { costs as avianCosts } from "./avian";

const openAiPattern = /^https:\/\/api\.openai\.com/;
const anthropicPattern = /^https:\/\/api\.anthropic\.com/;
Expand Down Expand Up @@ -55,6 +56,7 @@ const awsBedrock = /^https:\/\/bedrock-runtime\.[a-z0-9-]+\.amazonaws\.com\/.*/;
const deepseek = /^https:\/\/api\.deepseek\.com/;
// https://api.x.ai
const x = /^https:\/\/api\.x\.ai/;
const avianPattern = /^https:\/\/api\.avian\.io/;

export const providersNames = [
"OPENAI",
Expand Down Expand Up @@ -82,6 +84,7 @@ export const providersNames = [
"AWS",
"DEEPSEEK",
"X",
"AVIAN"
] as const;

export type ProviderName = (typeof providersNames)[number];
Expand Down Expand Up @@ -215,6 +218,11 @@ export const providers: {
provider: "DEEPSEEK",
costs: deepseekCosts,
},
{
pattern: avianPattern,
provider: "AVIAN",
costs: avianCosts,
},
];

export const playgroundModels: {
Expand Down
44 changes: 44 additions & 0 deletions valhalla/jawn/src/packages/cost/providers/avian/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import { ModelRow } from "../../interfaces/Cost";

export const costs: ModelRow[] = [
{
model: {
operator: "equals",
value: "Meta-Llama-3.1-405B-Instruct",
},
cost: {
prompt_token: 0.0000015,
completion_token: 0.0000015,
},
},
{
model: {
operator: "equals",
value: "Meta-Llama-3.3-70B-Instruct",
},
cost: {
prompt_token: 0.00000045,
completion_token: 0.00000045,
},
},
{
model: {
operator: "equals",
value: "Meta-Llama-3.1-70B-Instruct",
},
cost: {
prompt_token: 0.00000045,
completion_token: 0.00000045,
},
},
{
model: {
operator: "equals",
value: "Meta-Llama-3.1-8B-Instruct",
},
cost: {
prompt_token: 0.0000001,
completion_token: 0.0000001,
},
},
];
17 changes: 17 additions & 0 deletions valhalla/jawn/src/packages/cost/providers/mappings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ import { openAIProvider } from "./openai";
import { anthropicProvider } from "./anthropic";
import { costs as awsBedrockCosts } from "./awsBedrock";
import { costs as deepseekCosts } from "./deepseek";
import { costs as xCosts } from "./x";
import { costs as avianCosts } from "./avian";

const openAiPattern = /^https:\/\/api\.openai\.com/;
const anthropicPattern = /^https:\/\/api\.anthropic\.com/;
Expand Down Expand Up @@ -52,6 +54,9 @@ const firecrawl = /^https:\/\/api\.firecrawl\.dev/;
const awsBedrock = /^https:\/\/bedrock-runtime\.[a-z0-9-]+\.amazonaws\.com\/.*/;
// https://api.deepseek.com
const deepseek = /^https:\/\/api\.deepseek\.com/;
// https://api.x.ai
const x = /^https:\/\/api\.x\.ai/;
const avianPattern = /^https:\/\/api\.avian\.io/;

export const providersNames = [
"OPENAI",
Expand All @@ -78,6 +83,8 @@ export const providersNames = [
"FIRECRAWL",
"AWS",
"DEEPSEEK",
"X",
"AVIAN"
] as const;

export type ProviderName = (typeof providersNames)[number];
Expand Down Expand Up @@ -127,6 +134,11 @@ export const providers: {
pattern: cloudflareAiGatewayPattern,
provider: "CLOUDFLARE",
},
{
pattern: x,
provider: "X",
costs: xCosts,
},
{
pattern: twoYFV,
provider: "2YFV",
Expand Down Expand Up @@ -206,6 +218,11 @@ export const providers: {
provider: "DEEPSEEK",
costs: deepseekCosts,
},
{
pattern: avianPattern,
provider: "AVIAN",
costs: avianCosts,
},
];

export const playgroundModels: {
Expand Down
44 changes: 44 additions & 0 deletions web/packages/cost/providers/avian/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import { ModelRow } from "../../interfaces/Cost";

export const costs: ModelRow[] = [
{
model: {
operator: "equals",
value: "Meta-Llama-3.1-405B-Instruct",
},
cost: {
prompt_token: 0.0000015,
completion_token: 0.0000015,
},
},
{
model: {
operator: "equals",
value: "Meta-Llama-3.3-70B-Instruct",
},
cost: {
prompt_token: 0.00000045,
completion_token: 0.00000045,
},
},
{
model: {
operator: "equals",
value: "Meta-Llama-3.1-70B-Instruct",
},
cost: {
prompt_token: 0.00000045,
completion_token: 0.00000045,
},
},
{
model: {
operator: "equals",
value: "Meta-Llama-3.1-8B-Instruct",
},
cost: {
prompt_token: 0.0000001,
completion_token: 0.0000001,
},
},
];
Loading
Loading