OpenAI Batch API

Create large batches of API requests to run asynchronously.

Operations 4

POST /batches Creates and executes a batch from an uploaded file of requests #
GET /batches List your organization's batches. #
GET /batches/{batch_id} Retrieves a batch. #
POST /batches/{batch_id}/cancel Cancels an in-progress batch. The batch will be in status `cancelling` for up to 10 minutes, before changing to `cancelled`, where it will have partial results (if any) available i #

Documentation

📖
Documentation
https://platform.openai.com/docs/assistants/overview
📖
Documentation
https://platform.openai.com/docs/api-reference/assistants
📖
Documentation
https://platform.openai.com/docs/guides/text-to-speech
📖
Documentation
https://platform.openai.com/docs/api-reference/audio
📖
Documentation
https://platform.openai.com/docs/guides/speech-to-text
📖
Documentation
https://developers.openai.com/api/docs/guides/audio/
📖
Documentation
https://developers.openai.com/api/docs/guides/voice-agents/
📖
Documentation
https://platform.openai.com/docs/api-reference/chat
📖
Documentation
https://platform.openai.com/docs/guides/embeddings
📖
Documentation
https://platform.openai.com/docs/api-reference/embeddings
📖
Documentation
https://platform.openai.com/docs/api-reference/files
📖
Documentation
https://platform.openai.com/docs/guides/fine-tuning
📖
Documentation
https://platform.openai.com/docs/api-reference/fine-tuning
📖
Documentation
https://platform.openai.com/docs/guides/images
📖
Documentation
https://platform.openai.com/docs/api-reference/images
📖
Documentation
https://platform.openai.com/docs/guides/image-generation
📖
Documentation
https://platform.openai.com/docs/guides/images-vision
📖
Documentation
https://platform.openai.com/docs/models
📖
Documentation
https://platform.openai.com/docs/api-reference/models
📖
Documentation
https://platform.openai.com/docs/assistants/how-it-works/managing-threads-and-messages
📖
Documentation
https://platform.openai.com/docs/api-reference/threads
📖
Documentation
https://platform.openai.com/docs/api-reference/completions

Specifications

Schemas & Data

Other Resources

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/openai-batch-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Discovery needs no key. Ratings and market analysis are Pro.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

openai-batch-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: OpenAI Batch API
  description: The OpenAI REST API. Please see https://platform.openai.com/docs/api-reference for more details.
  version: 2.3.0
  termsOfService: https://openai.com/policies/terms-of-use
  contact:
    name: OpenAI Support
    url: https://help.openai.com/
  license:
    name: MIT
    url: https://github.com/openai/openai-openapi/blob/master/LICENSE
servers:
- url: https://api.openai.com/v1
security:
- ApiKeyAuth: []
tags:
- name: Batch
  description: Create large batches of API requests to run asynchronously.
