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
880 changes: 825 additions & 55 deletions packages/__tests__/cost/__snapshots__/registrySnapshots.test.ts.snap

Large diffs are not rendered by default.

163 changes: 147 additions & 16 deletions packages/cost/models/authors/openai/gpt-4.1/endpoints.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export const endpoints = {
threshold: 0,
input: 0.000002,
output: 0.000008,
web_search: 0.01, // $10 per 1000 searches (1:1 USD; 10/1K)
web_search: 0.02, // $20 per 1000 searches
cacheMultipliers: {
cachedInput: 0.25,
},
Expand Down Expand Up @@ -50,7 +50,7 @@ export const endpoints = {
threshold: 0,
input: 0.0000004,
output: 0.0000016,
web_search: 0.01, // $10 per 1000 searches (1:1 USD; 10/1K)
web_search: 0.02, // $20 per 1000 searches
cacheMultipliers: {
cachedInput: 0.25,
},
Expand Down Expand Up @@ -89,7 +89,7 @@ export const endpoints = {
threshold: 0,
input: 0.0000004,
output: 0.0000016,
web_search: 0.01, // $10 per 1000 searches (1:1 USD; 10/1K)
web_search: 0.02, // $20 per 1000 searches
cacheMultipliers: {
cachedInput: 0.25,
},
Expand Down Expand Up @@ -128,7 +128,7 @@ export const endpoints = {
threshold: 0,
input: 0.0000001,
output: 0.0000004,
web_search: 0.01, // $10 per 1000 searches (1:1 USD; 10/1K)
web_search: 0.02, // $20 per 1000 searches
cacheMultipliers: {
cachedInput: 0.25,
},
Expand Down Expand Up @@ -167,7 +167,7 @@ export const endpoints = {
threshold: 0,
input: 0.000002,
output: 0.000008,
web_search: 0.01, // $10 per 1000 searches (1:1 USD; 10/1K)
web_search: 0.02, // $20 per 1000 searches
cacheMultipliers: {
cachedInput: 0.25,
},
Expand Down Expand Up @@ -205,7 +205,7 @@ export const endpoints = {
threshold: 0,
input: 0.0000004,
output: 0.0000016,
web_search: 0.01, // $10 per 1000 searches (1:1 USD; 10/1K)
web_search: 0.02, // $20 per 1000 searches
cacheMultipliers: {
cachedInput: 0.25,
},
Expand Down Expand Up @@ -243,7 +243,7 @@ export const endpoints = {
threshold: 0,
input: 0.0000004,
output: 0.0000016,
web_search: 0.01, // $10 per 1000 searches (1:1 USD; 10/1K)
web_search: 0.02, // $20 per 1000 searches
cacheMultipliers: {
cachedInput: 0.25,
},
Expand Down Expand Up @@ -281,9 +281,9 @@ export const endpoints = {
threshold: 0,
input: 0.0000001,
output: 0.0000004,
web_search: 0.01, // $10 per 1000 searches (1:1 USD; 10/1K)
web_search: 0.02, // $20 per 1000 searches
cacheMultipliers: {
cachedInput: 0.3,
cachedInput: 0.25,
},
},
],
Expand Down Expand Up @@ -319,7 +319,7 @@ export const endpoints = {
threshold: 0,
input: 0.00000211, // $2.11/1M - worst-case: $2.00/1M (OpenAI) * 1.055
output: 0.00000844, // $8.44/1M - worst-case: $8.00/1M (OpenAI) * 1.055
web_search: 0.01, // $10 per 1000 searches (1:1 USD; 10/1K)
web_search: 0.02, // $20 per 1000 searches
},
],
contextLength: 1_047_576,
Expand Down Expand Up @@ -350,7 +350,7 @@ export const endpoints = {
threshold: 0,
input: 0.00000042, // $0.42/1M - worst-case: $0.40/1M (OpenAI) * 1.055
output: 0.00000169, // $1.69/1M - worst-case: $1.60/1M (OpenAI) * 1.055
web_search: 0.01, // $10 per 1000 searches (1:1 USD; 10/1K)
web_search: 0.02, // $20 per 1000 searches
},
],
contextLength: 1_047_576,
Expand Down Expand Up @@ -381,7 +381,7 @@ export const endpoints = {
threshold: 0,
input: 0.00000042, // $0.42/1M - worst-case: $0.40/1M (OpenAI) * 1.055
output: 0.00000169, // $1.69/1M - worst-case: $1.60/1M (OpenAI) * 1.055
web_search: 0.01, // $10 per 1000 searches (1:1 USD; 10/1K)
web_search: 0.02, // $20 per 1000 searches
},
],
contextLength: 1_047_576,
Expand Down Expand Up @@ -412,7 +412,7 @@ export const endpoints = {
threshold: 0,
input: 0.00000011, // $0.11/1M - worst-case: $0.10/1M (OpenAI) * 1.055
output: 0.00000042, // $0.42/1M - worst-case: $0.40/1M (OpenAI) * 1.055
web_search: 0.01, // $10 per 1000 searches (1:1 USD; 10/1K)
web_search: 0.02, // $20 per 1000 searches
},
],
contextLength: 1_047_576,
Expand Down Expand Up @@ -443,7 +443,7 @@ export const endpoints = {
threshold: 0,
input: 0.000002, // $2.00 per 1M tokens
output: 0.000008, // $8.00 per 1M tokens
web_search: 0.01, // $10 per 1000 searches (1:1 USD; 10/1K)
web_search: 0.02, // $20 per 1000 searches
cacheMultipliers: {
cachedInput: 0.25, // $0.50 per 1M tokens
},
Expand Down Expand Up @@ -473,7 +473,7 @@ export const endpoints = {
threshold: 0,
input: 0.0000001, // $0.10 per 1M tokens
output: 0.0000004, // $0.40 per 1M tokens
web_search: 0.01, // $10 per 1000 searches (1:1 USD; 10/1K)
web_search: 0.02, // $20 per 1000 searches
cacheMultipliers: {
cachedInput: 0.25, // $0.025 per 1M tokens
},
Expand All @@ -496,7 +496,7 @@ export const endpoints = {
threshold: 0,
input: 0.0000004, // $0.40 per 1M tokens
output: 0.0000016, // $1.60 per 1M tokens
web_search: 0.01, // $10 per 1000 searches (1:1 USD; 10/1K)
web_search: 0.02, // $20 per 1000 searches
cacheMultipliers: {
cachedInput: 0.25, // $0.10 per 1M tokens
},
Expand All @@ -517,6 +517,137 @@ export const endpoints = {
"*": {},
},
},
"gpt-4.1-nano-2025-04-14:openai": {
providerModelId: "gpt-4.1-nano-2025-04-14",
provider: "openai",
author: "openai",
pricing: [
{
threshold: 0,
input: 0.0000001,
output: 0.0000004,
web_search: 0.02, // $20 per 1000 searches
cacheMultipliers: {
cachedInput: 0.25,
},
},
],
contextLength: 1047576,
maxCompletionTokens: 32768,
rateLimits: {
rpm: 30000,
tpm: 150000000,
tpd: 15000000000,
},
supportedParameters: [
"tools",
"tool_choice",
"seed",
"max_tokens",
"response_format",
"temperature",
"top_p",
"stop",
"frequency_penalty",
"presence_penalty",
],
ptbEnabled: true,
endpointConfigs: {
"*": {},
},
},
"gpt-4.1-nano-2025-04-14:azure": {
providerModelId: "gpt-4.1-nano-2025-04-14",
provider: "azure",
author: "openai",
pricing: [
{
threshold: 0,
input: 0.0000001,
output: 0.0000004,
web_search: 0.02, // $20 per 1000 searches
cacheMultipliers: {
cachedInput: 0.25,
},
},
],
contextLength: 1047576,
maxCompletionTokens: 32768,
rateLimits: {
rpm: 200,
tpm: 200000,
},
supportedParameters: [
"tools",
"tool_choice",
"seed",
"max_tokens",
"response_format",
"temperature",
"top_p",
"stop",
"frequency_penalty",
"presence_penalty",
],
ptbEnabled: true,
endpointConfigs: {
"*": {},
},
},
"gpt-4.1-nano-2025-04-14:openrouter": {
provider: "openrouter",
author: "openai",
providerModelId: "openai/gpt-4.1-nano-2025-04-14",
pricing: [
{
threshold: 0,
input: 0.00000011, // $0.11/1M - worst-case: $0.10/1M (OpenAI) * 1.055
output: 0.00000042, // $0.42/1M - worst-case: $0.40/1M (OpenAI) * 1.055
web_search: 0.02, // $20 per 1000 searches
},
],
contextLength: 1_047_576,
maxCompletionTokens: 32_768,
supportedParameters: [
"tools",
"tool_choice",
"seed",
"max_tokens",
"response_format",
"temperature",
"top_p",
"stop",
"frequency_penalty",
"presence_penalty",
],
ptbEnabled: true,
endpointConfigs: {
"*": {},
},
},
"gpt-4.1-nano-2025-04-14:helicone": {
provider: "helicone",
author: "openai",
providerModelId: "pa/gt-4.1-n-2025",
pricing: [
{
threshold: 0,
input: 0.0000001, // $0.10 per 1M tokens
output: 0.0000004, // $0.40 per 1M tokens
web_search: 0.02, // $20 per 1000 searches
cacheMultipliers: {
cachedInput: 0.25, // $0.025 per 1M tokens
},
},
],
contextLength: 128000,
maxCompletionTokens: 8192,
supportedParameters: ["max_tokens", "temperature", "top_p", "stop"],
ptbEnabled: true,
endpointConfigs: {
"*": {},
},
},
} satisfies Partial<
Record<`${GPT41ModelName}:${ModelProviderName}`, ModelProviderConfig>
>;
12 changes: 12 additions & 0 deletions packages/cost/models/authors/openai/gpt-4.1/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,18 @@ export const models = {
tokenizer: "GPT",
pinnedVersionOfModel: "gpt-4.1-mini",
},
"gpt-4.1-nano-2025-04-14": {
name: "OpenAI GPT-4.1 Nano",
author: "openai",
description:
"For tasks that demand low latency, GPT-4.1 nano is the fastest and cheapest model in the GPT-4.1 series. It delivers exceptional performance at a small size with its 1 million token context window, and scores 80.1% on MMLU, 50.3% on GPQA, and 9.8% on Aider polyglot coding – even higher than GPT-4o mini. It's ideal for tasks like classification or autocompletion.",
contextLength: 1047576,
maxOutputTokens: 32768,
created: "2025-04-14T17:22:49.000Z",
modality: { inputs: ["text", "image"], outputs: ["text"] },
tokenizer: "GPT",
pinnedVersionOfModel: "gpt-4.1-nano",
},
} satisfies Record<string, ModelConfig>;

export type GPT41ModelName = keyof typeof models;
Loading
Loading