LLM

class pipecat.services.openrouter.llm.OpenRouterLLMService(*, api_key=None, model='openai/gpt-4o-2024-11-20', base_url='https://openrouter.ai/api/v1', **kwargs)[source]

Bases: OpenAILLMService

A service for interacting with OpenRouter’s API using the OpenAI-compatible interface.

This service extends OpenAILLMService to connect to OpenRouter’s API endpoint while maintaining full compatibility with OpenAI’s interface and functionality.

Parameters:
  • api_key (str) – The API key for accessing OpenRouter’s API

  • base_url (str, optional) – The base URL for OpenRouter API. Defaults to “https://openrouter.ai/api/v1

  • model (str, optional) – The model identifier to use. Defaults to “openai/gpt-4o-2024-11-20”

  • **kwargs – Additional keyword arguments passed to OpenAILLMService

create_client(api_key=None, base_url=None, **kwargs)[source]

Create an AsyncOpenAI client instance.

Parameters:
  • api_key – OpenAI API key.

  • base_url – Custom base URL for the API.

  • organization – OpenAI organization ID.

  • project – OpenAI project ID.

  • default_headers – Additional HTTP headers.

  • **kwargs – Additional client configuration arguments.

Returns:

Configured AsyncOpenAI client instance.