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

# Create Batch

> Create a chat batch.

The batch runs on OpenAI within 24 hours at the model's batch rates. Poll
GET /v3/batches/{batch_id} until `status` is `completed`, `failed`, `expired` or
`cancelled`, then read the results from GET /v3/batches/{batch_id}/results.



## OpenAPI

````yaml https://api.edenai.run/v3/docs/openapi.json post /v3/batches
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/batches:
    post:
      tags:
        - Batches
      summary: Create Batch
      description: >-
        Create a chat batch.


        The batch runs on OpenAI within 24 hours at the model's batch rates.
        Poll

        GET /v3/batches/{batch_id} until `status` is `completed`, `failed`,
        `expired` or

        `cancelled`, then read the results from GET
        /v3/batches/{batch_id}/results.
      operationId: create_batch_v3_batches_post
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/Body_create_batch_v3_batches_post'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BatchObject'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - AuthBearer: []
components:
  schemas:
    Body_create_batch_v3_batches_post:
      properties:
        file:
          type: string
          format: binary
          title: File
          description: >-
            The requests, JSONL: at most 5000 lines and 100 MB. Each line is
            `{"custom_id", "method": "POST", "url": "/v1/chat/completions",
            "body"}`, `body` a chat completion body whose `model` is
            `openai/<model>`, the same on every line.
        metadata:
          anyOf:
            - type: string
            - type: 'null'
          title: Metadata
          description: >-
            A JSON object of up to 14 string pairs attached to the batch. The
            keys `eden_batch_id` and `eden_request_id` are reserved.
        webhook_receiver:
          anyOf:
            - type: string
            - type: 'null'
          title: Webhook Receiver
          description: URL notified once the batch has finished and settled.
      type: object
      required:
        - file
      title: Body_create_batch_v3_batches_post
    BatchObject:
      properties:
        id:
          type: string
          title: Id
          description: The batch id.
        object:
          type: string
          const: batch
          title: Object
          description: Always `batch`.
          default: batch
        endpoint:
          type: string
          title: Endpoint
          description: The endpoint every request of the batch calls.
          default: /v1/chat/completions
        model:
          type: string
          title: Model
          description: The model every request runs on, `openai/<model>`.
        status:
          type: string
          enum:
            - validating
            - in_progress
            - finalizing
            - completed
            - failed
            - expired
            - cancelling
            - cancelled
          title: Status
          description: Where the batch is in its lifecycle.
        request_counts:
          $ref: '#/components/schemas/BatchRequestCounts'
          description: How many requests have finished, refreshed every few minutes.
        metadata:
          anyOf:
            - additionalProperties:
                type: string
              type: object
            - type: 'null'
          title: Metadata
          description: The key/value pairs given at create.
        created_at:
          type: integer
          title: Created At
          description: When the batch was created, Unix seconds.
        finished_at:
          anyOf:
            - type: integer
            - type: 'null'
          title: Finished At
          description: When the batch finished and settled, Unix seconds.
        cost:
          anyOf:
            - type: string
              pattern: ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$
            - type: 'null'
          title: Cost
          description: >-
            What the batch billed, in US dollars, once it finished; null before.
            Each request that succeeded bills its tokens at the model's batch
            rates; a failed one, or one that never ran, bills zero. A request
            that succeeded with no token count bills an estimate at the same
            rates: its prompt tokens, the output its response shows and a
            reasoning allowance, the output never above the most the request
            could produce. A request OpenAI counts as completed with no result
            line bills the same estimate with no output shown. When the results
            cannot be read, every request that may have run bills that estimate.
        error:
          anyOf:
            - type: string
            - type: 'null'
          title: Error
          description: Why the batch failed, when it did.
      type: object
      required:
        - id
        - model
        - status
        - created_at
      title: BatchObject
      description: A chat batch.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    BatchRequestCounts:
      properties:
        total:
          type: integer
          title: Total
          description: Requests in the batch.
          default: 0
        completed:
          type: integer
          title: Completed
          description: Requests that succeeded.
          default: 0
        failed:
          type: integer
          title: Failed
          description: Requests that failed.
          default: 0
      type: object
      title: BatchRequestCounts
      description: >-
        How many of the batch's requests have finished, as OpenAI last reported
        them.
    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.