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

> ## Agent Instructions
> Phaseo Gateway base URL: https://api.phaseo.app/v1. Send `Authorization: Bearer $PHASEO_API_KEY` with every request.
> Model IDs look like `provider/model`, for example `openai/gpt-6-astra`. Do not guess IDs: list them with `GET /v1/models` or check https://phaseo.app/models. `phaseo/free` routes to an available free model and needs no wallet balance.
> For new text integrations prefer `POST /v1/responses`. `POST /v1/chat/completions` (OpenAI format) and `POST /v1/messages` (Anthropic format) suit existing code.
> The full API contract is https://phaseo.app/docs/openapi/v1/openapi.yaml. Official SDKs: `@phaseo/sdk` (TypeScript) and `phaseo` (Python), plus Go, C#, PHP, Ruby and Rust.
> Search these docs over MCP at https://phaseo.app/docs/mcp, and install Phaseo skills with `npx skills add https://phaseo.app/docs`. If a page is wrong or out of date, report it with the MCP `submit_feedback` tool.
> Manage Phaseo accounts with the `phaseo` CLI (`npm install -g @phaseo/cli`, then `phaseo login` or `phaseo login --device-code`), the `/v1` Management API or the MCP server at `https://mcp.phaseo.app/mcp?access=manage`. Do not send users to the dashboard for account tasks. A person is still needed for sign-up, approving a sign-in, paying the first top-up on the checkout link that `phaseo credits add` returns when no card is saved, confirming each saved-card top-up from the emailed link, and account security (password, MFA, passkeys). Create API keys with `phaseo keys create --name <name> --json`; never guess one. Credit top-ups need `phaseo login --scopes billing:write` first. Task map: https://phaseo.app/docs/v1/developers/manage-from-an-agent.md.

# البحث عن عملية توليد

> استرجع عملية توليد سابقة باستخدام /generations من أي حزمة Phaseo SDK.

مرّر معرّف طلب (مثل `G-01ABC...`) إلى دالة التوليد في حزمة SDK لجلب السجل المخزّن لذلك الطلب من `GET /v1/generations?id=<id>`.

```typescript TypeScript theme={null}
const record = await client.getGeneration("G-01ABC...");
```

```python Python theme={null}
record = client.get_generation("G-01ABC...")

print(record["model_id"], record["cost_nanos"])
```

```go Go theme={null}
client, err := phaseo.NewFromEnv()
if err != nil {
  panic(err)
}

record, err := client.GetGeneration(context.Background(), "G-01ABC...")
if err != nil {
  panic(err)
}
fmt.Println(record["status_code"], record["cost_nanos"])
```

```csharp C# theme={null}
using PhaseoSdk;

var client = new Phaseo();
var record = await client.GetGeneration("G-01ABC...");
```

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

use Phaseo\Sdk\Phaseo;

$client = new Phaseo();
$record = $client->getGeneration('G-01ABC...');
```

```ruby Ruby theme={null}
require 'phaseo_sdk'

client = PhaseoSdk::Phaseo.new
record = client.get_generation('G-01ABC...')
```

```java Java theme={null}
import app.phaseo.sdk.Phaseo;

Phaseo client = new Phaseo(System.getenv("PHASEO_API_KEY"));

var record = client.getGeneration("G-01ABC...");
System.out.println(record);
```

| اللغة | الدالة | القيمة المُعادة |
| - | - | - |
| TypeScript | `client.getGeneration(id)` | كائن السجل |
| Python | `client.get_generation(id)` | قاموس `APIResponse` |
| Go | `client.GetGeneration(ctx, id)` | `map[string]interface{}` |
| C# | `client.GetGeneration(id)` | `Dictionary<string, object>?` |
| PHP | `$client->getGeneration($id)` | مصفوفة |
| Ruby | `client.get_generation(id)` | Hash |
| Java | `client.getGeneration(id)` | `JsonNode` من Jackson |
| Rust | لا توجد دالة مساعدة؛ استدعِ `client.request("GET", "/generations?id=<id>", None, &RequestOptions::default())` | `PhaseoResponse`، والسجل في `body` (من النوع `serde_json::Value`) |

يقتصر البحث على مساحة العمل الخاصة بك. يؤدي غياب `id` إلى `400` (`missing_id`)، ويؤدي معرّف غير موجود في مساحة العمل إلى `404` (`not_found`).

## إعادة تشغيل طلب مخزّن

إذا خزّنت البوابة الطلب كاملًا، فسيحتوي السجل على `replay_supported` بقيمة true وعلى `replay_request`، ويمكنك إرساله مجددًا إلى نقطة النهاية الأصلية لإعادة تشغيل مضبوطة.

## قراءة حقول التوقيت

* `latency_ms`: الوقت حتى أول token، أو أول بايت أو إطار من المخرجات، عند تتبّعه.
* `generation_ms`: وقت التوليد بعد تلك النقطة، عند تتبّعه.

## الاستجابة

```json theme={null}
{
  "created_at": "2026-05-05T12:00:00.000Z",
  "request_id": "G-01ABC123",
  "team_id": "team-123",
  "app_id": "app-123",
  "endpoint": "chat/completions",
  "model_id": "openai/gpt-6-astra",
  "provider": "openai",
  "native_response_id": "chatcmpl-123",
  "stream": false,
  "byok": false,
  "status_code": 200,
  "success": true,
  "error_code": null,
  "error_message": null,
  "latency_ms": 1500,
  "generation_ms": 1400,
  "usage": {
    "prompt_tokens": 9,
    "completion_tokens": 9,
    "total_tokens": 18
  },
  "cost_nanos": 1000000,
  "currency": "USD",
  "pricing_lines": [],
  "key_id": "key-123",
  "throughput": null,
  "replay_supported": true,
  "replay_request": {
    "model": "openai/gpt-6-astra",
    "messages": [
      { "role": "user", "content": "Say hello" }
    ]
  }
}
```

يسرد [البحث عن عملية توليد](https://phaseo.app/docs/ar/v1/api-reference/endpoint/generation.md) كل الحقول.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.