paths:
  /batches:
    post:
      summary: Creates and executes a batch from an uploaded file of requests
      operationId: createBatch
      tags:
      - Batch
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - input_file_id
              - endpoint
              - completion_window
              properties:
                input_file_id:
                  type: string
                  description: 'The ID of an uploaded file that contains requests for the new batch.


                    See [upload file](/docs/api-reference/files/create) for how to upload a file.


                    Your input file must be formatted as a [JSONL file](/docs/api-reference/batch/request-input), and must be uploaded with the purpose `batch`. The file can contain up to 50,000 requests, and can be up to 200 MB in size.

                    '
                endpoint:
                  type: string
                  enum:
                  - /v1/responses
                  - /v1/chat/completions
                  - /v1/embeddings
                  - /v1/completions
                  - /v1/moderations
                  - /v1/images/generations
                  - /v1/images/edits
                  - /v1/videos
                  description: The endpoint to be used for all requests in the batch. Currently `/v1/responses`, `/v1/chat/completions`, `/v1/embeddings`, `/v1/completions`, `/v1/moderations`, `/v1/images/generations`, `/v1/images/edits`, and `/v1/videos` are supported. Note that `/v1/embeddings` batches are also restricted to a maximum of 50,000 embedding inputs across all requests in the batch.
                completion_window:
                  type: string
                  enum:
                  - 24h
                  description: The time frame within which the batch should be processed. Currently only `24h` is supported.
                metadata:
                  $ref: '#/components/schemas/Metadata'
                output_expires_after:
                  $ref: '#/components/schemas/BatchFileExpirationAfter'
      responses:
        '200':
          description: Batch created successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Batch'
      x-oaiMeta:
        name: Create batch
        group: batch
        examples:
          request:
            curl: "curl https://api.openai.com/v1/batches \\\n  -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n    \"input_file_id\": \"file-abc123\",\n    \"endpoint\": \"/v1/chat/completions\",\n    \"completion_window\": \"24h\"\n  }'\n"
            python: "import os\nfrom openai import OpenAI\n\nclient = OpenAI(\n    api_key=os.environ.get(\"OPENAI_API_KEY\"),  # This is the default and can be omitted\n)\nbatch = client.batches.create(\n    completion_window=\"24h\",\n    endpoint=\"/v1/responses\",\n    input_file_id=\"input_file_id\",\n)\nprint(batch.id)"
            javascript: "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n  const batch = await openai.batches.create({\n    input_file_id: \"file-abc123\",\n    endpoint: \"/v1/chat/completions\",\n    completion_window: \"24h\"\n  });\n\n  console.log(batch);\n}\n\nmain();\n"
            node.js: "import OpenAI from 'openai';\n\nconst client = new OpenAI({\n  apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted\n});\n\nconst batch = await client.batches.create({\n  completion_window: '24h',\n  endpoint: '/v1/responses',\n  input_file_id: 'input_file_id',\n});\n\nconsole.log(batch.id);"
            go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tbatch, err := client.Batches.New(context.TODO(), openai.BatchNewParams{\n\t\tCompletionWindow: openai.BatchNewParamsCompletionWindow24h,\n\t\tEndpoint:         openai.BatchNewParamsEndpointV1Responses,\n\t\tInputFileID:      \"input_file_id\",\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", batch.ID)\n}\n"
            java: "package com.openai.example;\n\nimport com.openai.client.OpenAIClient;\nimport com.openai.client.okhttp.OpenAIOkHttpClient;\nimport com.openai.models.batches.Batch;\nimport com.openai.models.batches.BatchCreateParams;\n\npublic final class Main {\n    private Main() {}\n\n    public static void main(String[] args) {\n        OpenAIClient client = OpenAIOkHttpClient.fromEnv();\n\n        BatchCreateParams params = BatchCreateParams.builder()\n            .completionWindow(BatchCreateParams.CompletionWindow._24H)\n            .endpoint(BatchCreateParams.Endpoint.V1_RESPONSES)\n            .inputFileId(\"input_file_id\")\n            .build();\n        Batch batch = client.batches().create(params);\n    }\n}"
            ruby: "require \"openai\"\n\nopenai = OpenAI::Client.new(api_key: \"My API Key\")\n\nbatch = openai.batches.create(\n  completion_window: :\"24h\",\n  endpoint: :\"/v1/responses\",\n  input_file_id: \"input_file_id\"\n)\n\nputs(batch)"
          response: "{\n  \"id\": \"batch_abc123\",\n  \"object\": \"batch\",\n  \"endpoint\": \"/v1/chat/completions\",\n  \"errors\": null,\n  \"input_file_id\": \"file-abc123\",\n  \"completion_window\": \"24h\",\n  \"status\": \"validating\",\n  \"output_file_id\": null,\n  \"error_file_id\": null,\n  \"created_at\": 1711471533,\n  \"in_progress_at\": null,\n  \"expires_at\": null,\n  \"finalizing_at\": null,\n  \"completed_at\": null,\n  \"failed_at\": null,\n  \"expired_at\": null,\n  \"cancelling_at\": null,\n  \"cancelled_at\": null,\n  \"request_counts\": {\n    \"total\": 0,\n    \"completed\": 0,\n    \"failed\": 0\n  },\n  \"metadata\": {\n    \"customer_id\": \"user_123456789\",\n    \"batch_description\": \"Nightly eval job\",\n  }\n}\n"
    get:
      operationId: listBatches
      tags:
      - Batch
      summary: List your organization's batches.
      parameters:
      - in: query
        name: after
        required: false
        schema:
          type: string
        description: 'A cursor for use in pagination. `after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.

          '
      - name: limit
        in: query
        description: 'A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.

          '
        required: false
        schema:
          type: integer
          default: 20
      responses:
        '200':
          description: Batch listed successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ListBatchesResponse'
      x-oaiMeta:
        name: List batches
        group: batch
        examples:
          request:
            curl: "curl https://api.openai.com/v1/batches?limit=2 \\\n  -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n  -H \"Content-Type: application/json\"\n"
            python: "import os\nfrom openai import OpenAI\n\nclient = OpenAI(\n    api_key=os.environ.get(\"OPENAI_API_KEY\"),  # This is the default and can be omitted\n)\npage = client.batches.list()\npage = page.data[0]\nprint(page.id)"
            javascript: "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n  const list = await openai.batches.list();\n\n  for await (const batch of list) {\n    console.log(batch);\n  }\n}\n\nmain();\n"
            node.js: "import OpenAI from 'openai';\n\nconst client = new OpenAI({\n  apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted\n});\n\n// Automatically fetches more pages as needed.\nfor await (const batch of client.batches.list()) {\n  console.log(batch.id);\n}"
            go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tpage, err := client.Batches.List(context.TODO(), openai.BatchListParams{})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", page)\n}\n"
            java: "package com.openai.example;\n\nimport com.openai.client.OpenAIClient;\nimport com.openai.client.okhttp.OpenAIOkHttpClient;\nimport com.openai.models.batches.BatchListPage;\nimport com.openai.models.batches.BatchListParams;\n\npublic final class Main {\n    private Main() {}\n\n    public static void main(String[] args) {\n        OpenAIClient client = OpenAIOkHttpClient.fromEnv();\n\n        BatchListPage page = client.batches().list();\n    }\n}"
            ruby: 'require "openai"


              openai = OpenAI::Client.new(api_key: "My API Key")


              page = openai.batches.list


              puts(page)'
          response: "{\n  \"object\": \"list\",\n  \"data\": [\n    {\n      \"id\": \"batch_abc123\",\n      \"object\": \"batch\",\n      \"endpoint\": \"/v1/chat/completions\",\n      \"errors\": null,\n      \"input_file_id\": \"file-abc123\",\n      \"completion_window\": \"24h\",\n      \"status\": \"completed\",\n      \"output_file_id\": \"file-cvaTdG\",\n      \"error_file_id\": \"file-HOWS94\",\n      \"created_at\": 1711471533,\n      \"in_progress_at\": 1711471538,\n      \"expires_at\": 1711557933,\n      \"finalizing_at\": 1711493133,\n      \"completed_at\": 1711493163,\n      \"failed_at\": null,\n      \"expired_at\": null,\n      \"cancelling_at\": null,\n      \"cancelled_at\": null,\n      \"request_counts\": {\n        \"total\": 100,\n        \"completed\": 95,\n        \"failed\": 5\n      },\n      \"metadata\": {\n        \"customer_id\": \"user_123456789\",\n        \"batch_description\": \"Nightly job\",\n      }\n    },\n    { ... },\n  ],\n  \"first_id\": \"batch_abc123\",\n  \"last_id\": \"batch_abc456\",\n  \"has_more\": true\n}\n"
  /batches/{batch_id}:
    get:
      operationId: retrieveBatch
      tags:
      - Batch
      summary: Retrieves a batch.
      parameters:
      - in: path
        name: batch_id
        required: true
        schema:
          type: string
        description: The ID of the batch to retrieve.
      responses:
        '200':
          description: Batch retrieved successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Batch'
      x-oaiMeta:
        name: Retrieve batch
        group: batch
        examples:
          request:
            curl: "curl https://api.openai.com/v1/batches/batch_abc123 \\\n  -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n  -H \"Content-Type: application/json\" \\\n"
            python: "import os\nfrom openai import OpenAI\n\nclient = OpenAI(\n    api_key=os.environ.get(\"OPENAI_API_KEY\"),  # This is the default and can be omitted\n)\nbatch = client.batches.retrieve(\n    \"batch_id\",\n)\nprint(batch.id)"
            javascript: "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n  const batch = await openai.batches.retrieve(\"batch_abc123\");\n\n  console.log(batch);\n}\n\nmain();\n"
            node.js: "import OpenAI from 'openai';\n\nconst client = new OpenAI({\n  apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted\n});\n\nconst batch = await client.batches.retrieve('batch_id');\n\nconsole.log(batch.id);"
            go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tbatch, err := client.Batches.Get(context.TODO(), \"batch_id\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", batch.ID)\n}\n"
            java: "package com.openai.example;\n\nimport com.openai.client.OpenAIClient;\nimport com.openai.client.okhttp.OpenAIOkHttpClient;\nimport com.openai.models.batches.Batch;\nimport com.openai.models.batches.BatchRetrieveParams;\n\npublic final class Main {\n    private Main() {}\n\n    public static void main(String[] args) {\n        OpenAIClient client = OpenAIOkHttpClient.fromEnv();\n\n        Batch batch = client.batches().retrieve(\"batch_id\");\n    }\n}"
            ruby: 'require "openai"


              openai = OpenAI::Client.new(api_key: "My API Key")


              batch = openai.batches.retrieve("batch_id")


              puts(batch)'
          response: "{\n  \"id\": \"batch_abc123\",\n  \"object\": \"batch\",\n  \"endpoint\": \"/v1/completions\",\n  \"errors\": null,\n  \"input_file_id\": \"file-abc123\",\n  \"completion_window\": \"24h\",\n  \"status\": \"completed\",\n  \"output_file_id\": \"file-cvaTdG\",\n  \"error_file_id\": \"file-HOWS94\",\n  \"created_at\": 1711471533,\n  \"in_progress_at\": 1711471538,\n  \"expires_at\": 1711557933,\n  \"finalizing_at\": 1711493133,\n  \"completed_at\": 1711493163,\n  \"failed_at\": null,\n  \"expired_at\": null,\n  \"cancelling_at\": null,\n  \"cancelled_at\": null,\n  \"request_counts\": {\n    \"total\": 100,\n    \"completed\": 95,\n    \"failed\": 5\n  },\n  \"metadata\": {\n    \"customer_id\": \"user_123456789\",\n    \"batch_description\": \"Nightly eval job\",\n  }\n}\n"
  /batches/{batch_id}/cancel:
    post:
      operationId: cancelBatch
      tags:
      - Batch
      summary: Cancels an in-progress batch. The batch will be in status `cancelling` for up to 10 minutes, before changing to `cancelled`, where it will have partial results (if any) available in the output file.
      parameters:
      - in: path
        name: batch_id
        required: true
        schema:
          type: string
        description: The ID of the batch to cancel.
      responses:
        '200':
          description: Batch is cancelling. Returns the cancelling batch's details.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Batch'
      x-oaiMeta:
        name: Cancel batch
        group: batch
        examples:
          request:
            curl: "curl https://api.openai.com/v1/batches/batch_abc123/cancel \\\n  -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n  -H \"Content-Type: application/json\" \\\n  -X POST\n"
            python: "import os\nfrom openai import OpenAI\n\nclient = OpenAI(\n    api_key=os.environ.get(\"OPENAI_API_KEY\"),  # This is the default and can be omitted\n)\nbatch = client.batches.cancel(\n    \"batch_id\",\n)\nprint(batch.id)"
            javascript: "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n  const batch = await openai.batches.cancel(\"batch_abc123\");\n\n  console.log(batch);\n}\n\nmain();\n"
            node.js: "import OpenAI from 'openai';\n\nconst client = new OpenAI({\n  apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted\n});\n\nconst batch = await client.batches.cancel('batch_id');\n\nconsole.log(batch.id);"
            go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tbatch, err := client.Batches.Cancel(context.TODO(), \"batch_id\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", batch.ID)\n}\n"
            java: "package com.openai.example;\n\nimport com.openai.client.OpenAIClient;\nimport com.openai.client.okhttp.OpenAIOkHttpClient;\nimport com.openai.models.batches.Batch;\nimport com.openai.models.batches.BatchCancelParams;\n\npublic final class Main {\n    private Main() {}\n\n    public static void main(String[] args) {\n        OpenAIClient client = OpenAIOkHttpClient.fromEnv();\n\n        Batch batch = client.batches().cancel(\"batch_id\");\n    }\n}"
            ruby: 'require "openai"


              openai = OpenAI::Client.new(api_key: "My API Key")


              batch = openai.batches.cancel("batch_id")


              puts(batch)'
          response: "{\n  \"id\": \"batch_abc123\",\n  \"object\": \"batch\",\n  \"endpoint\": \"/v1/chat/completions\",\n  \"errors\": null,\n  \"input_file_id\": \"file-abc123\",\n  \"completion_window\": \"24h\",\n  \"status\": \"cancelling\",\n  \"output_file_id\": null,\n  \"error_file_id\": null,\n  \"created_at\": 1711471533,\n  \"in_progress_at\": 1711471538,\n  \"expires_at\": 1711557933,\n  \"finalizing_at\": null,\n  \"completed_at\": null,\n  \"failed_at\": null,\n  \"expired_at\": null,\n  \"cancelling_at\": 1711475133,\n  \"cancelled_at\": null,\n  \"request_counts\": {\n    \"total\": 100,\n    \"completed\": 23,\n    \"failed\": 1\n  },\n  \"metadata\": {\n    \"customer_id\": \"user_123456789\",\n    \"batch_description\": \"Nightly eval job\",\n  }\n}\n"
