Reference · Snippet · python

OpenAI batch embeddings

openaiembeddingsbatch

# Pseudocode — use provider batch API for large offline index builds
from openai import OpenAI

client = OpenAI()
# 1. Upload JSONL of {"custom_id": "...", "method": "POST", "url": "/v1/embeddings", ...}
# 2. client.batches.create(input_file_id=..., endpoint="/v1/embeddings", completion_window="24h")
# 3. Poll batch status; download output_file when complete