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

# Estimate cost

> The credits a generation would charge for these settings, after your organization's discounts, and whether your balance and plan allow it. An estimate reserves nothing; the actual charge happens when you generate.



## OpenAPI

````yaml /openapi.v1.json get /v1/models/{model_id}/estimate
openapi: 3.1.0
info:
  contact:
    email: hello@ekly.ai
    name: Ekly
    url: https://docs.ekly.ai
  description: >-
    Generate images, video, music and speech with the same models and credits as
    the Ekly app.


    Authenticate with an organization API key from Settings → Team as a bearer
    token. Every endpoint lives under /v1 and follows the additive-only
    versioning policy at https://docs.ekly.ai/versioning.
  termsOfService: https://ekly.ai/terms
  title: Ekly API
  version: '1.0'
servers:
  - description: Production
    url: https://api.ekly.ai
security:
  - ApiKey: []
tags:
  - description: Public, versioned developer API
    name: v1
paths:
  /v1/models/{model_id}/estimate:
    get:
      tags:
        - v1
      summary: Estimate cost
      description: >-
        The credits a generation would charge for these settings, after your
        organization's discounts, and whether your balance and plan allow it. An
        estimate reserves nothing; the actual charge happens when you generate.
      operationId: estimate_cost
      parameters:
        - description: A model id from GET /v1/models.
          in: path
          name: model_id
          required: true
          schema:
            description: A model id from GET /v1/models.
            title: Model Id
            type: string
        - description: >-
            Video or audio duration in seconds when pricing is per-second. Omit
            for per-generation models.
          in: query
          name: duration_seconds
          required: false
          schema:
            anyOf:
              - exclusiveMinimum: 0
                type: number
              - type: 'null'
            description: >-
              Video or audio duration in seconds when pricing is per-second.
              Omit for per-generation models.
            title: Duration Seconds
        - description: Quality tier when the model prices by quality.
          in: query
          name: quality
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: Quality tier when the model prices by quality.
            title: Quality
        - description: Resolution tier (e.g. 720p, 1080p) when pricing varies by tier.
          in: query
          name: tier
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: Resolution tier (e.g. 720p, 1080p) when pricing varies by tier.
            title: Tier
        - description: Model mode (e.g. extend_video) when pricing varies by mode.
          in: query
          name: mode
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: Model mode (e.g. extend_video) when pricing varies by mode.
            title: Mode
        - description: >-
            Speed/quality variant when the model declares one; omitted, the
            catalog default is priced.
          in: query
          name: variant
          required: false
          schema:
            anyOf:
              - maxLength: 64
                type: string
              - type: 'null'
            description: >-
              Speed/quality variant when the model declares one; omitted, the
              catalog default is priced.
            title: Variant
        - description: >-
            JSON object of other priced parameter values, keyed by parameter
            name (e.g. {"aspect_ratio": "9:16"}). Named arguments win on
            conflict.
          in: query
          name: pricing_params
          required: false
          schema:
            anyOf:
              - maxLength: 2000
                type: string
              - type: 'null'
            description: >-
              JSON object of other priced parameter values, keyed by parameter
              name (e.g. {"aspect_ratio": "9:16"}). Named arguments win on
              conflict.
            title: Pricing Params
        - description: >-
            Same key the subsequent generate call will send, when you want the
            quote and the charge to resolve the same supplier.
          in: query
          name: idempotency_key
          required: false
          schema:
            anyOf:
              - maxLength: 128
                type: string
              - type: 'null'
            description: >-
              Same key the subsequent generate call will send, when you want the
              quote and the charge to resolve the same supplier.
            title: Idempotency Key
        - description: Reference image count when the model charges per reference.
          in: query
          name: reference_image_count
          required: false
          schema:
            default: 0
            description: Reference image count when the model charges per reference.
            minimum: 0
            title: Reference Image Count
            type: integer
        - description: >-
            Opening-image count when an image-to-video model charges for its
            input image.
          in: query
          name: first_frame_count
          required: false
          schema:
            default: 0
            description: >-
              Opening-image count when an image-to-video model charges for its
              input image.
            maximum: 1
            minimum: 0
            title: First Frame Count
            type: integer
        - description: Text length in characters for character-priced speech models.
          in: query
          name: character_count
          required: false
          schema:
            anyOf:
              - minimum: 0
                type: integer
              - type: 'null'
            description: Text length in characters for character-priced speech models.
            title: Character Count
        - description: Estimated input tokens for token-priced models.
          in: query
          name: input_tokens
          required: false
          schema:
            anyOf:
              - minimum: 0
                type: integer
              - type: 'null'
            description: Estimated input tokens for token-priced models.
            title: Input Tokens
        - description: Estimated output tokens for token-priced models.
          in: query
          name: output_tokens
          required: false
          schema:
            anyOf:
              - minimum: 0
                type: integer
              - type: 'null'
            description: Estimated output tokens for token-priced models.
            title: Output Tokens
        - description: Image quality setting when the catalog prices by quality.
          in: query
          name: image_quality
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: Image quality setting when the catalog prices by quality.
            title: Image Quality
        - description: Image resolution tier when the catalog prices by resolution.
          in: query
          name: image_resolution
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: Image resolution tier when the catalog prices by resolution.
            title: Image Resolution
        - description: Aspect ratio or concrete WxH size for matrix-priced image models.
          in: query
          name: aspect_size
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: Aspect ratio or concrete WxH size for matrix-priced image models.
            title: Aspect Size
        - description: Number of outputs when pricing is per image or batch.
          in: query
          name: generation_count
          required: false
          schema:
            default: 1
            description: Number of outputs when pricing is per image or batch.
            minimum: 1
            title: Generation Count
            type: integer
        - description: Include native video audio in the price; defaults on for Veo.
          in: query
          name: generate_audio
          required: false
          schema:
            anyOf:
              - type: boolean
              - type: 'null'
            description: Include native video audio in the price; defaults on for Veo.
            title: Generate Audio
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CostEstimateResponse'
          description: Successful Response
        '401':
          content:
            application/json:
              example:
                error:
                  code: unauthenticated
                  message: >-
                    This API key is not valid. Create a new one in Settings →
                    Team.
                  trace_id: c3746d5302dc4be6b2e8fa99fa762a8c
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: API key missing, invalid, revoked or expired.
        '403':
          content:
            application/json:
              example:
                error:
                  code: forbidden
                  message: API keys can only call the /v1 API.
                  trace_id: c3746d5302dc4be6b2e8fa99fa762a8c
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Not allowed for this key or organization.
        '404':
          content:
            application/json:
              example:
                error:
                  code: not_found
                  message: No generation with that id for this key.
                  trace_id: c3746d5302dc4be6b2e8fa99fa762a8c
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: No such resource.
        '422':
          content:
            application/json:
              example:
                error:
                  code: validation_error
                  details:
                    - loc:
                        - body
                        - model
                      msg: Field required
                      type: missing
                  message: Request validation failed.
                  trace_id: c3746d5302dc4be6b2e8fa99fa762a8c
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Request failed validation.
        '429':
          content:
            application/json:
              example:
                error:
                  code: rate_limited
                  message: Rate limit exceeded; retry after 12s.
                  trace_id: c3746d5302dc4be6b2e8fa99fa762a8c
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Rate limit exceeded; see Retry-After.
      security:
        - ApiKey: []
