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

# Cancel Openai Batch



## OpenAPI

````yaml https://api.deepinfra.com/openapi.json post /v1/batches/{batch_id}/cancel
openapi: 3.1.0
info:
  title: DeepInfra API
  description: >-
    The DeepInfra API provides serverless AI inference, custom model
    deployments, and GPU rentals.
  version: 1.0.0
servers:
  - url: https://api.deepinfra.com
security: []
tags:
  - name: Chat Completions
    description: OpenAI and Anthropic-compatible chat completion endpoints for LLMs.
  - name: Text Completions
    description: OpenAI-compatible text completion endpoints.
  - name: Embeddings
    description: Generate text embeddings for search and RAG.
  - name: Image Generation
    description: Generate, edit, and create variations of images.
  - name: Audio
    description: OpenAI-compatible speech synthesis, transcription, and translation.
  - name: Text to Speech
    description: ElevenLabs-compatible TTS endpoints and voice management.
  - name: Inference
    description: Native DeepInfra inference API for models and deployments.
  - name: Dedicated Models
    description: Deploy and manage private model instances with autoscaling.
  - name: GPU Rentals
    description: Rent dedicated GPU containers.
  - name: Models
    description: Browse, search, and manage AI models.
  - name: Files & Batches
    description: File uploads and batch processing.
  - name: LoRA Adapters
    description: Create, manage, and query LoRA adapter models.
  - name: Agents
    description: Manage agent-framework instances (OpenClaw and friends).
  - name: Sandboxes
    description: Create and manage isolated sandbox environments.
  - name: Account
    description: User profile, team management, and rate limits.
  - name: Authentication
    description: API tokens, SSH keys, scoped JWTs, and login flows.
  - name: Billing
    description: Payment methods, usage tracking, and billing.
  - name: Logs & Metrics
    description: Query inference logs, deployment logs, and usage metrics.
  - name: Utilities
    description: Feedback submission and CLI version.
paths:
  /v1/batches/{batch_id}/cancel:
    post:
      tags:
        - Files & Batches
      summary: Cancel Openai Batch
      operationId: cancel_openai_batch_v1_batches__batch_id__cancel_post
      parameters:
        - name: batch_id
          in: path
          required: true
          schema:
            type: string
            title: Batch Id
        - name: xi-api-key
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Xi-Api-Key
        - name: x-api-key
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: X-Api-Key
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OpenAIBatchesOut'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - HTTPBearer: []
components:
  schemas:
    OpenAIBatchesOut:
      properties:
        id:
          type: string
          title: Id
          description: The batch ID.
        object:
          type: string
          const: batch
          title: Object
          description: The object type, which is always batch.
          default: batch
        endpoint:
          type: string
          title: Endpoint
          description: The API endpoint used for the batch.
        errors:
          anyOf:
            - $ref: '#/components/schemas/BatchErrors'
            - type: 'null'
          description: Errors that occurred during the batch.
        input_file_id:
          type: string
          title: Input File Id
          description: The ID of the input file for the batch.
        completion_window:
          type: string
          title: Completion Window
          description: The time frame within which the batch should be processed.
        status:
          type: string
          title: Status
          description: The current status of the batch.
        output_file_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Output File Id
          description: The ID of the output file.
        error_file_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Error File Id
          description: The ID of the error file.
        created_at:
          type: integer
          title: Created At
          description: The Unix timestamp of when the batch was created.
        in_progress_at:
          anyOf:
            - type: integer
            - type: 'null'
          title: In Progress At
          description: The Unix timestamp of when the batch started processing.
        expires_at:
          type: integer
          title: Expires At
          description: The Unix timestamp of when the batch will expire.
        finalizing_at:
          anyOf:
            - type: integer
            - type: 'null'
          title: Finalizing At
          description: The Unix timestamp of when the batch started finalizing.
        completed_at:
          anyOf:
            - type: integer
            - type: 'null'
          title: Completed At
          description: The Unix timestamp of when the batch completed.
        failed_at:
          anyOf:
            - type: integer
            - type: 'null'
          title: Failed At
          description: The Unix timestamp of when the batch failed.
        expired_at:
          anyOf:
            - type: integer
            - type: 'null'
          title: Expired At
          description: The Unix timestamp of when the batch expired.
        cancelling_at:
          anyOf:
            - type: integer
            - type: 'null'
          title: Cancelling At
          description: The Unix timestamp of when the batch started cancelling.
        cancelled_at:
          anyOf:
            - type: integer
            - type: 'null'
          title: Cancelled At
          description: The Unix timestamp of when the batch was cancelled.
        request_counts:
          anyOf:
            - $ref: '#/components/schemas/BatchRequestCounts'
            - type: 'null'
          description: Request counts for the batch.
        metadata:
          anyOf:
            - additionalProperties:
                type: string
              type: object
            - type: 'null'
          title: Metadata
          description: Metadata associated with the batch.
        model:
          anyOf:
            - type: string
            - type: 'null'
          title: Model
          description: The model used for the batch.
        usage:
          anyOf:
            - $ref: '#/components/schemas/BatchUsage'
            - type: 'null'
          description: Token usage accumulated for the batch.
      type: object
      required:
        - id
        - endpoint
        - input_file_id
        - completion_window
        - status
        - created_at
        - expires_at
      title: OpenAIBatchesOut
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    BatchErrors:
      properties:
        object:
          type: string
          title: Object
          description: The object type, which is always list.
          default: list
        data:
          items:
            $ref: '#/components/schemas/BatchErrorData'
          type: array
          title: Data
          description: List of error objects.
      type: object
      title: BatchErrors
    BatchRequestCounts:
      properties:
        total:
          type: integer
          title: Total
          description: Total number of requests in the batch.
          default: 0
        completed:
          type: integer
          title: Completed
          description: Number of requests that completed successfully.
          default: 0
        failed:
          type: integer
          title: Failed
          description: Number of requests that failed.
          default: 0
      type: object
      title: BatchRequestCounts
    BatchUsage:
      properties:
        input_tokens:
          type: integer
          title: Input Tokens
          default: 0
        input_tokens_details:
          $ref: '#/components/schemas/BatchInputTokensDetails'
        output_tokens:
          type: integer
          title: Output Tokens
          default: 0
        output_tokens_details:
          $ref: '#/components/schemas/BatchOutputTokensDetails'
        total_tokens:
          type: integer
          title: Total Tokens
          default: 0
      type: object
      title: BatchUsage
    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
    BatchErrorData:
      properties:
        code:
          anyOf:
            - type: string
            - type: 'null'
          title: Code
          description: An error code identifying the error type.
        line:
          anyOf:
            - type: integer
            - type: 'null'
          title: Line
          description: The line number of the input file where the error occurred.
        message:
          anyOf:
            - type: string
            - type: 'null'
          title: Message
          description: A human-readable message describing the error.
        param:
          anyOf:
            - type: string
            - type: 'null'
          title: Param
          description: The name of the parameter that caused the error.
      type: object
      title: BatchErrorData
    BatchInputTokensDetails:
      properties:
        cached_tokens:
          type: integer
          title: Cached Tokens
          default: 0
      type: object
      title: BatchInputTokensDetails
    BatchOutputTokensDetails:
      properties:
        reasoning_tokens:
          type: integer
          title: Reasoning Tokens
          default: 0
      type: object
      title: BatchOutputTokensDetails
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer

````