Skip to main content
Methods: BatchApi#batchesPost, BatchApi#batchesBatchIdGet

Example

<?php

require 'vendor/autoload.php';

use AIStats\Sdk\Api\BatchApi;
use AIStats\Sdk\Configuration;
use AIStats\Sdk\Model\BatchRequest;

$apiKey = getenv('AI_STATS_API_KEY');
$config = Configuration::getDefaultConfiguration()
    ->setHost('https://api.ai-stats.phaseo.app/v1')
    ->setApiKey('GatewayAuth', 'Bearer ' . $apiKey);

$batchApi = new BatchApi(null, $config);

$request = new BatchRequest([
    'endpoint' => 'responses',
    'input_file_id' => 'file_123',
    'completion_window' => '24h'
]);

$batch = $batchApi->batchesPost($request);
$status = $batchApi->batchesBatchIdGet($batch->getId());

Key parameters

  • endpoint (required): Target endpoint for batch items (e.g., responses).
  • input_file_id (required): File id uploaded via /files.
  • completion_window: e.g., 24h.
  • metadata: Optional object stored with the batch.

Returns

BatchResponse