components:
  schemas:
    CostEstimateResponse:
      properties:
        allowed:
          description: False when your plan cannot use this model; see reason.
          title: Allowed
          type: boolean
        balance:
          title: Balance
          type: number
        billable_duration_seconds:
          anyOf:
            - type: number
            - type: 'null'
          title: Billable Duration Seconds
        can_afford:
          title: Can Afford
          type: boolean
        credits:
          description: List price in credits before discounts.
          title: Credits
          type: number
        credits_after_discount:
          title: Credits After Discount
          type: number
        discount_percent:
          default: 0
          title: Discount Percent
          type: number
        model:
          title: Model
          type: string
        reason:
          anyOf:
            - type: string
            - type: 'null'
          title: Reason
      required:
        - model
        - credits
        - credits_after_discount
        - can_afford
        - balance
        - allowed
      title: CostEstimateResponse
      type: object
    ErrorResponse:
      description: Every non-2xx /v1 response.
      properties:
        error:
          $ref: '#/components/schemas/ErrorBody'
      required:
        - error
      title: ErrorResponse
      type: object
    ErrorBody:
      properties:
        code:
          description: >-
            Stable machine-readable code: unauthenticated, invalid_api_key,
            payment_required, forbidden, api_key_scope, not_found, conflict,
            validation_error, rate_limited, client_error, internal_error.
          title: Code
          type: string
        details:
          anyOf:
            - items:
                additionalProperties: true
                type: object
              type: array
            - type: 'null'
          description: >-
            Only on 422: one entry per offending field, with `loc`, `msg` and
            `type`.
          title: Details
        message:
          description: >-
            Human-readable explanation; safe to show to a developer, not meant
            for parsing.
          title: Message
          type: string
        trace_id:
          anyOf:
            - type: string
            - type: 'null'
          description: Quote this when contacting support; it identifies the exact request.
          title: Trace Id
      required:
        - code
        - message
      title: ErrorBody
      type: object
  securitySchemes:
    ApiKey:
      bearerFormat: ek_live_…
      description: >-
        An organization API key created in Settings → Team, sent as
        `Authorization: Bearer <key>`.
      scheme: bearer
      type: http

````

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