components:
  schemas:
    Batch:
      type: object
      properties:
        id:
          type: string
        object:
          type: string
          enum:
          - batch
          description: The object type, which is always `batch`.
          x-stainless-const: true
        endpoint:
          type: string
          description: The OpenAI API endpoint used by the batch.
        model:
          type: string
          description: 'Model ID used to process the batch, like `gpt-5-2025-08-07`. OpenAI

            offers a wide range of models with different capabilities, performance

            characteristics, and price points. Refer to the [model

            guide](/docs/models) to browse and compare available models.

            '
        errors:
          type: object
          properties:
            object:
              type: string
              description: The object type, which is always `list`.
            data:
              type: array
              items:
                type: object
                properties:
                  code:
                    type: string
                    description: An error code identifying the error type.
                  message:
                    type: string
                    description: A human-readable message providing more details about the error.
                  param:
                    anyOf:
                    - type: string
                      description: The name of the parameter that caused the error, if applicable.
                    - type: 'null'
                  line:
                    anyOf:
                    - type: integer
                      description: The line number of the input file where the error occurred, if applicable.
                    - type: 'null'
        input_file_id:
          type: string
          description: The ID of the input file for the batch.
        completion_window:
          type: string
          description: The time frame within which the batch should be processed.
        status:
          type: string
          description: The current status of the batch.
          enum:
          - validating
          - failed
          - in_progress
          - finalizing
          - completed
          - expired
          - cancelling
          - cancelled
        output_file_id:
          type: string
          description: The ID of the file containing the outputs of successfully executed requests.
        error_file_id:
          type: string
          description: The ID of the file containing the outputs of requests with errors.
        created_at:
          type: integer
          format: unixtime
          description: The Unix timestamp (in seconds) for when the batch was created.
        in_progress_at:
          type: integer
          format: unixtime
          description: The Unix timestamp (in seconds) for when the batch started processing.
        expires_at:
          type: integer
          format: unixtime
          description: The Unix timestamp (in seconds) for when the batch will expire.
        finalizing_at:
          type: integer
          format: unixtime
          description: The Unix timestamp (in seconds) for when the batch started finalizing.
        completed_at:
          type: integer
          format: unixtime
          description: The Unix timestamp (in seconds) for when the batch was completed.
        failed_at:
          type: integer
          format: unixtime
          description: The Unix timestamp (in seconds) for when the batch failed.
        expired_at:
          type: integer
          format: unixtime
          description: The Unix timestamp (in seconds) for when the batch expired.
        cancelling_at:
          type: integer
          format: unixtime
          description: The Unix timestamp (in seconds) for when the batch started cancelling.
        cancelled_at:
          type: integer
          format: unixtime
          description: The Unix timestamp (in seconds) for when the batch was cancelled.
        request_counts:
          type: object
          properties:
            total:
              type: integer
              description: Total number of requests in the batch.
            completed:
              type: integer
              description: Number of requests that have been completed successfully.
            failed:
              type: integer
              description: Number of requests that have failed.
          required:
          - total
          - completed
          - failed
          description: The request counts for different statuses within the batch.
        usage:
          type: object
          description: 'Represents token usage details including input tokens, output tokens, a

            breakdown of output tokens, and the total tokens used. Only populated on

            batches created after September 7, 2025.

            '
          properties:
            input_tokens:
              type: integer
              description: The number of input tokens.
            input_tokens_details:
              type: object
              description: A detailed breakdown of the input tokens.
              properties:
                cached_tokens:
                  type: integer
                  description: 'The number of tokens that were retrieved from the cache. [More on

                    prompt caching](/docs/guides/prompt-caching).

                    '
              required:
              - cached_tokens
            output_tokens:
              type: integer
              description: The number of output tokens.
            output_tokens_details:
              type: object
              description: A detailed breakdown of the output tokens.
              properties:
                reasoning_tokens:
                  type: integer
                  description: The number of reasoning tokens.
              required:
              - reasoning_tokens
            total_tokens:
              type: integer
              description: The total number of tokens used.
          required:
          - input_tokens
          - input_tokens_details
          - output_tokens
          - output_tokens_details
          - total_tokens
        metadata:
          $ref: '#/components/schemas/Metadata'
      required:
      - id
      - object
      - endpoint
      - input_file_id
      - completion_window
      - status
      - created_at
      x-oaiMeta:
        name: The batch object
        example: "{\n  \"id\": \"batch_abc123\",\n  \"object\": \"batch\",\n  \"endpoint\": \"/v1/completions\",\n  \"model\": \"gpt-5-2025-08-07\",\n  \"errors\": null,\n  \"input_file_id\": \"file-abc123\",\n  \"completion_window\": \"24h\",\n  \"status\": \"completed\",\n  \"output_file_id\": \"file-cvaTdG\",\n  \"error_file_id\": \"file-HOWS94\",\n  \"created_at\": 1711471533,\n  \"in_progress_at\": 1711471538,\n  \"expires_at\": 1711557933,\n  \"finalizing_at\": 1711493133,\n  \"completed_at\": 1711493163,\n  \"failed_at\": null,\n  \"expired_at\": null,\n  \"cancelling_at\": null,\n  \"cancelled_at\": null,\n  \"request_counts\": {\n    \"total\": 100,\n    \"completed\": 95,\n    \"failed\": 5\n  },\n  \"usage\": {\n    \"input_tokens\": 1500,\n    \"input_tokens_details\": {\n      \"cached_tokens\": 1024\n    },\n    \"output_tokens\": 500,\n    \"output_tokens_details\": {\n      \"reasoning_tokens\": 300\n    },\n    \"total_tokens\": 2000\n  },\n  \"metadata\": {\n    \"customer_id\": \"user_123456789\",\n    \"batch_description\": \"Nightly eval job\",\n  }\n}\n"
    Metadata:
      anyOf:
      - type: object
        description: 'Set of 16 key-value pairs that can be attached to an object. This can be

          useful for storing additional information about the object in a structured

          format, and querying for objects via API or the dashboard.


          Keys are strings with a maximum length of 64 characters. Values are strings

          with a maximum length of 512 characters.

          '
        additionalProperties:
          type: string
        x-oaiTypeLabel: map
      - type: 'null'
    BatchFileExpirationAfter:
      type: object
      title: File expiration policy
      description: The expiration policy for the output and/or error file that are generated for a batch.
      properties:
        anchor:
          description: 'Anchor timestamp after which the expiration policy applies. Supported anchors: `created_at`. Note that the anchor is the file creation time, not the time the batch is created.'
          type: string
          enum:
          - created_at
          x-stainless-const: true
        seconds:
          description: The number of seconds after the anchor time that the file will expire. Must be between 3600 (1 hour) and 2592000 (30 days).
          type: integer
          format: int64
          minimum: 3600
          maximum: 2592000
      required:
      - anchor
      - seconds
    ListBatchesResponse:
      type: object
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/Batch'
        first_id:
          type: string
          example: batch_abc123
        last_id:
          type: string
          example: batch_abc456
        has_more:
          type: boolean
        object:
          type: string
          enum:
          - list
          x-stainless-const: true
      required:
      - object
      - data
      - has_more
  securitySchemes:
    ApiKeyAuth:
      type: http
      scheme: bearer
    AdminApiKeyAuth:
      type: http
      scheme: bearer
