API reference

Batch

Jobs at batch rates, submitted through chat completions.

On this page

POST/v1/chat/completions

Append :batch to a model with batch rates. The hold is taken now and settled when the job ends.

Auth: API key: Authorization: Bearer sk_…

NameTypeRequiredDescription
modelstringYesA model id with :batch appended.
messagesarrayYesThe conversation.
webhook_urlstringNoCalled when the job ends.

POST /v1/chat/completions

curl
curl -X POST https://api.usdf.fi/v1/chat/completions \
  -H "Authorization: Bearer $USDF_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "<model>:batch",
    "messages": [{"role": "user", "content": "Hello"}],
    "max_tokens": 256,
    "webhook_url": "https://example.com/usdf-hooks"
  }'

Response, trimmed

{
  "object": "batch.job",
  "id": "batch_…",
  "status": "submitted",
  "rate": "batch",
  "hold": { "units": "<units>", "usd": "<usd>", "usdf": "<usdf>" },
  "poll": "https://api.usdf.fi/v1/batches/batch_…",
  "result": "https://api.usdf.fi/v1/batches/batch_…/result"
}

GET/v1/batches/{id}

The job's status.

Auth: API key: Authorization: Bearer sk_…

NameTypeRequiredDescription
idstringYesPath. The batch id.

GET /v1/batches/{id}

curl
curl https://api.usdf.fi/v1/batches/{id} \
  -H "Authorization: Bearer $USDF_API_KEY"

GET/v1/batches/{id}/result

The finished job's output.

Auth: API key: Authorization: Bearer sk_…

NameTypeRequiredDescription
idstringYesPath. The batch id.

GET /v1/batches/{id}/result

curl
curl https://api.usdf.fi/v1/batches/{id}/result \
  -H "Authorization: Bearer $USDF_API_KEY"