Something went wrong. Try again.
opencode v2 mirror
Something went wrong. Try again.
12345678910111213141516171819202122232425262728293031323334353637383940414243444546import { Model } from "@opencode/schema/model"import { Location } from "@opencode/schema/location"import { Schema } from "effect"import { HttpApiEndpoint, HttpApiGroup, OpenApi } from "effect/unstable/httpapi"import { ServiceUnavailableError } from "../errors.js"import { LocationQuery, locationQueryOpenApi } from "./location.js"
export const ModelGroup = HttpApiGroup.make("server.model") .add( HttpApiEndpoint.get("model.list", "/api/model", { query: LocationQuery, success: Location.response(Schema.Array(Model.Info)), error: ServiceUnavailableError, }) .annotateMerge(locationQueryOpenApi) .annotateMerge( OpenApi.annotations({ identifier: "model.list", summary: "List models", description: "Retrieve the current snapshot of available models ordered by release date. The snapshot may precede initial plugin settlement.", }), ), ) .add( HttpApiEndpoint.get("model.default", "/api/model/default", { query: LocationQuery, success: Location.response(Schema.UndefinedOr(Model.Info)), error: ServiceUnavailableError, }) .annotateMerge(locationQueryOpenApi) .annotateMerge( OpenApi.annotations({ identifier: "model.default", summary: "Get default model", description: "Retrieve the model used when a session has no explicit model selection.", }), ), ) .annotateMerge( OpenApi.annotations({ title: "model", description: "Experimental model routes.", }), )