yera.models.interfaces.llms.openrouter
Yera LLM interface for models invoked through OpenRouter.
Symbols
OpenRouterLLM
BaseLLMInterfaceLLM interface for models invoked through OpenRouter.
Methods
OpenRouterLLM.__init__
__init__(
config: LLMConfig,
connection: OpenRouterConnection,
overrides: dict,
) → NoneInitialize an OpenRouter interface without starting its API client.
Parameters
Model identity, capabilities, and default inference settings.
OpenRouter connection used when the client is started.
Inference values to apply over the model defaults.
Raises
If the model does not declare OpenRouter capabilities.
OpenRouterLLM.start
start() → NoneInitialise the OpenRouter client.
OpenRouterLLM.stop
stop() → NoneClear the OpenRouter client.
OpenRouterLLM.chat
chat(
messages: list[Message],
reasoning_level: ReasoningLevel | None = None,
**overrides,
) → Iterator[LLMToken]Stream a chat response through OpenRouter.
Parameters
Conversation history to send through OpenRouter.
Optional reasoning effort overriding the configured default.
Per-call inference settings applied over the configured defaults.
OpenRouterLLM.make_struct
make_struct(
messages: list[Message],
reasoning_level: ReasoningLevel | None = None,
**overrides,
) → Iterator[LLMToken]Stream JSON conforming to a strict schema through OpenRouter.
Parameters
Conversation history to send through OpenRouter.
Struct class defining the required JSON response schema.
Optional reasoning effort overriding the configured default.
Per-call inference settings applied over the configured defaults.
Raises
If the model does not support structured outputs.
OpenRouterLLM.make_request_struct
make_request_struct(
messages: list[Message],
reasoning_level: ReasoningLevel | None = None,
**overrides,
) → Iterator[LLMToken]Stream a forced structured tool call through OpenRouter.
Parameters
Conversation history to send through OpenRouter.
Struct class defining the forced function call and its arguments.
Optional reasoning effort overriding the configured default.
Per-call inference settings applied over the configured defaults.
Raises
If the model does not support tool calling or forced tool choice.