<?php
require 'vendor/autoload.php';
use AIStats\Sdk\Configuration;
use GuzzleHttp\Client;
$apiKey = getenv('AI_STATS_API_KEY');
$config = Configuration::getDefaultConfiguration()
->setHost('https://api.ai-stats.phaseo.app/v1')
->setApiKey('GatewayAuth', 'Bearer ' . $apiKey);
$client = new Client();
$response = $client->post($config->getHost() . '/embeddings', [
'headers' => [
'Authorization' => 'Bearer ' . $apiKey,
'Content-Type' => 'application/json',
],
'json' => [
'model' => 'openai/text-embedding-3-large',
'input' => 'Sample text'
]
]);
$data = json_decode($response->getBody(), true);
echo $data['data'][0]['embedding'][0];