Endpoint Provider Resolver (custom/providers.ts)

librechat · packages/api/src/endpoints/custom/providers.ts · typescript · MIT
ai, integration, lang:typescript, tag:provider-detection

Maps known API base URLs to provider IDs and resolves endpoint provider identity for custom AI endpoints. Reuse when detecting which LLM provider a custom base URL belongs to.

// Source: https://github.com/danny-avila/librechat | License: MIT | Copyright 2026 LibreChat
// Provided via justclaw.it.com; keep this notice with the code.
import { ProviderId, resolveProviderId } from 'librechat-data-provider';

export const providerHosts: ReadonlyArray<readonly [string, ProviderId]> = [
  ['openrouter.ai', ProviderId.openrouter],
  ['api.openai.com', ProviderId.openai],
  ['api.anthropic.com', ProviderId.anthropic],
  ['api.deepseek.com', ProviderId.deepseek],
  ['api.groq.com', ProviderId.groq],
  ['api.mistral.ai', ProviderId.mistral],
  ['api.perplexity.ai', ProviderId.perplexity],
  ['api.together.xyz', ProviderId.together],
  ['api.x.ai', ProviderId.xai],
  ['api.moonshot.cn', ProviderId.moonshot],
  ['api.moonshot.ai', ProviderId.moonshot],
  ['api.cohere.com', 

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

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

Get a free API key