Schema and branded types for provider and model identifiers with static helpers.
// Source: https://github.com/XiaomiMiMo/MiMo-Code | License: MIT | Copyright 2026 MiMo Code, Xiaomi Corporation
// Provided via justclaw.it.com; keep this notice with the code.
import { Schema } from "effect"
import z from "zod"
import { withStatics } from "@/util/schema"
const providerIdSchema = Schema.String.pipe(Schema.brand("ProviderID"))
export type ProviderID = typeof providerIdSchema.Type
export const ProviderID = providerIdSchema.pipe(
withStatics((schema: typeof providerIdSchema) => ({
zod: z.string().pipe(z.custom<ProviderID>()),
// Well-known providers
opencode: schema.make("opencode"),
anthropic: schema.make("anthropic"),
openai: schema.make("openai"),
google: schema.make("google"),
googleVertex: schema.make("google-vertex"),
githubCopilot
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key