Rename to v1_models and use with openai as well

This commit is contained in:
Owen
2026-08-20 16:01:07 -04:00
parent 365a905e69
commit e65a79cc48
12 changed files with 24 additions and 24 deletions
+2 -2
View File
@@ -135,8 +135,8 @@ export const AI_CAPABILITY_DEFS: Record<AiCapability, AiCapabilityDefinition> =
joinUpstreamUrl(base, pathFromRequest(req)),
isStreaming: isBodyOrSseStreaming
},
anthropic_models: {
id: "anthropic_models",
v1_models: {
id: "v1_models",
protocolFamily: "anthropic",
routes: [
{ method: "GET", path: "/v1/models" },
+2 -2
View File
@@ -472,7 +472,7 @@ const REQUEST_NORMALIZERS: Record<
openai_responses: normalizeOpenAiResponsesRequest,
anthropic_messages: normalizeAnthropicRequest,
// Model discovery carries no transcript to normalize.
anthropic_models: () => null,
v1_models: () => null,
gemini_generate_content: normalizeGeminiRequest,
google_generate_content: normalizeGeminiRequest,
google_raw_predict: normalizeBestEffortRequest,
@@ -487,7 +487,7 @@ const RESPONSE_NORMALIZERS: Record<
openai_chat: normalizeOpenAiChatResponse,
openai_responses: normalizeOpenAiResponsesResponse,
anthropic_messages: normalizeAnthropicResponse,
anthropic_models: () => null,
v1_models: () => null,
gemini_generate_content: normalizeGeminiResponse,
google_generate_content: normalizeGeminiResponse,
google_raw_predict: normalizeGoogleRawPredictResponse,
+1 -1
View File
@@ -336,7 +336,7 @@ const EXTRACTORS: Record<
openai_responses: extractOpenAiResponses,
anthropic_messages: extractAnthropicMessages,
// Model discovery never runs a model, so there are no tokens to bill.
anthropic_models: () => null,
v1_models: () => null,
gemini_generate_content: extractGoogleGenerateContent,
google_generate_content: extractGoogleGenerateContent,
// rawPredict is a passthrough to whatever the underlying publisher
@@ -4,7 +4,7 @@ import {
type AiCapability
} from "@server/lib/aiCapabilities";
import { handleAiGatewayProxy } from "@server/routers/aiGateway/pipeline";
import { handleAnthropicModels } from "@server/routers/aiGateway/anthropicModels";
import { handleV1Models } from "@server/routers/aiGateway";
type CapabilityHandler = (
req: Request,
@@ -15,7 +15,7 @@ type CapabilityHandler = (
// Capabilities the gateway answers itself instead of proxying upstream.
// Everything else goes through the inference pipeline.
const LOCAL_HANDLERS: Partial<Record<AiCapability, CapabilityHandler>> = {
anthropic_models: handleAnthropicModels
v1_models: handleV1Models
};
export function createAiGatewayRouter() {
+1 -1
View File
@@ -1,3 +1,3 @@
export { handleAiGatewayProxy } from "./pipeline";
export { handleAnthropicModels } from "./anthropicModels";
export { handleV1Models } from "./v1Models";
export { createAiGatewayRouter } from "./createAiGatewayRouter";
@@ -35,7 +35,7 @@ import {
import logger from "@server/logger";
import HttpCode from "@server/types/HttpCode";
const CAPABILITY: AiCapability = "anthropic_models";
const CAPABILITY: AiCapability = "v1_models";
const querySchema = z.object({
limit: z.coerce.number().int().min(1).max(MODEL_PAGE_MAX_LIMIT).optional(),
@@ -163,7 +163,7 @@ function buildDiscoveryProviders(
* list at all or would expose models the resource's allow/block lists forbid,
* so the response is built from the same effective lists that gate inference.
*/
export async function handleAnthropicModels(
export async function handleV1Models(
req: Request,
res: Response
): Promise<any> {