Skip to content

Expose provider base URLs programmatically for all providers #23

@cidrblock

Description

@cidrblock

Currently, the base URLs for each provider (e.g., OpenAI, xAI, Meta, Groq, etc.) are either hardcoded in constructors or available as internal constants, but there is no standard, programmatic way to retrieve all supported provider base URLs from the public API. This makes it hard to build tools or integrations that need to display, validate, or customize base URLs per provider.

Request:

  • Provide a documented, public way to retrieve the default base URL for each provider, ideally via a utility or exported map/object in the main entrypoint.
  • Optionally, expose a method or static property on each provider class or through the provider registry that returns the default base URL.
  • Ensure this works for all built-in providers (OpenAI, Anthropic, TogetherAI, Groq, Mistral, Meta, xAI, etc.).

Rationale:

  • Consistent API ergonomics when configuring or displaying current endpoints
  • Easier programmatic inspection, validation, and dynamic provider selection
  • Less need to deep import or duplicate the constants externally

Example API:

import { PROVIDER_BASE_URLS, getProviderBaseURL } from 'multi-llm-ts/providers';

console.log(PROVIDER_BASE_URLS["openai"]); // "https://api.openai.com/v1"
console.log(getProviderBaseURL("groq"));   // "https://api.groq.com"

If there is technical or compatibility complexity, documenting a recommended way to obtain these URLs from the package would also help.

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions