NAME
Langertha::Engine::Replicate - Replicate API
VERSION
version 0.503
SYNOPSIS
use Langertha::Engine::Replicate;
my $replicate = Langertha::Engine::Replicate->new(
api_key => $ENV{REPLICATE_API_TOKEN},
model => 'meta/llama-4-maverick',
);
print $replicate->simple_chat('Hello from Perl!');
# Streaming
$replicate->simple_chat_stream(sub {
print shift->content;
}, 'Write a Perl haiku');
DESCRIPTION
Replicate hosts thousands of open-source models with pay-per-use pricing. This engine speaks the OpenAI /chat/completions wire format and, by default, POSTs to https://api.replicate.com/v1/chat/completions.
Unverified against the hosted API. Replicate's official OpenAPI document (https://api.replicate.com/openapi.json, checked 2026-09-25) lists no /chat/completions path, only /predictions, /models/{owner}/{name}/predictions, /deployments/... and similar, and its documentation index (https://replicate.com/docs/llms.txt) has no OpenAI-compatibility page. The OpenAI-compatible examples on Replicate model pages are for a Cog container run locally. The project has no Replicate key, so whether the hosted endpoint answers has never been tested. To talk to a locally run Cog container or an OpenAI-compatible proxy in front of Replicate, set url to that server's base URL (for example http://localhost:5000/v1).
Model names use owner/model format (e.g., meta/llama-4-maverick, meta/llama-4-scout). No default model is set; model must be specified explicitly.
Chat, streaming, and MCP tool calling use the OpenAI wire format as above. Embeddings and transcription are not supported through this interface.
Get your API token at https://replicate.com/account/api-tokens and set LANGERTHA_REPLICATE_API_KEY in your environment.
THIS API IS WORK IN PROGRESS
SEE ALSO
https://www.replicatestatus.com/ - Replicate service status
https://replicate.com/explore - Browse available models
Langertha::Role::OpenAICompatible - OpenAI API format role
SUPPORT
Issues
Please report bugs and feature requests on GitHub at https://github.com/Getty/langertha/issues.
IRC
Join #langertha on irc.perl.org or message Getty directly.
CONTRIBUTING
Contributions are welcome! Please fork the repository and submit a pull request.
AUTHOR
Torsten Raudssus <getty@cpan.org>
COPYRIGHT AND LICENSE
This software is copyright (c) 2026 by Torsten Raudssus https://raudssus.de/.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.