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

# إنشاء سياسة حمل عمل موثوق

> ينشئ سياسة ثقة تتيح لعملية نشر على Vercel أو سير عمل في GitHub Actions استدعاء Phaseo برمز OIDC الخاص بها بدلًا من مفتاح API.

نقطة النهاية هذه في [المرحلة التجريبية](https://phaseo.app/docs/ar/v1/developers/feature-maturity.md)، وتُفعَّل لكل مساحة عمل عند الطلب.

> [!NOTE]
>
> تتطلب نقطة النهاية هذه `keys:write` على مفتاح إدارة أو رمز OAuth، أو مالك مساحة العمل أو أحد مسؤوليها. ميزة أحمال العمل الموثوقة في المرحلة التجريبية، وتتلقى مساحات العمل التي لا تملكها `404`.

راجع [أحمال العمل الموثوقة](https://phaseo.app/docs/ar/v1/developers/trusted-workloads.md) لمعرفة كيف تعمل السياسات وكيف تديرها باستخدام Terraform.


## OpenAPI

````yaml ar/openapi/v1/openapi.localized.yaml POST /workload-identity/policies
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:
  /workload-identity/policies:
    post:
      tags:
        - Gateway
      summary: إنشاء سياسة حمل عمل موثوق
      description: >-
        ينشئ سياسة ومفتاحها الخالي من الأسرار. يجب إصدار الرموز للجمهور
        https://api.phaseo.app وأن تطابق المالك المثبَّت وكل شروط المطالبات.
        يمكن أن تضم مساحة العمل ما يصل إلى 50 سياسة؛ وما يزيد على ذلك يُرجع 409
        limit_reached. يتطلب keys:write على مفاتيح الإدارة ورموز OAuth، أو مالك
        مساحة العمل أو أحد مسؤوليها. متاح فقط لمساحات العمل المشاركة في المرحلة
        التجريبية لأحمال العمل الموثوقة؛ وتتلقى مساحات العمل الأخرى 404.
      operationId: createWorkloadIdentityPolicy
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/WorkloadIdentityPolicyInput'
      responses:
        '201':
          description: تم إنشاء سياسة حمل العمل الموثوق
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WorkloadIdentityPolicyResponse'
        default:
          description: فشل الطلب
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    WorkloadIdentityPolicyInput:
      type: object
      required:
        - name
        - provider
        - owner_id
      properties:
        name:
          type: string
          minLength: 1
          maxLength: 100
        provider:
          $ref: '#/components/schemas/WorkloadIdentityProvider'
        issuer:
          type: string
          description: >-
            المُصدِر الذي تأتي منه الرموز. اختياري لـ github_actions (القيمة
            الافتراضية https://token.actions.githubusercontent.com؛ أضف
            /<enterprise-slug> لمُصدِر مؤسسي مخصّص)، وgitlab
            (https://gitlab.com)، وgoogle_cloud (https://accounts.google.com)،
            وbuildkite (https://agent.buildkite.com). مطلوب لـ vercel
            (https://oidc.vercel.com/<team-slug>، أو https://oidc.vercel.com
            للمُصدِر العام)، وcircleci
            (https://oidc.circleci.com/org/<organization-id>)، وaws (مُصدِر
            https://<id>.tokens.sts.global.api.aws الخاص بحسابك)، وcustom (عنوان
            URL عام بـ https يقدّم مستند اكتشاف OIDC، على مضيف لا يتبع أيًا من
            المنصات الأخرى).
        owner_claim:
          type: string
          minLength: 1
          maxLength: 128
          description: >-
            مطالبة الرمز التي تُطابَق مع owner_id، مثل sub. مطلوبة لـ custom.
            تستخدم المنصات الأخرى مطالبة ثابتة (راجع owner_claim في السياسة)،
            لذا احذفها أو أرسل تلك المطالبة. لا يمكن تغييرها لاحقًا.
        owner_id:
          type: string
          minLength: 1
          description: >-
            القيمة التي يجب أن تساويها مطالبة المالك: معرّف فريق Vercel، أو
            معرّف المؤسسة أو المستخدم على GitHub، أو معرّف مشروع GitLab، أو
            المعرّف الفريد لحساب خدمة Google (وليس بريده الإلكتروني)، أو معرّف
            مؤسسة Buildkite، أو معرّف مؤسسة CircleCI (الموجود في المُصدِر)، أو
            ARN لدور AWS IAM، أو بالنسبة إلى مُصدِرات custom قيمة owner_claim
            الموثوق بها.
        claim_conditions:
          type: object
          description: >-
            مطالبات إضافية يجب أن يطابقها الرمز، على شكل اسم المطالبة والقيم
            المسموح بها، مثل repository_id وref لـ GitHub Actions، أو
            project_path وref لـ GitLab. يجب أن تطابق كل مطالبة إحدى قيمها. بحد
            أقصى 15 مطالبة و20 قيمة لكل مطالبة. تتكون أسماء المطالبات من أحرف
            وأرقام و. _ : / - وبطول يصل إلى 128 حرفًا؛ لا يمكن استخدام iss وaud
            وexp وiat وnbf وjti، وتُضبط مطالبة المالك عبر owner_id.
          maxProperties: 15
          additionalProperties:
            type: array
            minItems: 1
            maxItems: 20
            items:
              type: string
              minLength: 1
              maxLength: 256
        max_token_lifetime_seconds:
          type: integer
          minimum: 60
          maximum: 43200
          default: 43200
          description: أطول مدة صلاحية للرمز (exp ناقص iat أو nbf) تقبلها السياسة.
      additionalProperties: false
    WorkloadIdentityPolicyResponse:
      type: object
      required:
        - data
      properties:
        data:
          $ref: '#/components/schemas/WorkloadIdentityPolicy'
      additionalProperties: false
    ErrorResponse:
      type: object
      required:
        - error
      properties:
        ok:
          type: boolean
          example: false
        error:
          description: >-
            كائن الخطأ (`code` و`message` و`type` و`param` و`metadata`
            الاختياري) الذي تقرؤه حزم SDK المتوافقة مع OpenAI. كانت الاستجابات
            السابقة تُرجع سلسلة الرمز هنا؛ وهي تُرجع الآن أيضًا في `code` على
            المستوى الأعلى.
          oneOf:
            - type: string
            - $ref: '#/components/schemas/ErrorObject'
          example:
            code: validation_error
            message: 'Unknown parameter: foo'
            type: invalid_request_error
            param: foo
        code:
          type: string
          description: رمز الخطأ، بالقيمة نفسها الموجودة في `error.code`.
          example: validation_error
        message:
          type: string
          example: Human-readable error message
        description:
          type: string
          example: Additional error details.
        generation_id:
          type: string
          example: G-abc123
        status_code:
          type: integer
          example: 502
        error_type:
          type: string
          enum:
            - user
            - system
          example: system
        error_origin:
          type: string
          enum:
            - user
            - gateway
            - upstream
          example: upstream
        reason:
          type: string
          example: all_candidates_failed
        attempt_count:
          type: integer
          example: 2
        failed_providers:
          type: array
          items:
            type: string
          example:
            - google-ai-studio
            - openai
        failed_statuses:
          type: array
          items:
            type: integer
          example:
            - 403
            - 429
        upstream_error:
          $ref: '#/components/schemas/ErrorUpstreamError'
        failure_sample:
          type: array
          items:
            $ref: '#/components/schemas/ErrorFailureSampleItem'
        provider_failure_diagnostics:
          $ref: '#/components/schemas/ErrorProviderFailureDiagnostics'
        routing_diagnostics:
          $ref: '#/components/schemas/ErrorRoutingDiagnostics'
        provider_candidate_diagnostics:
          $ref: '#/components/schemas/ErrorProviderCandidateDiagnostics'
        provider_enablement:
          $ref: '#/components/schemas/ErrorProviderEnablementDiagnostics'
        missing_pricing_providers:
          type: array
          items:
            type: string
        provider_payment_required_provider:
          type: string
          example: openai
        provider_payment_required_support_notice:
          type: string
          example: >-
            Our upstream provider billing appears to be unavailable. If this
            persists, contact support.
        details:
          type: array
          items:
            type: object
            additionalProperties: true
      additionalProperties: true
    WorkloadIdentityProvider:
      type: string
      enum:
        - vercel
        - github_actions
        - gitlab
        - google_cloud
        - buildkite
        - circleci
        - aws
        - custom
      description: >-
        المنصة التي تُصدر رموز OIDC. استخدم custom لأي مُصدِر OIDC آخر، مثل
        عنقود Kubernetes أو نسخة GitLab مُدارة ذاتيًا.
    WorkloadIdentityPolicy:
      type: object
      description: >-
        حمل عمل موثوق: الرموز الصادرة عن هذا المُصدِر، للمالك المثبَّت والمطابقة
        لكل شروط المطالبات، تُصادَق بصفتها مفتاح السياسة.
      required:
        - id
        - name
        - provider
        - issuer
        - owner_claim
        - owner_id
        - claim_conditions
        - max_token_lifetime_seconds
        - status
        - audience
        - key_id
        - last_used_at
        - created_by
        - created_at
        - updated_at
      properties:
        id:
          type: string
          format: uuid
        name:
          type: string
          minLength: 1
          maxLength: 100
        provider:
          $ref: '#/components/schemas/WorkloadIdentityProvider'
        issuer:
          type: string
          description: >-
            مُصدِر الرمز (مطالبة iss)، مثل https://oidc.vercel.com/acme أو
            https://token.actions.githubusercontent.com أو
            https://accounts.google.com.
        owner_claim:
          type: string
          description: >-
            مطالبة الرمز التي تُطابَق مع owner_id. وهي ثابتة لكل منصة: owner_id
            لـ vercel، وrepository_owner_id لـ github_actions، وproject_id لـ
            gitlab، وsub لـ google_cloud وaws، وorganization_id لـ buildkite،
            وoidc.circleci.com/org-id لـ circleci. تستخدم المُصدِرات custom
            المطالبة المختارة عند إنشاء السياسة.
        owner_id:
          type: string
          description: >-
            المالك المثبَّت: القيمة التي يجب أن تساويها مطالبة owner_claim في
            الرمز، مثل معرّف فريق Vercel، أو معرّف المؤسسة أو المستخدم على
            GitHub، أو معرّف مشروع GitLab، أو المعرّف الفريد لحساب خدمة Google،
            أو معرّف مؤسسة Buildkite، أو معرّف مؤسسة CircleCI، أو ARN لدور AWS
            IAM.
        claim_conditions:
          type: object
          description: >-
            مطالبات إضافية يجب أن يطابقها الرمز، على شكل اسم المطالبة والقيم
            المسموح بها، مثل repository_id وref لـ GitHub Actions، أو
            project_path وref لـ GitLab. يجب أن تطابق كل مطالبة إحدى قيمها. بحد
            أقصى 15 مطالبة و20 قيمة لكل مطالبة. تتكون أسماء المطالبات من أحرف
            وأرقام و. _ : / - وبطول يصل إلى 128 حرفًا؛ لا يمكن استخدام iss وaud
            وexp وiat وnbf وjti، وتُضبط مطالبة المالك عبر owner_id.
          maxProperties: 15
          additionalProperties:
            type: array
            minItems: 1
            maxItems: 20
            items:
              type: string
              minLength: 1
              maxLength: 256
        max_token_lifetime_seconds:
          type: integer
          minimum: 60
          maximum: 43200
          description: أطول مدة صلاحية للرمز (exp ناقص iat أو nbf) تقبلها السياسة.
        status:
          type: string
          enum:
            - active
            - disabled
        audience:
          type: string
          description: الجمهور الذي يجب إصدار الرموز له.
        key_id:
          type: string
          format: uuid
          description: مفتاح السياسة. تُسجَّل الطلبات والاستخدام والحدود عليه.
        last_used_at:
          type: string
          format: date-time
          nullable: true
        created_by:
          type: string
          format: uuid
          nullable: true
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
      additionalProperties: false
    ErrorObject:
      type: object
      description: >-
        خطأ من البوابة بالشكل الذي تقرؤه حزم SDK من OpenAI. يُحدَّد `type` من
        حالة HTTP: invalid_request_error لمعظم رموز 4xx، وauthentication_error
        (401)، وinsufficient_quota (402)، وpermission_error (403)،
        وnot_found_error (404)، وrate_limit_error (429)، وservice_unavailable
        (503)، وoverloaded (529)، وserver_error لبقية رموز 5xx.
      required:
        - code
        - message
        - type
      properties:
        code:
          type: string
          description: رمز خطأ قابل للقراءة آليًا.
          example: validation_error
        message:
          type: string
          description: شرح مقروء لسبب الإخفاق.
          example: 'Unknown parameter: foo'
        type:
          type: string
          description: نوع الخطأ، وفق أنواع الأخطاء الموثّقة لدى OpenAI.
          enum:
            - invalid_request_error
            - authentication_error
            - permission_error
            - not_found_error
            - rate_limit_error
            - insufficient_quota
            - server_error
            - service_unavailable
            - overloaded
          example: invalid_request_error
        param:
          type: string
          nullable: true
          description: معامل الطلب الذي تسبّب في الخطأ، عند معرفته.
          example: foo
        metadata:
          type: object
          description: >-
            تفاصيل منظّمة تُرجع أيضًا على المستوى الأعلى، مثل المزوّد الذي أخفق
            و`reason` و`failed_statuses` و`retry_after_seconds`
            و`upstream_error`.
          additionalProperties: true
      additionalProperties: true
    ErrorUpstreamError:
      type: object
      properties:
        code:
          type: string
          nullable: true
          example: PERMISSION_DENIED
        message:
          type: string
          nullable: true
          example: The caller does not have permission.
        description:
          type: string
          nullable: true
        param:
          type: string
          nullable: true
    ErrorFailureSampleItem:
      type: object
      properties:
        provider:
          type: string
          nullable: true
        type:
          type: string
          nullable: true
        status:
          type: integer
          nullable: true
        upstream_error_code:
          type: string
          nullable: true
        upstream_error_message:
          type: string
          nullable: true
        upstream_error_description:
          type: string
          nullable: true
        upstream_error_param:
          type: string
          nullable: true
        upstream_payload_preview:
          type: string
          nullable: true
        retryable:
          type: boolean
          nullable: true
      additionalProperties: true
    ErrorProviderFailureDiagnostics:
      type: object
      properties:
        category:
          type: string
          enum:
            - credentials_not_configured
            - credentials_invalid_or_forbidden
            - provider_access_missing
            - region_or_project_restriction
            - model_unavailable_for_endpoint
            - rate_limited
            - server_error
        hint:
          type: string
        provider:
          type: string
          nullable: true
    ErrorRoutingDiagnostics:
      type: object
      properties:
        filterStages:
          type: array
          items:
            type: object
            properties:
              stage:
                type: string
              beforeCount:
                type: integer
              afterCount:
                type: integer
              droppedProviders:
                type: array
                items:
                  type: object
                  properties:
                    providerId:
                      type: string
                      nullable: true
                    reason:
                      type: string
                      nullable: true
                  additionalProperties: true
            additionalProperties: true
      additionalProperties: true
    ErrorProviderCandidateDiagnostics:
      type: object
      properties:
        totalProviders:
          type: integer
        supportsEndpointCount:
          type: integer
        candidateCount:
          type: integer
        droppedUnsupportedEndpoint:
          type: array
          items:
            type: string
        droppedMissingAdapter:
          type: array
          items:
            type: object
            properties:
              providerId:
                type: string
                nullable: true
              endpoint:
                type: string
                nullable: true
            additionalProperties: true
      additionalProperties: true
    ErrorProviderEnablementDiagnostics:
      type: object
      properties:
        capability:
          type: string
        providersBefore:
          type: array
          items:
            type: string
        providersAfter:
          type: array
          items:
            type: string
        dropped:
          type: array
          items:
            type: object
            properties:
              providerId:
                type: string
                nullable: true
              reason:
                type: string
                nullable: true
            additionalProperties: true
      additionalProperties: true
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: المصادقة باستخدام رمز Bearer

````

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