Ana içeriğe atla

Bu tarayıcı artık desteklenmiyor.

En son özelliklerden, güvenlik güncelleştirmelerinden ve teknik destekten faydalanmak için Microsoft Edge’e yükseltin.

Microsoft Edge'i indirin Internet Explorer ve Microsoft Edge hakkında daha fazla bilgi
microsoft-foundry.rest.security.o-auth2-auth

Batch

Get a batch

GET /openai/v1/batches/{batch_id}

Retrieves a batch by its identifier.

Yol parametreleri

batch_id string gerekli

The ID of the batch to retrieve.

Yanıtlar

The request has succeeded.

Gövde

Content-Type: application/json
id string gerekli
object enum gerekli

The object type, which is always batch.

batch
endpoint string gerekli

The OpenAI API endpoint used by the batch.

model string

Model ID used to process the batch, like gpt-6-astra. OpenAI offers a wide range of models with different capabilities, performance characteristics, and price points. Refer to the model guide to browse and compare available models.

errors OpenAI.BatchErrors | null
object string
data OpenAI.BatchError[]
input_file_id string gerekli

The ID of the input file for the batch.

completion_window string gerekli

The time frame within which the batch should be processed.

status enum gerekli

The current status of the batch.

validatingfailedin_progressfinalizingcompletedexpiredcancellingcancelled
output_file_id string | null

The ID of the file containing the outputs of successfully executed requests.

error_file_id string | null

The ID of the file containing the outputs of requests with errors.

created_at integer gerekli

The Unix timestamp (in seconds) for when the batch was created.

in_progress_at integer | null

The Unix timestamp (in seconds) for when the batch started processing.

expires_at integer | null

The Unix timestamp (in seconds) for when the batch will expire.

finalizing_at integer | null

The Unix timestamp (in seconds) for when the batch started finalizing.

completed_at integer | null

The Unix timestamp (in seconds) for when the batch was completed.

failed_at integer | null

The Unix timestamp (in seconds) for when the batch failed.

expired_at integer | null

The Unix timestamp (in seconds) for when the batch expired.

cancelling_at integer | null

The Unix timestamp (in seconds) for when the batch started cancelling.

cancelled_at integer | null

The Unix timestamp (in seconds) for when the batch was cancelled.

request_counts OpenAI.BatchRequestCounts

The request counts for different statuses within the batch.

total integer gerekli
completed integer gerekli
failed integer gerekli
usage OpenAI.BatchUsage
input_tokens integer gerekli
input_tokens_details OpenAI.BatchUsageInputTokensDetails gerekli
cached_tokens integer gerekli
output_tokens integer gerekli
output_tokens_details OpenAI.BatchUsageOutputTokensDetails gerekli
reasoning_tokens integer gerekli
total_tokens integer gerekli
metadata OpenAI.Metadata | null

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.

[key: string] string

Client error

Gövde

Content-Type: application/json
error OpenAI.Error gerekli
code string | null gerekli
message string gerekli
param string | null
type string
misalignment OpenAI.MisalignmentErrorDetailsResource
review_target string | null
error_type string | enum
Aşağıdakilerden biri:
string
enum
potentially_unintended_data_transferpotentially_unintended_data_accesspotentially_unintended_destructive_activityother
detailed_explanation string

The public explanation for this block.

steer OpenAI._MisalignmentSteer
message string gerekli

The public continuation instruction.

details OpenAI.Error[]
additionalInfo object
debugInfo object

Server error

Gövde

Content-Type: application/json
error OpenAI.Error gerekli
code string | null gerekli
message string gerekli
param string | null
type string
misalignment OpenAI.MisalignmentErrorDetailsResource
review_target string | null
error_type string | enum
Aşağıdakilerden biri:
string
enum
potentially_unintended_data_transferpotentially_unintended_data_accesspotentially_unintended_destructive_activityother
detailed_explanation string

The public explanation for this block.

steer OpenAI._MisalignmentSteer
message string gerekli

The public continuation instruction.

details OpenAI.Error[]
additionalInfo object
debugInfo object

İstek

curl https://api.openai.com/v1/batches/batch_abc123 \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -H "Content-Type: application/json" \
import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ.get("OPENAI_API_KEY"),  # This is the default and can be omitted
)
batch = client.batches.retrieve(
    "batch_id",
)
print(batch.id)
import OpenAI from "openai";

const openai = new OpenAI();

async function main() {
  const batch = await openai.batches.retrieve("batch_abc123");

  console.log(batch);
}

main();
import OpenAI from 'openai';

const client = new OpenAI({
  apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted
});

const batch = await client.batches.retrieve('batch_id');

console.log(batch.id);
package main

import (
    "context"
    "fmt"

    "github.com/openai/openai-go"
    "github.com/openai/openai-go/option"
)

func main() {
    client := openai.NewClient(
        option.WithAPIKey("My API Key"),
    )
    batch, err := client.Batches.Get(context.TODO(), "batch_id")
    if err != nil {
        panic(err.Error())
    }
    fmt.Printf("%+v
", batch.ID)
}
package com.openai.example;

import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.batches.Batch;
import com.openai.models.batches.BatchRetrieveParams;

public final class Main {
    private Main() {}

    public static void main(String[] args) {
        OpenAIClient client = OpenAIOkHttpClient.fromEnv();

        Batch batch = client.batches().retrieve("batch_id");
    }
}
require "openai"

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

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

puts(batch)

Response

{
  "id": "batch_abc123",
  "object": "batch",
  "endpoint": "/v1/completions",
  "errors": null,
  "input_file_id": "file-abc123",
  "completion_window": "24h",
  "status": "completed",
  "output_file_id": "file-cvaTdG",
  "error_file_id": "file-HOWS94",
  "created_at": 1711471533,
  "in_progress_at": 1711471538,
  "expires_at": 1711557933,
  "finalizing_at": 1711493133,
  "completed_at": 1711493163,
  "failed_at": null,
  "expired_at": null,
  "cancelling_at": null,
  "cancelled_at": null,
  "request_counts": {
    "total": 100,
    "completed": 95,
    "failed": 5
  },
  "metadata": {
    "customer_id": "user_123456789",
    "batch_description": "Nightly eval job",
  }
}
tr-tr
Gizlilik Tercihleriniz
  • AI Bildirim
  • Önceki Sürümler
  • Blog
  • Katkıda Bulunun
  • Gizlilik
  • Tüketici Sağlığı Gizliliği
  • Kullanım Koşulları
  • Ticari Markalar
  • © Microsoft 2026