Batch

Returns a batch with its status and request counts. Batches in a terminal status include results. Failed batches report the reason in error.message. See the Batch API Quickstart.

get/batches/{id}

Request

  • Base URL
    https://openrouter.ai/api/v1
  • Auth
    HTTP bearer

Path parameters

id, string required

The batch job id returned from submit.

Example:batch_abc123

Response

The current batch job status.

BatchObject required
completion_window, '24h' required
created_at, integer required
endpoint, string required
error, object nullable required
expires_at, integer nullable required

Unix timestamp after which the assigned provider no longer completes unfinished requests. Derived from the provider's documented batch window, so it can exceed created_at plus completion_window (Google Vertex can take up to 96 hours). null when the provider documents no hard expiry.

finalized_at, integer nullable required
id, string required
model, string required
object, 'batch' required
output, BatchOutputReference

The output location of a batch submitted with input, whose results are null. Returned only by GET /batches/{id}, once the batch has ended and the provider reported an output folder or table. Batch lists and responses for a batch with an unpaid charge leave it out.

provider, string nullable required

Provider OpenRouter assigned to run the batch, using the same name as the provider field of sync responses.

request_counts, object required
results, BatchResult[] nullable required
status, 'validating' | 'in_progress' | 'finalizing' | 'completed' | 'failed' | 'expired' | 'cancelling' | 'cancelled' required
usage, object nullable required

Example response

{
  "output": {
    "uri": "gs://my-bucket/openrouter-batch/output/org_abc/batch_123/batch_123/prediction-model-2026-01-01T00:00:00.000000Z"
  },
  "results": [
    {
      "error": {
        "error_type": "rate_limit_exceeded"
      },
      "response": {
        "body": {
          "alignment": {
            "calls": [
              {
                "call": 1,
                "outcome": "allowed",
                "rules": [
                  {
                    "applicable": true,
                    "broken": false,
                    "probability": 0.04
                  }
                ]
              }
            ]
          },
          "choices": [
            {
              "finish_reason": "stop",
              "message": {
                "annotations": [
                  {
                    "file": {
                      "content": [
                        {
                          "text": "Quarterly revenue grew 12%.",
                          "type": "text"
                        }
                      ],
                      "hash": "abc123",
                      "name": "report.pdf"
                    },
                    "type": "file"
                  }
                ],
                "reasoning_details": [
                  {
                    "summary": "The model analyzed the problem by first identifying key constraints, then evaluating possible solutions...",
                    "type": "reasoning.summary"
                  }
                ]
              }
            }
          ],
          "openrouter_metadata": {
            "attempt": 1,
            "endpoints": {
              "available": [
                {
                  "model": "openai/gpt-4o",
                  "provider": "OpenAI",
                  "selected": true
                }
              ],
              "total": 1
            },
            "generation_time": 2016,
            "is_byok": false,
            "region": "iad",
            "requested": "openai/gpt-4o",
            "strategy": "direct",
            "summary": "available=1, selected=OpenAI"
          },
          "safeguard_results": [
            {
              "status": {
                "tool_uses": {
                  "call_abc": {
                    "explanation": "[Data Exfiltration]",
                    "outcome": "flagged",
                    "type": "evaluated"
                  },
                  "call_def": {
                    "outcome": "not_flagged",
                    "type": "evaluated"
                  }
                },
                "type": "available"
              },
              "type": "dangerous_tool_use"
            }
          ]
        }
      }
    }
  ],
  "usage": {
    "cache_creation": {
      "ephemeral_1h_input_tokens": 0,
      "ephemeral_5m_input_tokens": 100
    },
    "cost_details": {
      "upstream_inference_completions_cost": 0.0004,
      "upstream_inference_cost": null,
      "upstream_inference_prompt_cost": 0.0008
    },
    "iterations": [
      {
        "cache_creation": null,
        "cache_creation_input_tokens": 0,
        "cache_read_input_tokens": 0,
        "input_tokens": 50,
        "output_tokens": 25,
        "type": "compaction"
      }
    ],
    "speed": "standard"
  }
}

Changes

    • info

      added the optional property results/items/response/body/anyOf[#/components/schemas/BatchImageGenerationResponse]/id to the response with the status

    • warning

      added the new bedrock-amazon-responses-v1 enum value to the results/items/response/body/anyOf[#/components/schemas/OpenResponsesResult]/allOf[subschema #2]/output/items/oneOf[#/components/schemas/OutputReasoningItem]/allOf[subschema #2]/format response property for the response status

    • warning

      added the new bedrock-amazon-responses-v1 enum value to the results/items/response/body/anyOf[subschema #1]/choices/items/message/reasoning_details/items/anyOf[#/components/schemas/ReasoningDetailEncrypted]/format response property for the response status

    3 more changes in this revision