Provider Payload & Rate-Limit Traps That Break Backfill Jobs
Fixed-count batching (batch_size = 250 or batch_size = 1000) crashes in production because chunk token lengths follow a heavy-tailed distribution:
| Provider & Endpoint | Max Texts / Request | Max Total Tokens / Request | Synchronous Rate Ceiling | Async Batch Caveat |
|---|---|---|---|---|
Vertex AI gemini-embedding-001 |
250 (often 100 on Gemini API) |
~20,000 aggregate tokens |
Quota-bound QPM / TPM (429 RESOURCE_EXHAUSTED) |
GCS JSONL staging + async polling |
OpenAI text-embedding-3-large |
2,048 |
300,000 aggregate tokens |
Tier-bound (1M - 10M TPM; 429 bursts) |
50% discount ($0.065/1M), up to 24h SLA |
Voxell Forge Turbo (1024d) |
OpenAI-compatible | High-throughput streaming batches | 100 Free -> 5,000 RPM (Scale) |
$0 forever synchronously (no 24h queue) |
Voxell Forge Pro (2560d) |
OpenAI-compatible | High-throughput streaming batches | 600 Builder / 2,000 Team / 5,000 RPM Scale |
$0.25/1M (87 ms P50 synchronous) |
Sending 100 chunks averaging 350 tokens (35,000 tokens total) to Vertex AI gemini-embedding-001 blows past the 20,000-token request cap with HTTP 400, even though 100 < 250 items and 350 < 2,048 tokens per item!
Runnable Fix: Dual-Cap Token Packer + SHA-256 Content-Addressable Deduplicator (Go)
Hash SHA-256(model + ":" + dim + ":" + canonical_text) before hitting the network so unchanged paragraphs across edited files and duplicate boilerplate blocks ("Copyright 2026...") are embedded at most once per batch and cached in Postgres/Redis:
package batchpack
import (
"crypto/sha256"
"encoding/hex"
"fmt"
"strings"
)
type Chunk struct {
ID string
Text string
Tokens int // Pre-counted via tiktoken / SentencePiece
}
type PackedBatch struct {
Hashes []string
Texts []string
Tokens int
}
func ContentHash(model string, dim int, text string) string {
norm := strings.Join(strings.Fields(text), " ")
sum := sha256.Sum256([]byte(fmt.Sprintf("%s:%d:%s", model, dim, norm)))
return hex.EncodeToString(sum[:])
}
// PackBatches enforces BOTH maxItems (e.g. 200 for Vertex) AND maxBatchTokens (e.g. 18000 for Vertex, 250000 for OpenAI),
// while deduplicating identical chunks inside the backfill stream.
func PackBatches(chunks []Chunk, model string, dim, maxItems, maxBatchTokens int, seen map[string]bool) []PackedBatch {
var batches []PackedBatch
var cur PackedBatch
flush := func() {
if len(cur.Texts) > 0 {
batches = append(batches, cur)
cur = PackedBatch{}
}
}
for _, c := range chunks {
h := ContentHash(model, dim, c.Text)
if seen[h] {
continue // 70%+ of incremental sync chunks short-circuit right here
}
seen[h] = true
if len(cur.Texts) >= maxItems || (cur.Tokens+c.Tokens) > maxBatchTokens {
flush()
}
cur.Hashes = append(cur.Hashes, h)
cur.Texts = append(cur.Texts, c.Text)
cur.Tokens += c.Tokens
}
flush()
return batches
}
Pair PackBatches with full-jitter exponential backoff (sleep = rand.Float64() * min(30s, 500ms * 2^attempt)) honoring Retry-After / x-ratelimit-reset-tokens headers on HTTP 429.
Drop the 24-Hour Batch Queue: Synchronous $0 Turbo & High-RPM Pro
Waiting 24 hours on OpenAI’s async Batch API just to save $0.065/1M tokens breaks real-time customer onboarding and CI documentation previews. Point base_url at https://api.voxell.ai/v1 to embed synchronously on Turbo 1024d at $0 forever, scale up to 5,000 RPM / 3,000,000 TPM on Scale ($499/mo annual), or run completely unmetered inside your own AWS account with Forge Local Sovereign VPC ($9,995/yr Dev; $29,995/yr Prod). Test live latency right now:
curl -sS -X POST https://api.voxell.ai/api/v1/agent/bakeoff \
-H "Content-Type: application/json" \
-d '{
"documents": [
{"name": "vertex-limits.md", "text": "Vertex AI gemini-embedding-001 enforces a 250-input limit and ~20,000 aggregate token cap per request."},
{"name": "forge-limits.md", "text": "Voxell Forge Turbo 1024d embeds synchronously at $0 per 1M tokens forever, scaling up to 5,000 RPM on Scale."}
],
"queries": ["What aggregate token cap per request applies to Vertex AI gemini-embedding-001?"]
}'
Model annual re-indexing multipliers (1x to 12x/yr) in the Vector RAM & TCO Calculator, review OpenAI Migration Steps, or open the Forge Console (v4.0 Pricing).