NAME

Langertha::Engine::OpenRouter - OpenRouter API

VERSION

version 0.302

SYNOPSIS

use Langertha::Engine::OpenRouter;

my $router = Langertha::Engine::OpenRouter->new(
    api_key => $ENV{OPENROUTER_API_KEY},
    model   => 'anthropic/claude-sonnet-4-6',
);

print $router->simple_chat('Hello from Perl!');

# Access many providers through one API
my $deepseek = Langertha::Engine::OpenRouter->new(
    api_key => $ENV{OPENROUTER_API_KEY},
    model   => 'deepseek/deepseek-r1',
);

DESCRIPTION

Provides access to OpenRouter, a unified API gateway for 300+ models from many providers (OpenAI, Anthropic, Google, Meta, Mistral, and more). Composes Langertha::Role::OpenAICompatible with OpenRouter's endpoint (https://openrouter.ai/api/v1).

Model names use provider/model format (e.g., anthropic/claude-sonnet-4-6, openai/gpt-4o, google/gemini-2.5-flash). No default model is set; model must be specified explicitly.

Supports chat, streaming, and MCP tool calling. Embeddings and transcription are not supported.

Get your API key at https://openrouter.ai/settings/keys and set LANGERTHA_OPENROUTER_API_KEY in your environment.

THIS API IS WORK IN PROGRESS

SEE ALSO

SUPPORT

Issues

Please report bugs and feature requests on GitHub at https://github.com/Getty/langertha/issues.

CONTRIBUTING

Contributions are welcome! Please fork the repository and submit a pull request.

AUTHOR

Torsten Raudssus <torsten@raudssus.de> https://raudss.us/

COPYRIGHT AND LICENSE

This software is copyright (c) 2026 by Torsten Raudssus.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.