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

# Universal Ai

> Universal AI endpoint for synchronous non-LLM AI features.

Model format: feature/subfeature/provider[/model]

Supported features:
- text/ai_detection, text/moderation, etc.
- ocr/ocr, ocr/identity_parser, etc.
- image/generation, image/background_removal, etc.

For async features (e.g., audio/speech_to_text_async), use POST /v3/universal-ai/async.

Request body:
- model: Model string in format feature/subfeature/provider[/model]
- input: Feature-specific input parameters
- fallbacks: Optional list of fallback provider strings (max 3); not supported on
  audio/tts or image/face_recognition, since a voice or a face collection belongs
  to one provider
- provider_params: Optional provider-specific parameters
- show_original_response: Include raw provider response (default: false)

Example:
```json
{
    "model": "text/ai_detection/openai/gpt-4",
    "input": {"text": "Analyze this text"}
}
```



## OpenAPI

````yaml https://api.edenai.run/v3/docs/openapi.json post /v3/universal-ai
openapi: 3.1.0
info:
  title: Eden AI API V3
  version: 3.0.0
servers:
  - url: https://api.edenai.run
    description: Production server
security: []
paths:
  /v3/universal-ai:
    post:
      tags:
        - universal-ai
      summary: Universal Ai
      description: >-
        Universal AI endpoint for synchronous non-LLM AI features.


        Model format: feature/subfeature/provider[/model]


        Supported features:

        - text/ai_detection, text/moderation, etc.

        - ocr/ocr, ocr/identity_parser, etc.

        - image/generation, image/background_removal, etc.


        For async features (e.g., audio/speech_to_text_async), use POST
        /v3/universal-ai/async.


        Request body:

        - model: Model string in format feature/subfeature/provider[/model]

        - input: Feature-specific input parameters

        - fallbacks: Optional list of fallback provider strings (max 3); not
        supported on
          audio/tts or image/face_recognition, since a voice or a face collection belongs
          to one provider
        - provider_params: Optional provider-specific parameters

        - show_original_response: Include raw provider response (default: false)


        Example:

        ```json

        {
            "model": "text/ai_detection/openai/gpt-4",
            "input": {"text": "Analyze this text"}
        }

        ```
      operationId: universal_ai_v3_universal_ai_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UniversalAIBody'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UniversalAIResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - AuthBearer: []
components:
  schemas:
    UniversalAIBody:
      properties:
        tags:
          title: Tags
          description: >-
            Up to 10 key/value labels recorded with this call, for filtering and
            grouping usage. Merged with the `X-EdenAI-Tags` header.
          examples:
            - client: acme
              project: invoices
        model:
          type: string
          title: Model
          description: 'Model in format: feature/subfeature/provider[/model]'
          examples:
            - text/ai_detection/openai/gpt-4
            - ocr/ocr/amazon
            - image/generation/google/imagen-3
        provider_params:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Provider Params
          description: >-
            Native parameters in the provider's own request format, forwarded to
            the provider alongside `input`. On some features each provider
            accepts only an allowlist of parameters, and any other returns 400.
        input:
          additionalProperties: true
          type: object
          title: Input
          description: >-
            Feature-specific input fields, nested here rather than at the top
            level of the body. The fields accepted for the feature/subfeature
            named in `model` are its `input_schema`, served by GET
            /v3/info/{feature}/{subfeature}. Examples:

            - text/ai_detection: {'text': 'content to analyze'}

            - ocr/ocr: {'file': '<file ID or URL>', 'language': 'en'}

            - image/generation: {'text': 'prompt', 'resolution': '1024x1024'}

            - translation/document_translation: {'file': '<file ID or URL>',
            'target_language': 'fr'}
          examples:
            - text: Analyze this text for AI detection
            - file: https://example.com/invoice.pdf
              language: en
            - resolution: 1024x1024
              text: A lighthouse at dusk
        fallbacks:
          items:
            type: string
          type: array
          maxItems: 3
          title: Fallbacks
          description: >-
            Fallback providers to try if the primary provider fails, in order.
            Accepted formats:
              - 'provider' or 'provider/model' (e.g. 'amazon', 'openai/gpt-4')
              - full model id (e.g 'text/moderation/google', 'image/generation/minimax/image-01')
        show_original_response:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Show Original Response
          description: Include raw provider response in the output
          default: false
        output_format:
          type: string
          enum:
            - full
            - compact
          title: Output Format
          description: >-
            `compact` trims `output` for LLM and agent callers: base64-encoded
            media is dropped wherever it appears (the `*_resource_url` download
            link next to it stays), and so is dense position data such as
            per-word OCR boxes, table cell boxes and face landmarks; one box per
            detected item stays. Fields the output schema marks required may
            therefore be absent. `original_response` is not trimmed. `full`
            returns the output unchanged. The response echoes the format.
            Applies to this response only: an async job keeps its full output,
            so pass `output_format=compact` again when fetching it.
          default: full
      type: object
      required:
        - model
        - input
      title: UniversalAIBody
      description: |-
        Universal AI request body.

        Model format: feature/subfeature/provider[/model]

        Examples:
            - text/ai_detection/openai/gpt-4
            - ocr/ocr/amazon
            - image/generation/google/imagen-3

        The `input` dict contains feature-specific parameters that are
        validated at runtime based on the parsed feature/subfeature.
    UniversalAIResponse:
      properties:
        status:
          type: string
          enum:
            - success
            - fail
          title: Status
          description: Whether the request succeeded or failed
        cost:
          type: string
          pattern: ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$
          title: Cost
          description: Cost in credits for this request
        provider:
          type: string
          title: Provider
          description: Provider name that processed the request
        feature:
          type: string
          title: Feature
          description: Feature category (e.g., text, ocr, image)
        subfeature:
          type: string
          title: Subfeature
          description: Specific subfeature (e.g., ai_detection, sentiment)
        output_format:
          type: string
          enum:
            - full
            - compact
          title: Output Format
          description: >-
            Whether `output`, the normalized output, is whole (`full`) or
            trimmed for LLM callers (`compact`); echoes the request parameter.
            Unrelated to `original_response`, the raw provider payload behind
            `show_original_response`.
          default: full
        output:
          title: Output
          description: Normalized output from the provider
        error:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Error
          description: Error details from the provider (only present when status is 'fail')
        original_response:
          anyOf:
            - {}
            - type: 'null'
          title: Original Response
          description: Raw response from the provider (if show_original_response=true)
        edenai_metadata:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Edenai Metadata
          description: >-
            How the request was served: the attempts in order and which one
            answered. Only present when the request sends `x-edenai-metadata:
            enabled`
      type: object
      required:
        - status
        - cost
        - provider
        - feature
        - subfeature
        - output
      title: UniversalAIResponse
      description: |-
        Sync response from universal-ai endpoint.

        Inherits all fields from base, with status restricted to success/fail.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    AuthBearer:
      type: http
      scheme: bearer

````

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