transformToOpenAIConfig (openai/transform.ts)

librechat · packages/api/src/endpoints/openai/transform.ts · typescript · MIT
ai

Converts non-OpenAI LLM configs into OpenAI-compatible options.

// Source: https://github.com/danny-avila/librechat | License: MIT | Copyright 2026 LibreChat
// Provided via justclaw.it.com; keep this notice with the code.
import { EModelEndpoint } from 'librechat-data-provider';
import type { GoogleAIToolType } from '@librechat/agents/langchain/google-common';
import type { ClientOptions } from '@librechat/agents';
import type * as t from '~/types';
import { knownOpenAIParams } from './llm';

const anthropicExcludeParams = new Set(['anthropicApiUrl', 'outputConfig']);
const googleExcludeParams = new Set([
  'safetySettings',
  'location',
  'baseUrl',
  'customHeaders',
  'thinkingConfig',
  'thinkingBudget',
  'includeThoughts',
]);

/** Google-specific tool types that have no OpenAI-compatible equivalent */
const googleToolsToFilter = new Set(['goog

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

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

Get a free API key