Scheduling batches and handling slow models
Some open models scale to zero between uses. Their first request may wait while the model wakes.
Plan for a cold start
An engine page shows its typical wait and wake fee when cold starts apply. Mobile means the lightweight model; its catalog example is typically ~8 s wait. The time is a guide, not a live sleep indicator or deadline: queueing, capacity, waking and model loading can make individual requests slower. Once the model is warm, later pages pay the page price without another wake fee. Requests queued during the same wake also pay only their page price.
A successful first request that wakes the worker can pay one wake fee. A batch pays at most one fee, even when it contains many pages or crosses another worker start. The quote should show page total plus one possible wake fee before submission; the receipt shows the actual fee. Check the selected model and quote before submitting work.
Submit pages together
For a set of pages, use a batch instead of sending isolated requests over time. This lets the pages share a warm worker and keeps the batch to at most one wake fee. For work that need not finish in the current connection, use async mode and retrieve the result later.
See the endpoint reference for batch submission and async result retrieval.
Follow a request to its result
Keep the request ID from submission. Queued means the request has not started provider work; processing can include waking and model loading. These phases do not promise a live countdown. Poll the existing result endpoint for the final state and receipt. If settlement is pending, wait for the final receipt before treating it as complete or submitting again.
If capacity is full, choose another model yourself or try again later. Queue cancellation before dispatch is free; after dispatch it is best effort, so check the receipt. A timeout may have an unknown outcome: look up the original request before retrying. With OCR history off, text can become unavailable after the first delivery. A result_not_retained response still carries the receipt; it cannot recreate the text.
Pre-warm before a batch
If you know which engine your batch will use, call its warm endpoint shortly before submission. Warming incurs the engine's wake fee only if that call starts a cold model. It does not reserve capacity indefinitely; an idle model can scale down again.
curl -X POST https://api.open-ocr.com/v1/engines/ENGINE_ID/warm \
-H "Authorization: Bearer sk-ocr-YOUR_KEY" \
-H "Idempotency-Key: YOUR_UNIQUE_KEY"Read the wake notice
A response that woke a model includes a public cold_start block with wait_seconds (provider HTTP wall time for the waking call), model_load_seconds (model construction time) within that wait, whether it woke the worker, and the actual wake fee. The warning states the wait for that request or warm-up call and suggests batching or async mode. Keep this notice with the result when you display or store it. A warm response has no wake charge.
If initialization or the first inference fails, no wake fee is charged. OpenOCR absorbs that wake cost; a later request served by the now-warm model is not charged for it.