Skip to content

Function: parseModelClass()

parseModelClass(value): ModelClass | null

Coerce an arbitrary value (query string, header, body field) to a ModelClass, returning null when it isn’t a known class. Lets a route accept a class request without throwing on junk input.

Matches the full slug first ("chat-fast", "embedding"), then - for a bare chat band - retries with a chat- prefix, so the shorthand "thinking" / "balanced" / "fast" resolves to the corresponding chat-* class.

unknown

ModelClass | null