Generation

NAME

OpenRouter::API::Result::Generation - Post-hoc generation metadata

SYNOPSIS


# Look up a single call by its gen-id.
my $g = $or.get-generation('gen-abc123');
say "cost: \$", $g.total-cost;
say "latency: {$g.latency} ms";
say "finish: ", $g.finish-reason;
say "provider: ", $g.provider-name;

# Include the stored prompt + completion text (only when request
# logging was enabled on the account).
my $full = $or.get-generation-content($g.id);
say $full.prompt-text;
say $full.completion-text;

DESCRIPTION

Unified wrapper over GET /generation and GET /generation/content. The former returns cost / token / latency metadata; the latter additionally returns the stored prompt messages and completion text (when logging is enabled).

The Client merges both responses into a single Generation when get-generation-content is called — prompt-text / completion-text / reasoning-text stay Nil unless the content fetch happened.

OpenRouter::API v0.1.1

Raku client for OpenRouter's non-inference REST API

Authors

  • Matt Doughty

License

Artistic-2.0

Dependencies

Cro::HTTP:ver<0.8.11>:auth<zef:cro>JSON::Fast:ver<0.19>:auth<cpan:TIMOTIMO>

Test Dependencies

Provides

  • OpenRouter::API
  • OpenRouter::API::Client
  • OpenRouter::API::Filter
  • OpenRouter::API::Result::ActivityRow
  • OpenRouter::API::Result::Credits
  • OpenRouter::API::Result::Endpoint
  • OpenRouter::API::Result::Generation
  • OpenRouter::API::Result::Model
  • OpenRouter::API::Result::Provider

The Camelia image is copyright 2009 by Larry Wall. "Raku" is a trademark of the Yet Another Society. All rights reserved.

Built with Podlite — the markup and publishing tools behind this site.