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

# Estimate Request Costs

> Estimate the cost of one or more planned API requests before sending them. Useful for budgeting and showing users a price quote.



## OpenAPI

````yaml /openapi.json post /api/v1/estimate
openapi: 3.1.0
info:
  title: NinjaChat API
  version: 1.0.0
  description: >-
    Access 40+ AI models through a unified API — chat, image generation, video
    generation, and web search. One API key, one endpoint per type, just change
    the `model` parameter.
servers:
  - url: https://www.ninjachat.ai
security:
  - bearerAuth: []
paths:
  /api/v1/estimate:
    post:
      tags:
        - Management
      summary: Estimate Request Costs
      description: >-
        Estimate the cost of one or more planned API requests before sending
        them. Useful for budgeting and showing users a price quote.
      operationId: estimateCosts
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - items
              properties:
                items:
                  type: array
                  minItems: 1
                  maxItems: 100
                  items:
                    type: object
                    required:
                      - group
                      - model
                    properties:
                      group:
                        type: string
                        enum:
                          - chat
                          - search
                          - images
                          - video
                        description: Type of request you plan to send.
                      model:
                        type: string
                        description: Model ID (e.g. gpt-5, flux-2-klein, veo-3.1).
                      count:
                        type: integer
                        minimum: 1
                        default: 1
                        description: How many requests of this shape you plan to send.
                  description: Planned request shapes to estimate.
            example:
              items:
                - group: chat
                  model: gpt-5
                  count: 10
                - group: images
                  model: flux-2-klein
                  count: 5
      responses:
        '200':
          description: Estimated costs.
          content:
            application/json:
              schema:
                type: object
                properties:
                  items:
                    type: array
                    items:
                      type: object
                      properties:
                        group:
                          type: string
                        model:
                          type: string
                        count:
                          type: integer
                        estimated_cost:
                          type: string
                          example: $0.060
                  total:
                    type: string
                    example: $0.090
        '400':
          description: Invalid estimate request.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Authentication failed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    ErrorResponse:
      type: object
      description: >-
        OpenAI-compatible error. The top-level `message`, `code`, and
        `request_id` mirror fields inside `error` for convenience.
      properties:
        error:
          type: object
          properties:
            message:
              type: string
              description: Human-readable error description.
            type:
              type: string
              description: >-
                Error category: invalid_request_error, authentication_error,
                rate_limit_error, insufficient_quota, or api_error.
            code:
              type: string
              description: Machine-readable error code.
            param:
              type: string
              nullable: true
              description: The request parameter that caused the error, if any.
        message:
          type: string
          description: Same as error.message.
        code:
          type: string
          description: Same as error.code.
        request_id:
          type: string
          description: Unique request ID, useful when contacting support.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: API key starting with nj_sk_

````