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

# اختبار مصنّف الطلبات

> شغّل مصنّفًا محفوظًا أو مسودة مرة واحدة على مطالبة واستجابة تجريبيتين.

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

> [!NOTE]
>
> تُجري نقطة النهاية هذه طلب نموذج مدفوعًا ببيانات اعتمادك، لذا تتطلب رمز OAuth يتضمن `classifiers:write` و`gateway:access` معًا. لا تُقبل مفاتيح الإدارة.


## OpenAPI

````yaml ar/openapi/v1/openapi.localized.yaml POST /classifiers/test
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:
  /classifiers/test:
    post:
      tags:
        - Gateway
      summary: اختبار مصنّف على عينة
      description: >-
        يشغّل مصنّفًا محفوظًا أو مسودة مرة واحدة على مطالبة واستجابة تجريبيتين،
        بالطلب نفسه الذي ترسله البوابة. هذا طلب نموذج حقيقي ومدفوع يتم ببيانات
        اعتمادك ويُوسم بـ phaseo.classifier_test. للمالكين والمسؤولين؛ تحتاج
        بيانات الاعتماد إلى classifiers:write وgateway:access. لا يمكن لمفاتيح
        الإدارة إجراء طلبات النماذج لذا تُرفض.
      operationId: testClassifier
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ClassifierTestRequest'
      responses:
        '200':
          description: التسميات التي اختارها النموذج
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ClassifierTestResponse'
        '400':
          description: مصنّف أو عينة غير صالحة
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: غير مصرّح به
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: >-
            ليس مالكًا أو مسؤولًا، أو ينقص classifiers:write، أو أن بيانات
            الاعتماد لا تتضمن gateway:access
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: لم يُعثر على المصنّف المحفوظ في مساحة العمل هذه
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '502':
          description: فشل طلب النموذج (مثلًا بسبب عدم كفاية الرصيد)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    ClassifierTestRequest:
      type: object
      required:
        - sample
      properties:
        classifier:
          type: object
          description: >-
            مسودة للاختبار. تُؤخذ الحقول غير المرسلة من classifier_id عند
            تحديده.
          properties:
            model:
              type: string
            instructions:
              type: string
            dimensions:
              type: array
              items:
                $ref: '#/components/schemas/ClassifierDimension'
        classifier_id:
          type: string
          format: uuid
          description: مصنّف محفوظ في مساحة العمل هذه لاختباره، أو لوسم الاختبار به.
        sample:
          type: object
          required:
            - prompt
          properties:
            prompt:
              type: string
              maxLength: 8000
            response:
              type: string
              maxLength: 8000
    ClassifierTestResponse:
      type: object
      required:
        - data
      properties:
        data:
          type: object
          properties:
            labels:
              type: array
              items:
                type: object
                properties:
                  key:
                    type: string
                  value:
                    type: string
                  confidence:
                    type: number
                    nullable: true
            answered:
              type: boolean
              description: خاطئة عندما يتعذّر قراءة إجابة النموذج.
            cost_usd:
              type: number
            model:
              type: string
            format:
              type: string
              enum:
                - json_schema
                - decisions
                - json
            request_id:
              type: string
              nullable: true
    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
    ClassifierDimension:
      type: object
      description: >-
        سؤال يجيب عنه المصنّف عن كل طلب. تُكتب الإجابة كتسمية للطلب مفتاحها هو
        مفتاح هذا البعد. إذا أرسل المستدعي بالفعل تسمية بهذا المفتاح، يُتخطى
        البعد.
      required:
        - key
        - values
      properties:
        key:
          type: string
          minLength: 1
          maxLength: 64
          pattern: ^[A-Za-z0-9_.:-]+$
        name:
          type: string
          maxLength: 100
        description:
          type: string
          maxLength: 500
          nullable: true
        multiple:
          type: boolean
          default: false
          description: السماح بأكثر من قيمة واحدة لكل طلب.
        allow_other:
          type: boolean
          default: false
          description: السماح للنموذج بالإجابة بـ "other" عندما لا تناسب أي قيمة مدرجة.
        values:
          type: array
          description: >-
            من 2 إلى 50 قيمة. لا يُسمح بقيمة واحدة إلا عندما تكون allow_other
            صحيحة.
          minItems: 1
          maxItems: 50
          items:
            $ref: '#/components/schemas/ClassifierValue'
      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
    ClassifierValue:
      type: object
      required:
        - value
      properties:
        value:
          type: string
          minLength: 1
          maxLength: 64
          pattern: ^[A-Za-z0-9_.:-]+$
        description:
          type: string
          maxLength: 300
          nullable: true
          description: يخبر النموذج متى يختار هذه القيمة.
      additionalProperties: false
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: المصادقة باستخدام رمز Bearer

````

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