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

# AI Service Health

> Returns provider, model, and capability metadata for the AI router.

Lightweight heartbeat for the AI router. Returns the active provider/model plus
capabilities that the chat endpoint currently exposes.

## Response fields

* `data.service`: Always `ai`.
* `data.status`: `healthy`, `degraded`, or `unhealthy`.
* `data.provider`: Which LLM vendor is active (`openai`, `anthropic`, or `multi`).
* `data.model`: Default model returned by `aiConfig.getDefaultModel()`.
* `data.streaming_support`: `true` once SSE streaming is available.
* `data.streaming_header`: Header key (`X-Stream-Response` or `Stream`) clients should
  set to enable streaming.
* `data.rag_enabled`: Whether retrieval augmented generation is active.
* `data.auth_method`: Describes the accepted auth inputs (Auth0 JWT or device headers).
* `data.guest_chat_enabled`: Indicates whether unauthenticated guests can chat.
* `data.timestamp`: ISO 8601 server time.

## Example request

```bash theme={null}
curl https://api.handauncle.com/api/v1/ai/health
```

## Example response

```json theme={null}
{
  "success": true,
  "data": {
    "service": "ai",
    "status": "healthy",
    "provider": "openai",
    "model": "gpt-4o-mini",
    "streaming_support": true,
    "streaming_header": "X-Stream-Response or Stream",
    "rag_enabled": true,
    "auth_method": "Auth0 JWT (RS256) OR Device Headers",
    "guest_chat_enabled": true,
    "timestamp": "2025-12-01T12:00:00.000Z"
  },
  "meta": {
    "timestamp": "2025-12-01T12:00:00.000Z",
    "request_id": "req_abc"
  }
}
```


## OpenAPI

````yaml GET /api/v1/ai/health
openapi: 3.1.0
info:
  title: Handa Uncle API
  version: 1.0.0
  description: Public specification for the Handa Uncle web and mobile APIs.
  contact:
    name: Handa Uncle Engineering
    email: hello@handauncle.com
servers:
  - url: https://handauncle-backend-prod-205012263523.asia-south1.run.app
    description: Prod API base (Cloud Run)
  - url: https://api.handauncle.com
    description: Production
  - url: https://staging-api.handauncle.com
    description: Staging
  - url: http://localhost:8080
    description: Local development
security: []
tags:
  - name: Mobile App
    description: Endpoints used by the native Handa Uncle app.
  - name: Platform
    description: Cross-service operational endpoints.
  - name: Auth
    description: Authentication endpoints handled by the backend adapter.
  - name: AI
    description: LLM chat endpoints supporting streaming and device-auth guests.
  - name: OTP
    description: Phone OTP lifecycle powered by Exotel.
  - name: Webhooks
    description: Server-to-server hooks invoked by Auth0.
  - name: Conversations
    description: Authenticated user conversation management.
  - name: Chat Share
    description: Create, manage, and consume shared conversations.
  - name: Files
    description: Upload, list, and delete user files.
  - name: Prompt management
    description: Admin and public APIs for managing masked pre-prompts.
  - name: User Profile
    description: Profile card collection and user data for personalized AI responses.
  - name: Visual Embeds
    description: Manage visual embed images that attach to AI chat responses.
  - name: Second Opinion
    description: Admin and public APIs for Second Opinion suggestion cards.
  - name: Profile Cards
    description: >-
      APIs for managing profile card questions used in onboarding and
      personalization.
paths:
  /api/v1/ai/health:
    get:
      tags:
        - AI
      summary: AI service health
      description: Returns provider, model, and capability metadata for the AI router.
      operationId: aiHealth
      responses:
        '200':
          description: Service heartbeat
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AiHealthResponseEnvelope'
        '500':
          $ref: '#/components/responses/InternalError'
components:
  schemas:
    AiHealthResponseEnvelope:
      type: object
      required:
        - success
        - data
        - meta
      properties:
        success:
          type: boolean
          enum:
            - true
        data:
          $ref: '#/components/schemas/AiHealthResponseData'
        meta:
          $ref: '#/components/schemas/ResponseMeta'
    AiHealthResponseData:
      type: object
      required:
        - service
        - status
        - provider
        - model
        - streamingSupport
        - streamingHeader
        - ragEnabled
        - authMethod
        - guest_chat_enabled
        - timestamp
      properties:
        service:
          type: string
          example: ai
        status:
          type: string
          enum:
            - healthy
            - degraded
            - unhealthy
        provider:
          type: string
          description: Active LLM provider.
        model:
          type: string
          description: Default model used for chat.
        streamingSupport:
          type: boolean
        streamingHeader:
          type: string
          description: Header clients should send to enable streaming.
        ragEnabled:
          type: boolean
        authMethod:
          type: string
          description: Describes accepted authentication modes.
        guest_chat_enabled:
          type: boolean
        timestamp:
          type: string
          format: date-time
    ResponseMeta:
      type: object
      properties:
        timestamp:
          type: string
          format: date-time
        requestId:
          type: string
          description: Server generated correlation identifier.
      required:
        - timestamp
        - requestId
    ErrorResponse:
      type: object
      properties:
        success:
          type: boolean
          enum:
            - false
        error:
          $ref: '#/components/schemas/ErrorObject'
        meta:
          $ref: '#/components/schemas/ResponseMeta'
      required:
        - success
        - error
        - meta
    ErrorObject:
      type: object
      properties:
        message:
          type: string
          description: Human-readable error message describing the issue.
          example: Please enter a valid 10-digit phone number (e.g., 9876543210)
        code:
          type: string
          description: Error code for programmatic handling.
          example: VALIDATION_ERROR
        details:
          type: array
          description: >-
            Array of field-specific validation errors (for VALIDATION_ERROR
            responses).
          items:
            type: object
            properties:
              field:
                type: string
                description: Field name that failed validation.
                example: phone
              message:
                type: string
                description: Specific validation error message for this field.
                example: Please enter a valid 10-digit phone number (e.g., 9876543210)
            required:
              - field
              - message
      required:
        - message
  responses:
    InternalError:
      description: Unexpected server error.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'

````