normalizeLlmWireApi (llm/config-normalizers.ts)

oysterworkflow · src/llm/config-normalizers.ts · typescript · Apache-2.0
ai

Pure TypeScript normalization functions for LLM wire API, client profile, timeout mode, and reasoning effort.

// Source: https://github.com/ShuxinYang111/oysterworkflow | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
// Provided via justclaw.it.com; keep this notice with the code.
export type LlmWireApi = "responses" | "chat-completions";
export type LlmClientProfile = "default" | "openai-js" | "codex-desktop";
export type LlmResponseTimeoutMode = "fixed" | "idle";

/**
 * EN: Normalizes an OpenAI-compatible wire API value.
 * @param value raw wire API value.
 * @param fallback fallback used when the value is unknown.
 * @returns normalized wire API.
 */
export function normalizeLlmWireApi(
  value: LlmWireApi | string | null | undefined,
  fallback: LlmWireApi = "responses",
): LlmWireApi {
  return value === "chat-completions" ? "chat-completions" : 

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key