Example Usage
import { BatchObject } from "@openrouter/sdk/models";
let value: BatchObject = {
completionWindow: "24h",
createdAt: 931790,
endpoint: "<value>",
error: {
message: "<value>",
},
expiresAt: 113361,
finalizedAt: 325090,
id: "<id>",
model: "El Camino",
object: "batch",
provider: "<value>",
requestCounts: {
completed: 393587,
failed: 626049,
total: 108649,
},
results: [],
status: "cancelled",
usage: {
completionTokens: 401122,
promptTokens: 291986,
totalTokens: 319092,
},
};
Fields
| Field | Type | Required | Description |
|---|---|---|---|
completionWindow | models.BatchObjectCompletionWindow | ✔️ | N/A |
createdAt | number | ✔️ | N/A |
endpoint | string | ✔️ | N/A |
error | models.BatchObjectError | ✔️ | N/A |
expiresAt | number | ✔️ | 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. |
finalizedAt | number | ✔️ | N/A |
id | string | ✔️ | N/A |
model | string | ✔️ | N/A |
object | models.BatchObjectObjectBatch | ✔️ | N/A |
provider | string | ✔️ | Provider OpenRouter assigned to run the batch, using the same name as the provider field of sync responses. |
requestCounts | models.BatchObjectRequestCounts | ✔️ | N/A |
results | models.Result[] | ✔️ | N/A |
status | models.BatchObjectStatus | ✔️ | N/A |
usage | models.BatchObjectUsage | ✔️ | N/A |