Skip to content

Call Vexly from Perl

use strict;
use warnings;
use LWP::UserAgent;
use JSON;

my $base = $ENV{VEXLY_BASE_URL} || 'https://api.vexly.io/api/v1/public';
my $token = $ENV{VEXLY_ACCESS_TOKEN};
my $ua = LWP::UserAgent->new;

my $resp = $ua->post(
  "$base/agent/runs",
  'Authorization' => "Bearer $token",
  'Content-Type'  => 'application/json',
  Content         => encode_json({ prompt => 'Reply with exactly: hello from perl' }),
);

print $resp->decoded_content;