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: 3 additions & 0 deletions src/shared/constants/modelSupportedEndpoints.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
export const MODEL_SUPPORTED_ENDPOINT_VALUES = [
"chat",
"responses",
"embeddings",
"rerank",
"images",
Expand Down Expand Up @@ -37,6 +38,8 @@ export function classifyModelSupportedEndpoints(endpoints: readonly string[]): {
type?: "embedding" | "rerank" | "image" | "video" | "audio";
subtype?: "speech" | "transcription";
} {
// "chat" and "responses" are text-conversation endpoints; they carry no
// modality type, so they fall through to the empty return below.
if (endpoints.includes("embeddings")) return { type: "embedding" };
if (endpoints.includes("rerank")) return { type: "rerank" };
if (endpoints.includes("images")) return { type: "image" };
Expand Down
16 changes: 16 additions & 0 deletions tests/unit/model-supported-endpoints.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
MODEL_SUPPORTED_ENDPOINT_VALUES,
normalizeModelSupportedEndpoints,
} from "../../src/shared/constants/modelSupportedEndpoints.ts";
import { providerModelMutationSchema } from "../../src/shared/validation/schemas/provider.ts";

test("normalizes legacy video and audio metadata to operation-specific endpoint ids", () => {
assert.deepEqual(normalizeModelSupportedEndpoints(["chat", "video", "audio"]), [
Expand Down Expand Up @@ -56,3 +57,18 @@ test("classifies operation-specific media endpoints for the model catalog", () =
type: "audio",
});
});

test("accepts the responses endpoint emitted by Codex discovery", () => {
assert.ok(MODEL_SUPPORTED_ENDPOINT_VALUES.includes("responses"));
assert.deepEqual(normalizeModelSupportedEndpoints(["responses"]), ["responses"]);
// A responses-only model is a plain chat-type model: no media type override.
assert.deepEqual(classifyModelSupportedEndpoints(["responses"]), {});

const parsed = providerModelMutationSchema.safeParse({
provider: "codex",
modelId: "gpt-6-sol",
supportedEndpoints: ["responses"],
});
assert.equal(parsed.success, true);
assert.deepEqual(parsed.success && parsed.data.supportedEndpoints, ["responses"]);
});
Loading