Skip to content
Merged
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 @@ -74,6 +74,10 @@ export const OPENAI_CHAT_MODEL_COSTS = {
promptTokenCostInMillicents: 0.3,
completionTokenCostInMillicents: 0.4,
},
"gpt-4o": {
promptTokenCostInMillicents: 2,
completionTokenCostInMillicents: 4,
},
} as const;

export type OpenAIChatResponse = {
Expand All @@ -86,6 +90,7 @@ export type OpenAIChatResponse = {
type FineTuneableOpenAIChatModelType =
| `gpt-3.5-turbo`
| `gpt-3.5-turbo-0613`
| `gpt-4o`
| `gpt-4-0613`;

type FineTunedOpenAIChatModelType =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import { countOpenAIChatPromptTokens } from "./countOpenAIChatMessageTokens";
// Open AI base chat models and their context window sizes.
export const CHAT_MODEL_CONTEXT_WINDOW_SIZES = {
"gpt-4": 8192,
"gpt-4o": 128000,
"gpt-4-0314": 8192,
"gpt-4-0613": 8192,
"gpt-4-turbo-preview": 128000,
Expand Down Expand Up @@ -66,7 +67,9 @@ export function getOpenAIChatModelInformation(model: OpenAIChatModelType): {
const [_, baseModel, ___, ____, _____] = model.split(":");

if (
["gpt-3.5-turbo", "gpt-3.5-turbo-0613", "gpt-4-0613"].includes(baseModel)
["gpt-3.5-turbo", "gpt-3.5-turbo-0613", "gpt-4-0613", "gpt-4o"].includes(
baseModel
)
) {
const contextWindowSize =
CHAT_MODEL_CONTEXT_WINDOW_SIZES[
Expand All @@ -86,7 +89,8 @@ export function getOpenAIChatModelInformation(model: OpenAIChatModelType): {
type FineTuneableOpenAIChatModelType =
| `gpt-3.5-turbo`
| `gpt-3.5-turbo-0613`
| `gpt-4-0613`;
| `gpt-4-0613`
| `gpt-4o`;

type FineTunedOpenAIChatModelType =
`ft:${FineTuneableOpenAIChatModelType}:${string}:${string}:${string}`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ function getTiktokenBPE(
case "gpt-3.5-turbo-16k-0613":
case "gpt-3.5-turbo-instruct":
case "gpt-4":
case "gpt-4o":
case "gpt-4-0314":
case "gpt-4-0613":
case "gpt-4-turbo-preview":
Expand Down