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

# الحصول على عملية توليد

> يسترجع عملية إنشاء محددة باستخدام معرّفها.

استدعِ `GET /v1/generations?id=<request_id>` لجلب سجل التدقيق المخزّن لطلب في مساحة عملك. يحتاج إلى النطاق `generations:read`؛ وغياب `id` يُرجع `400` ‏`missing_id`.

تتلقى الطلبات الجديدة معرّف توليد `G-` يُنشئه الخادم، ويُعاد في ترويسة الاستجابة `x-request-id` وفي استجابة التوليد. استخدم هذا المعرّف لسجلات الطلبات والبحث عن عمليات التوليد والدعم. لا تحل قيمة `x-request-id` التي يقدّمها المتصل محل معرّف التوليد. ولا تزال معرّفات السجلات القديمة بتنسيق UUID تعمل في البحث.

## أعد تشغيل طلب

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

**1. اقرأ عملية التوليد**

استدعِ `GET /v1/generations?id=<request_id>`.

**2. تحقق من إمكانية إعادة تشغيله**

تابع فقط إذا كانت قيمة `replay_supported` هي `true`.

**3. أرسله مجددًا**

أرسل `replay_request` إلى نقطة النهاية المذكورة في `endpoint`، مثل `/v1/chat/completions` أو `/v1/responses`.

يمكن لمساحة العمل أن تقصر المحتويات المخزّنة على المالكين والمسؤولين. عندها يحصل المتصلون الآخرون، بمن فيهم مفاتيح API التي أنشأها الأعضاء، على `replay_request: null` وعلى تفاصيل الطلب بدون محتوياته.


## OpenAPI

````yaml ar/openapi/v1/openapi.localized.yaml GET /generations
openapi: 3.0.3
info:
  title: Phaseo Gateway API
  description: >-
    واجهة API للبوابة تتيح الوصول إلى نماذج ذكاء اصطناعي متنوعة عبر نقاط نهاية
    متوافقة مع OpenAI.
  version: 1.0.0
  contact:
    name: Phaseo
    url: https://phaseo.app
    email: danielbutler500@gmail.com
servers:
  - url: https://api.phaseo.app/v1
    description: التوجيه العالمي
security:
  - BearerAuth: []
tags:
  - name: Gateway
    description: Core Phaseo Gateway operations.
paths:
  /generations:
    get:
      tags:
        - Gateway
      summary: استرجاع عملية إنشاء
      description: يسترجع عملية إنشاء محددة باستخدام معرّفها.
      operationId: getGeneration
      parameters:
        - name: id
          in: query
          required: true
          description: معرّف عملية الإنشاء
          schema:
            type: string
      responses:
        '200':
          description: بيانات عملية الإنشاء
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GenerationResponse'
        '401':
          description: غير مصرّح به
          content:
            application/json:
              schema:
                type: object
                properties:
                  ok:
                    type: boolean
                  error:
                    type: string
                  reason:
                    type: string
        '404':
          description: غير موجود
          content:
            application/json:
              schema:
                type: object
                properties:
                  ok:
                    type: boolean
                  error:
                    type: string
components:
  schemas:
    GenerationResponse:
      type: object
      properties:
        created_at:
          type: string
          format: date-time
        request_id:
          type: string
          description: >-
            معرّف إنشاء عام. تستخدم عمليات الإنشاء الجديدة التنسيق G-<ULID>؛ وقد
            تحتوي السجلات التاريخية على معرّفات سابقة، بما فيها UUID.
        team_id:
          type: string
        app_id:
          type: string
          nullable: true
        endpoint:
          type: string
        model_id:
          type: string
        provider:
          type: string
        native_response_id:
          type: string
          nullable: true
        stream:
          type: boolean
        byok:
          type: boolean
        status_code:
          type: number
        success:
          type: boolean
        error_code:
          type: string
          nullable: true
        error_message:
          type: string
          nullable: true
        latency_ms:
          type: number
        generation_ms:
          type: number
        usage:
          type: object
          nullable: true
          properties:
            prompt_tokens:
              type: number
            completion_tokens:
              type: number
            total_tokens:
              type: number
        cost_nanos:
          type: number
        currency:
          type: string
        pricing_lines:
          type: array
          items:
            type: object
        key_id:
          type: string
        throughput:
          type: number
          nullable: true
        replay_supported:
          type: boolean
          description: >-
            يوضح ما إذا كانت حمولة طلب قابلة لإعادة التشغيل متاحة لعملية الإنشاء
            هذه.
        replay_request:
          type: object
          nullable: true
          additionalProperties: true
          description: >-
            حمولة الطلب القابلة لإعادة التشغيل التي تم التقاطها لعملية الإنشاء
            هذه عند توفرها.
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: المصادقة باستخدام رمز Bearer

````

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