NAME

Langertha::Engine::OpenAIResponses - OpenAI Responses API (reasoning models like gpt-5.5-pro)

VERSION

version 0.501

SYNOPSIS

use Langertha::Engine::OpenAIResponses;

my $engine = Langertha::Engine::OpenAIResponses->new(
    api_key => $ENV{OPENAI_API_KEY},
    model   => 'gpt-5.5-pro',   # reasoning-only model
);

my $response = $engine->simple_chat('Hello');
print $response;

DESCRIPTION

Provides access to OpenAI's Responses API endpoint (POST /v1/responses) for reasoning-only models like gpt-5.5-pro, o3-pro, and future -pro SKUs that are not available on the Chat Completions endpoint (/v1/chat/completions).

Unlike Langertha::Engine::OpenAI which calls /v1/chat/completions, this engine calls /v1/responses with the Responses API's own request/response shape. The Responses API uses:

  • input instead of messages

  • instructions for system prompt (top-level, not in input array)

  • Flat tool objects {type, name, description, parameters} instead of {type, function, function: {...}}

  • output[] array with type discriminators (message, reasoning, function_call) instead of choices[]

  • input_tokens/output_tokens instead of prompt_tokens/completion_tokens

  • output_tokens_details.reasoning_tokens instead of completion_tokens_details.reasoning_tokens

This engine returns a Langertha::Response that is shape-compatible with the chat path, so existing consumers (including Goldmine's complete method) work without modification. Reasoning tokens are normalized to completion_tokens_details.reasoning_tokens for cost lookup compatibility.

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.

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.