x-oaiMeta:
  navigationGroups:
  - id: responses
    title: Responses API
  - id: webhooks
    title: Webhooks
  - id: endpoints
    title: Platform APIs
  - id: vector_stores
    title: Vector stores
  - id: chatkit
    title: ChatKit
    beta: true
  - id: containers
    title: Containers
  - id: realtime
    title: Realtime
  - id: chat
    title: Chat Completions
  - id: assistants
    title: Assistants
    deprecated: true
  - id: administration
    title: Administration
  - id: legacy
    title: Legacy
  groups:
  - id: responses-streaming
    title: Streaming events
    description: 'When you [create a Response](/docs/api-reference/responses/create) with

      `stream` set to `true`, the server will emit server-sent events to the

      client as the Response is generated. This section contains the events that

      are emitted by the server.


      [Learn more about streaming responses](/docs/guides/streaming-responses?api-mode=responses).

      '
    navigationGroup: responses
    sections:
    - type: object
      key: ResponseCreatedEvent
      path: <auto>
    - type: object
      key: ResponseInProgressEvent
      path: <auto>
    - type: object
      key: ResponseCompletedEvent
      path: <auto>
    - type: object
      key: ResponseFailedEvent
      path: <auto>
    - type: object
      key: ResponseIncompleteEvent
      path: <auto>
    - type: object
      key: ResponseOutputItemAddedEvent
      path: <auto>
    - type: object
      key: ResponseOutputItemDoneEvent
      path: <auto>
    - type: object
      key: ResponseContentPartAddedEvent
      path: <auto>
    - type: object
      key: ResponseContentPartDoneEvent
      path: <auto>
    - type: object
      key: ResponseTextDeltaEvent
      path: response/output_text/delta
    - type: object
      key: ResponseTextDoneEvent
      path: response/output_text/done
    - type: object
      key: ResponseRefusalDeltaEvent
      path: <auto>
    - type: object
      key: ResponseRefusalDoneEvent
      path: <auto>
    - type: object
      key: ResponseFunctionCallArgumentsDeltaEvent
      path: <auto>
    - type: object
      key: ResponseFunctionCallArgumentsDoneEvent
      path: <auto>
    - type: object
      key: ResponseFileSearchCallInProgressEvent
      path: <auto>
    - type: object
      key: ResponseFileSearchCallSearchingEvent
      path: <auto>
    - type: object
      key: ResponseFileSearchCallCompletedEvent
      path: <auto>
    - type: object
      key: ResponseWebSearchCallInProgressEvent
      path: <auto>
    - type: object
      key: ResponseWebSearchCallSearchingEvent
      path: <auto>
    - type: object
      key: ResponseWebSearchCallCompletedEvent
      path: <auto>
    - type: object
      key: ResponseReasoningSummaryPartAddedEvent
      path: <auto>
    - type: object
      key: ResponseReasoningSummaryPartDoneEvent
      path: <auto>
    - type: object
      key: ResponseReasoningSummaryTextDeltaEvent
      path: <auto>
    - type: object
      key: ResponseReasoningSummaryTextDoneEvent
      path: <auto>
    - type: object
      key: ResponseReasoningTextDeltaEvent
      path: <auto>
    - type: object
      key: ResponseReasoningTextDoneEvent
      path: <auto>
    - type: object
      key: ResponseImageGenCallCompletedEvent
      path: <auto>
    - type: object
      key: ResponseImageGenCallGeneratingEvent
      path: <auto>
    - type: object
      key: ResponseImageGenCallInProgressEvent
      path: <auto>
    - type: object
      key: ResponseImageGenCallPartialImageEvent
      path: <auto>
    - type: object
      key: ResponseMCPCallArgumentsDeltaEvent
      path: <auto>
    - type: object
      key: ResponseMCPCallArgumentsDoneEvent
      path: <auto>
    - type: object
      key: ResponseMCPCallCompletedEvent
      path: <auto>
    - type: object
      key: ResponseMCPCallFailedEvent
      path: <auto>
    - type: object
      key: ResponseMCPCallInProgressEvent
      path: <auto>
    - type: object
      key: ResponseMCPListToolsCompletedEvent
      path: <auto>
    - type: object
      key: ResponseMCPListToolsFailedEvent
      path: <auto>
    - type: object
      key: ResponseMCPListToolsInProgressEvent
      path: <auto>
    - type: object
      key: ResponseCodeInterpreterCallInProgressEvent
      path: <auto>
    - type: object
      key: ResponseCodeInterpreterCallInterpretingEvent
      path: <auto>
    - type: object
      key: ResponseCodeInterpreterCallCompletedEvent
      path: <auto>
    - type: object
      key: ResponseCodeInterpreterCallCodeDeltaEvent
      path: <auto>
    - type: object
      key: ResponseCodeInterpreterCallCodeDoneEvent
      path: <auto>
    - type: object
      key: ResponseOutputTextAnnotationAddedEvent
      path: <auto>
    - type: object
      key: ResponseQueuedEvent
      path: <auto>
    - type: object
      key: ResponseCustomToolCallInputDeltaEvent
      path: <auto>
    - type: object
      key: ResponseCustomToolCallInputDoneEvent
      path: <auto>
    - type: object
      key: ResponseErrorEvent
      path: <auto>
  - id: webhook-events
    title: Webhook Events
    description: 'Webhooks are HTTP requests sent by OpenAI to a URL you specify when certain

      events happen during the course of API usage.


      [Learn more abou

# --- truncated at 32 KB (47 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/openai/refs/heads/main/openapi/openai-batch-api-openapi.yml