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
3 changes: 2 additions & 1 deletion apps/gateway/src/api.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1746,7 +1746,8 @@ describe("e2e", () => {

const log = await validateLogs();
expect(log.streamed).toBe(false);
expect(log.usedModel).toBe("gpt-5-nano");
expect(log.usedModel).toBe("openai/gpt-5-nano");
expect(log.usedModelMapping).toBe("gpt-5-nano");
expect(log.usedProvider).toBe("openai");

// Verify it's a reasoning model response
Expand Down
30 changes: 22 additions & 8 deletions apps/gateway/src/chat/chat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@ function createLogEntry(
apiKey: ApiKey,
providerKeyId: string | undefined,
usedModel: string,
usedModelMapping: string | undefined,
usedProvider: string,
requestedModel: string,
requestedProvider: string | undefined,
Expand Down Expand Up @@ -258,6 +259,7 @@ function createLogEntry(
apiKeyId: apiKey.id,
usedMode: providerKeyId ? "api-keys" : "credits",
usedModel,
usedModelMapping,
usedProvider,
requestedModel,
requestedProvider,
Expand Down Expand Up @@ -2624,6 +2626,10 @@ chat.openapi(completions, async (c) => {

const baseModelName = finalModelInfo?.id || usedModel;

// Create the model mapping values according to new schema
const usedModelMapping = usedModel; // Store the original provider model name
const usedModelFormatted = `${usedProvider}/${baseModelName}`; // Store in LLMGateway format

let url: string | undefined;

// Get the provider key for the selected provider based on project mode
Expand Down Expand Up @@ -2916,7 +2922,8 @@ chat.openapi(completions, async (c) => {
project,
apiKey,
providerKey?.id,
usedModel,
usedModelFormatted,
usedModelMapping,
usedProvider,
requestedModel,
requestedProvider,
Expand Down Expand Up @@ -3003,7 +3010,8 @@ chat.openapi(completions, async (c) => {
project,
apiKey,
providerKey?.id,
usedModel,
usedModelFormatted,
usedModelMapping,
usedProvider,
requestedModel,
requestedProvider,
Expand Down Expand Up @@ -3214,7 +3222,8 @@ chat.openapi(completions, async (c) => {
project,
apiKey,
providerKey?.id,
usedModel,
usedModelFormatted,
usedModelMapping,
usedProvider,
requestedModel,
requestedProvider,
Expand Down Expand Up @@ -3336,7 +3345,8 @@ chat.openapi(completions, async (c) => {
project,
apiKey,
providerKey?.id,
usedModel,
usedModelFormatted,
usedModelMapping,
usedProvider,
requestedModel,
requestedProvider,
Expand Down Expand Up @@ -4135,7 +4145,8 @@ chat.openapi(completions, async (c) => {
project,
apiKey,
providerKey?.id,
usedModel,
usedModelFormatted,
usedModelMapping,
usedProvider,
requestedModel,
requestedProvider,
Expand Down Expand Up @@ -4279,7 +4290,8 @@ chat.openapi(completions, async (c) => {
project,
apiKey,
providerKey?.id,
usedModel,
usedModelFormatted,
usedModelMapping,
usedProvider,
requestedModel,
requestedProvider,
Expand Down Expand Up @@ -4355,7 +4367,8 @@ chat.openapi(completions, async (c) => {
project,
apiKey,
providerKey?.id,
usedModel,
usedModelFormatted,
usedModelMapping,
usedProvider,
requestedModel,
requestedProvider,
Expand Down Expand Up @@ -4528,7 +4541,8 @@ chat.openapi(completions, async (c) => {
project,
apiKey,
providerKey?.id,
usedModel,
usedModelFormatted,
usedModelMapping,
usedProvider,
requestedModel,
requestedProvider,
Expand Down
1 change: 1 addition & 0 deletions packages/db/migrations/1757376520_brief_roughhouse.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE "log" ADD COLUMN "used_model_mapping" text;
Loading
Loading