| 1 | package Langertha::Engine::Hetzner; | ||||||||||||
| 2 | # ABSTRACT: Hetzner Inference API (OpenAI-compatible) | ||||||||||||
| 3 | 10 | our $VERSION = '0.505'; | |||||||||||
| 4 | 10 | ▶ | use Moose; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 5 | 10 | ▶ | use Carp qw( croak ); | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 6 | |||||||||||||
| 7 | 10 | extends 'Langertha::Engine::OpenAIBase'; | |||||||||||
| 8 | |||||||||||||
| 9 | 10 | with map { 'Langertha::Role::'.$_ } qw( | |||||||||||
| 10 | StaticModels | ||||||||||||
| 11 | Tools | ||||||||||||
| 12 | ); | ||||||||||||
| 13 | |||||||||||||
| 14 | |||||||||||||
| 15 | |||||||||||||
| 16 | 24 | ▶ | sub _build_supported_operations {[qw( | ||||||||||
|
Subroutine
_build_supported_operations: called CC=1 SCAR=0.0
| |||||||||||||
| 17 | createChatCompletion | ||||||||||||
| 18 | )]} | ||||||||||||
| 19 | |||||||||||||
| 20 | has '+url' => ( | ||||||||||||
| 21 | lazy => 1, | ||||||||||||
| 22 | 12 | ▶ | default => sub { 'https://inference.hetzner.com/api/v1' }, | ||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||
| 23 | 10 | ); | |||||||||||
| 24 | |||||||||||||
| 25 | 0 | ▶ | sub _build_api_key { | ||||||||||
|
Subroutine
_build_api_key: not called CC=2 SCAR=17.9
| |||||||||||||
| 26 | 0 | my ( $self ) = @_; | |||||||||||
| 27 | return $ENV{LANGERTHA_HETZNER_API_KEY} | ||||||||||||
| 28 | 0 | ▶ | || croak "".(ref $self)." requires LANGERTHA_HETZNER_API_KEY or api_key set"; | ||||||||||
|
Condition0%0/2
$ENV{'LANGERTHA_HETZNER_API_KEY'} || croak('' . ref($self) . ' requires LANGERTHA_HETZNER_API_KEY or api_key set')
MC/DC0%0/1
$ENV{'LANGERTHA_HETZNER_API_KEY'} || croak('' . ref($self) . ' requires LANGERTHA_HETZNER_API_KEY or api_key set')
$ENV{'LANGERTHA_HETZNER_API_KEY'}
Truth table0%0/2
A
A= $ENV{'LANGERTHA_HETZNER_API_KEY'}
| |||||||||||||
| 29 | } | ||||||||||||
| 30 | |||||||||||||
| 31 | 23 | ▶ | sub default_model { 'Qwen/Qwen3.6-35B-A3B-FP8' } | ||||||||||
|
Subroutine
default_model: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||
| 32 | |||||||||||||
| 33 | # image_input (k266, ADR 0019 k266 Update): both catalog models take image input | ||||||||||||
| 34 | # (see MODELS), so the engine keeps the flag Role::ImageInput (via OpenAIBase) | ||||||||||||
| 35 | # brings and needs no model rows. A text-only catalog addition gets a layer-3 | ||||||||||||
| 36 | # clear row here. | ||||||||||||
| 37 | |||||||||||||
| 38 | 86 | ▶ | sub default_response_size { 4096 } | ||||||||||
|
Subroutine
default_response_size: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||
| 39 | |||||||||||||
| 40 | # DOC-SOURCED, NOT LIVE-CONFIRMED (Hetzner blog "inference-experiment", reduced | ||||||||||||
| 41 | # scope, 2026-08-17 + docs catalog, checked 2026-09-17): the Inference | ||||||||||||
| 42 | # experiment was narrowed to the small Qwen models — DeepSeek-V4-Flash-0731, | ||||||||||||
| 43 | # GLM-5.2-NVFP4 and Kimi-K2.7-Code were retired. This list reflects the | ||||||||||||
| 44 | # published docs, not a live /v1/models read. The drift check in | ||||||||||||
| 45 | # t/88_live_hetzner.t (karr k40) should confirm against the live endpoint | ||||||||||||
| 46 | # before this catalog is considered frozen. | ||||||||||||
| 47 | 1 | ▶ | sub _build_static_models {[ | ||||||||||
|
Subroutine
_build_static_models: called CC=1 SCAR=0.0
| |||||||||||||
| 48 | 1 | { id => 'Qwen/Qwen3.6-35B-A3B-FP8' }, | |||||||||||
| 49 | { id => 'Qwen3.8-27B' }, | ||||||||||||
| 50 | ]} | ||||||||||||
| 51 | |||||||||||||
| 52 | # Hetzner Inference documents neither tool calling nor structured output on its | ||||||||||||
| 53 | # OpenAI-compatible endpoint, and the platform is explicitly experimental — | ||||||||||||
| 54 | # "you should not use the platform for production environments" | ||||||||||||
| 55 | # (docs.hetzner.com/general/company-and-policy/experiments/inference/, verified | ||||||||||||
| 56 | # 2026-09-01). Only /v1/models, /v1/completions and /v1/chat/completions exist. | ||||||||||||
| 57 | # The wire shape is OpenAI-compatible, so the role inventory grants the tool and | ||||||||||||
| 58 | # response_format flags — but nothing confirms the gateway honors them, so clear | ||||||||||||
| 59 | # them rather than advertise capabilities that may silently no-op. Re-add via | ||||||||||||
| 60 | # this around once a live test confirms them. | ||||||||||||
| 61 | 150 | ▶ | around engine_capabilities => sub { | ||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||
| 62 | 150 | my ( $orig, $self, @rest ) = @_; | |||||||||||
| 63 | 150 | my $caps = $self->$orig(@rest); | |||||||||||
| 64 | 150 | delete @{$caps}{ qw( | |||||||||||
| 65 | tools_native | ||||||||||||
| 66 | tool_choice_auto tool_choice_any tool_choice_none tool_choice_named | ||||||||||||
| 67 | response_format_json_object response_format_json_schema | ||||||||||||
| 68 | parallel_tool_use | ||||||||||||
| 69 | ) }; | ||||||||||||
| 70 | 150 | return $caps; | |||||||||||
| 71 | 10 | }; | |||||||||||
| 72 | |||||||||||||
| 73 | 10 | __PACKAGE__->meta->make_immutable; | |||||||||||
| 74 | |||||||||||||
| 75 | |||||||||||||
| 76 | |||||||||||||
| 77 | 10 | 1; | |||||||||||
| 78 | |||||||||||||
| 79 | __END__ | ||||||||||||