> ## 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.

# Responses

> Call the Responses API with the PHP SDK.

**Methods**: `generateResponse()`, `createResponse()`

### Example

```php theme={null}
<?php

require 'vendor/autoload.php';

use AIStats\Sdk\AIStats;

$apiKey = getenv('AI_STATS_API_KEY');
$client = new AIStats(apiKey: $apiKey);

$response = $client->createResponse([
    'model' => 'openai/gpt-4.1',
    'input' => [
        [
            'role' => 'user',
            'content' => [
                [
                    'type' => 'output_text',
                    'text' => 'Summarise this text'
                ]
            ]
        ]
    ],
    'temperature' => 0.7,
    'stream' => false
]);
echo $response['output'][0]['content'][0]['text'];
```

### Key parameters

* `model` (required): Target model id.
* `input` (required): Ordered array of input items (messages, tool calls, etc.).
* `temperature` (0–2): Higher = more random.
* `top_p` (0–1): Nucleus sampling control.
* `max_output_tokens` (int): Hard cap on tokens generated per response.
* Tools: `tools` (definitions), `tool_choice` (auto/none/specific), `max_tool_calls` (int), `parallel_tool_calls` (bool).
* Logprobs: `top_logprobs` (0–20) to return per-token logprobs.
* Output: `service_tier`, `store` (bool), `stream` (bool).
* Metadata: `metadata` (object) for passthrough, `reasoning` (object) for effort hints.
* Gateway extras: `usage` (bool to request usage), `meta` (bool to include meta block).

### Returns

ResponsesResponse JSON object.
