Langertha/Engine/MiniMax.pm

filter: Statementstmt 90.0% 18 / 20 Branchbran n/a Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 75.0% 6 / 8 Podpod 50.0% 1 / 2 totaltotal 74.2% 26 / 35 CC 2 SCAR 4.1
CC
2
Cov
83%
_build_api_key
2.3
_build_supported_operations
2.0
default_response_size
2.0
CRAP 1.5
« Langertha/Engine/Whisper.pm ↑ Summary Langertha/Plugin.pm »
1 package Langertha::Engine::MiniMax;
2 # ABSTRACT: MiniMax API (OpenAI-compatible)
3 3 our $VERSION = '0.502';
4 3 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 3 ▶use Carp qw( croak );
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 3 extends 'Langertha::Engine::OpenAIBase';
8  
9 3 with map { 'Langertha::Role::'.$_ } qw(
10 StaticModels
11 Tools
12 );
13  
14  
15 0 ▶sub _build_supported_operations {[qw(
Subroutine _build_supported_operations: not called CC=1 SCAR=6.9
16 createChatCompletion
17 )]}
18  
19 has '+url' => (
20 lazy => 1,
21 1 ▶ default => sub { 'https://api.minimax.io/v1' },
Subroutine __ANON__: called CC=1 SCAR=0.0
22 3 );
23  
24 sub _build_api_key {
25 1 ▶ my ( $self ) = @_;
Subroutine _build_api_key: called CC=2 SCAR=8.1
26 return $ENV{LANGERTHA_MINIMAX_API_KEY}
27 1 ▶ || croak "".(ref $self)." requires LANGERTHA_MINIMAX_API_KEY or api_key set";
Condition33%1/3
$ENV{'LANGERTHA_MINIMAX_API_KEY'} || croak('' . ref($self) . ' requires LANGERTHA_MINIMAX_API_KEY or api_key set')
l!l&&r!l&&!r
100
MC/DC0%0/2
$ENV{'LANGERTHA_MINIMAX_API_KEY'} || croak('' . ref($self) . ' requires LANGERTHA_MINIMAX_API_KEY or api_key set')
$ENV{'LANGERTHA_MINIMAX_API_KEY'} croak('' . ref($self) . ' requires LANGERTHA_MINIMAX_API_KEY or api_key set')
Truth table33%1/3
A || B
A= $ENV{'LANGERTHA_MINIMAX_API_KEY'}B= croak('' . ref($self) . ' requires LANGERTHA_MINIMAX_API_KEY or api_key set')
ABresult
1X1
011
000
28 }
29  
30 1 ▶sub default_model { 'MiniMax-M2.7' }
Subroutine default_model: called CC=1 SCAR=0.0
Pod documented
31  
32 0 ▶sub default_response_size { 4096 }
Subroutine default_response_size: not called CC=1 SCAR=6.9
Pod undocumented
33  
34 sub _build_static_models {[
35 1 ▶ { id => 'MiniMax-M2.7' },
Subroutine _build_static_models: called CC=1 SCAR=0.0
36 { id => 'MiniMax-M2.5' },
37 { id => 'MiniMax-M2.5-highspeed' },
38 { id => 'MiniMax-M2.1' },
39 { id => 'MiniMax-M2.1-highspeed' },
40 { id => 'MiniMax-M2' },
41 ]}
42  
43 3 __PACKAGE__->meta->make_immutable;
44  
45  
46 3 1;
47  
48 __END__
49  
50 =pod
51  
52 =encoding UTF-8
53  
54 =head1 NAME
55  
56 Langertha::Engine::MiniMax - MiniMax API (OpenAI-compatible)
57  
58 =head1 VERSION
59  
60 version 0.502
61  
62 =head1 SYNOPSIS
63  
64 use Langertha::Engine::MiniMax;
65  
66 my $minimax = Langertha::Engine::MiniMax->new(
67 api_key => $ENV{MINIMAX_API_KEY},
68 model => 'MiniMax-M2.7',
69 );
70  
71 print $minimax->simple_chat('Hello from Perl!');
72  
73 # Streaming
74 $minimax->simple_chat_stream(sub {
75 print shift->content;
76 }, 'Write a poem');
77  
78 # Tool calling
79 my $response = await $minimax->chat_with_tools_f('Search for Perl modules');
80  
81 =head1 DESCRIPTION
82  
83 Provides access to L<MiniMax|https://www.minimax.io/> models via their
84 native OpenAI-compatible endpoint at C<https://api.minimax.io/v1>.
85  
86 MiniMax is a Chinese AI company based in Shanghai offering large language
87 models with strong coding, reasoning, and agentic capabilities.
88  
89 B<Why the OpenAI endpoint, not the Anthropic one:> MiniMax also exposes an
90 C</anthropic> endpoint, but that endpoint is a shim — it does not always
91 re-parse stringified tool-call arguments, leading to intermittent tool-
92 calling failures where the Anthropic SDK sees a wrapper object whose key
93 rotates between C<result>, C<arguments>, and the tool name. The native
94 OpenAI-compatible endpoint avoids the shim entirely. If you need the
95 Anthropic wire format, use L<Langertha::Engine::MiniMaxAnthropic>.
96  
97 B<Available text models:>
98  
99 =over 4
100  
101 =item * C<MiniMax-M2.7> — Latest flagship (default).
102  
103 =item * C<MiniMax-M2.5> — 1M context window, SOTA coding (80.2%
104 SWE-Bench Verified), agentic tool use, and search.
105  
106 =item * C<MiniMax-M2.5-highspeed> — Same M2.5 performance with lower
107 latency. 205K context window.
108  
109 =item * C<MiniMax-M2.1> — 230B total parameters, 10B activated per
110 inference. Strong multilingual coding and reasoning.
111  
112 =item * C<MiniMax-M2.1-highspeed> — Same M2.1 performance with lower
113 latency.
114  
115 =item * C<MiniMax-M2> — 200K context, 128K max output. Function calling
116 and agentic capabilities.
117  
118 =back
119  
120 See L<https://platform.minimax.io/docs/guides/models-intro> for the full
121 model catalog including audio, video, and music models.
122  
123 Supports chat, streaming, tool calling, and structured output. Embeddings,
124 transcription, images, and documents are not supported via this endpoint.
125  
126 Get your API key at L<https://platform.minimax.io/> and set
127 C<LANGERTHA_MINIMAX_API_KEY> in your environment.
128  
129 =head1 SEE ALSO
130  
131 =over
132  
133 =item * L<Langertha::Engine::MiniMaxAnthropic> - MiniMax via legacy Anthropic-compatible endpoint
134  
135 =item * L<https://platform.minimax.io/docs/api-reference/text-openai-api> - MiniMax OpenAI-compatible API docs
136  
137 =item * L<Langertha::Engine::OpenAIBase> - Base class for OpenAI-compatible engines
138  
139 =item * L<Langertha::Role::Tools> - MCP tool calling interface
140  
141 =back
142  
143 =head1 SUPPORT
144  
145 =head2 Issues
146  
147 Please report bugs and feature requests on GitHub at
148 L<https://github.com/Getty/langertha/issues>.
149  
150 =head2 IRC
151  
152 Join C<#langertha> on C<irc.perl.org> or message Getty directly.
153  
154 =head1 CONTRIBUTING
155  
156 Contributions are welcome! Please fork the repository and submit a pull request.
157  
158 =head1 AUTHOR
159  
160 Torsten Raudssus <getty@cpan.org>
161  
162 =head1 COPYRIGHT AND LICENSE
163  
164 This software is copyright (c) 2026 by Torsten Raudssus L<https://raudssus.de/>.
165  
166 This is free software; you can redistribute it and/or modify it under
167 the same terms as the Perl 5 programming language system itself.
168  
169 =cut
« Langertha/Engine/Whisper.pm ↑ Summary Langertha/Plugin.pm »