> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ai-stats.phaseo.app/llms.txt
> Use this file to discover all available pages before exploring further.

# PHP SDK Usage

> Current wrapper methods supported by the preview PHP SDK.

## Setup

```php theme={null}
<?php
require 'vendor/autoload.php';

use AIStats\Sdk\AIStats;

$client = new AIStats(getenv('AI_STATS_API_KEY'));
```

## Chat completions

```php theme={null}
$chat = $client->generateText([
  'model' => 'openai/gpt-5-nano',
  'messages' => [
    ['role' => 'user', 'content' => 'Hello']
  ],
]);
```

## Responses

```php theme={null}
$response = $client->generateResponse([
  'model' => 'openai/gpt-5-nano',
  'input' => 'Reply with: php sdk works',
]);
```

## Images

```php theme={null}
$image = $client->generateImage([
  'model' => 'openai/gpt-image-1',
  'prompt' => 'A lighthouse at golden hour',
]);

$edit = $client->generateImageEdit([
  'model' => 'openai/gpt-image-1',
  'prompt' => 'Make it sunset',
  'image' => 'data:image/png;base64,...',
]);
```

## Audio

```php theme={null}
$transcript = $client->generateTranscription([
  'model' => 'openai/gpt-4o-transcribe',
  'audio_b64' => 'base64-audio',
]);

$translation = $client->generateTranslation([
  'model' => 'openai/gpt-4o-transcribe',
  'audio_b64' => 'base64-audio',
]);
```

## Embeddings and moderations

```php theme={null}
$embedding = $client->generateEmbedding([
  'model' => 'openai/text-embedding-3-large',
  'input' => 'Sample text',
]);

$moderation = $client->generateModeration([
  'model' => 'openai/omni-moderation-latest',
  'input' => 'Some text to check',
]);
```

## Models and health

```php theme={null}
$models = $client->listModels(['limit' => 10]);
$health = $client->health();
```
