Skip to content

Endpoints

Every DirectInference request goes to one host with one key. This page is the full URL map across all three API surfaces plus the account & billing REST API. Each surface has a dedicated guide with request and response detail — the links are below each table.

The advertised, API-only host is https://api.directinference.com. Every endpoint sits under the zero-knowledge DI base path /di. The authentication header is the one your client already uses for that vendor — point it at DirectInference and pass an llm_live_… key.

SurfaceBase URLAuth header
OpenAI-compatiblehttps://api.directinference.com/di/v1Authorization: Bearer llm_live_…
Anthropic Messageshttps://api.directinference.com/dithe SDK appends /v1/messagesx-api-key: llm_live_… (or Authorization: Bearer)
Geminihttps://api.directinference.com/dithe SDK appends /v1beta/models/…x-goog-api-key: llm_live_… (or ?key= / Authorization: Bearer)

Full per-surface auth detail — including the header each SDK sets for you — is in Authentication.

MethodEndpointPurpose
POSThttps://api.directinference.com/di/v1/chat/completionsChat Completions. Stream with "stream": true.
POSThttps://api.directinference.com/di/v1/responsesResponses API (served statelessly).
GEThttps://api.directinference.com/di/v1/modelsList the DI Model — di-fusion, di-saver, di-max.

Request and response detail, including tools, vision, structured output, and supported parameters, is in the OpenAI-compatible guide.

MethodEndpointPurpose
POSThttps://api.directinference.com/di/v1/messagesMessages API. Stream with "stream": true.
POSThttps://api.directinference.com/di/v1/messages/count_tokensCount tokens for a Messages request.
GEThttps://api.directinference.com/di/v1/modelsList models. client.models.list() reads this in the Anthropic models shape.

Full detail — tool_use, streaming, cache_control, and the response envelope — is in the Anthropic Messages guide.

The model and method live in the URL path — models/{model}:method — not the body. Any {model} id (for example gemini-2.5-flash) is accepted and echoed back as modelVersion.

MethodEndpointPurpose
POSThttps://api.directinference.com/di/v1beta/models/{model}:generateContentGenerate content.
POSThttps://api.directinference.com/di/v1beta/models/{model}:streamGenerateContent?alt=sseStreaming generate content (SSE).
POSThttps://api.directinference.com/di/v1beta/models/{model}:countTokensCount tokens.
GEThttps://api.directinference.com/di/v1beta/modelsList models.

Full detail — function calling, streaming, and countTokens — is in the Gemini guide.

GET /di/v1/models lists the DI Model three ways: di-fusion (the default), plus di-saver and di-max — the same model with the effort knob pinned low and high, not separate models. Every entry carries root: "di-fusion". Listing requires authentication.

Terminal window
curl https://api.directinference.com/di/v1/models \
-H "Authorization: Bearer llm_live_..."

A successful response (abridged):

{
"object": "list",
"data": [
{
"id": "di-fusion",
"object": "model",
"owned_by": "direct-inference",
"root": "di-fusion",
"context_length": 262144,
"top_provider": { "context_length": 262144, "max_completion_tokens": 32768 },
"supported_parameters": [
"max_tokens", "temperature", "top_p", "stop", "stream",
"response_format", "reasoning_effort", "reasoning", "tools", "tool_choice"
]
},
{ "id": "di-saver", "object": "model", "root": "di-fusion", "...": "same shape" },
{ "id": "di-max", "object": "model", "root": "di-fusion", "...": "same shape" }
]
}

A small read-only REST API reports balance and usage. It is account-scoped to the calling key and zero-knowledge — costs come back in USD, and no backend model, provider, or upstream price is ever exposed.

MethodEndpointPurpose
GEThttps://api.directinference.com/di/v1/creditsPrepaid balance and total used.
GEThttps://api.directinference.com/di/v1/usageAggregate usage; group_by of day, request_type, application, or api_key, with optional start_date / end_date.
GEThttps://api.directinference.com/di/v1/generation?id=<completion-id>Cost and token usage for one request, keyed by its response id.
Terminal window
curl https://api.directinference.com/di/v1/credits \
-H "Authorization: Bearer llm_live_..."
# {"balance":"9.800000","total_used":"0.200000"}

See Spend & limits for caps and the balance lifecycle, and Usage & analytics for the in-portal breakdown.

Rate a response your application received, keyed by the id on the completion your code already holds — the same id accepted by GET /v1/generation. It is one REST call, no SDK required.

MethodEndpointPurpose
POSThttps://api.directinference.com/di/v1/feedbackRecord a thumbs up / down (plus optional comment, labels, and an opaque end-user id) on one response.
Terminal window
curl https://api.directinference.com/di/v1/feedback \
-H "Authorization: Bearer llm_live_..." \
-H "Content-Type: application/json" \
-d '{
"id": "chatcmpl-abc123",
"rating": "up",
"comment": "resolved the ticket cleanly",
"labels": {"category": "support", "helpful": true},
"end_user": "acct_7f3a"
}'
# {"object":"feedback","id":"chatcmpl-abc123","rating":"up","recorded":true,"end_user":"acct_7f3a"}
  • id (required) is the response id you received; rating (required) is up or down.
  • comment is free text; labels is a flat object of string / number / boolean annotations; end_user is any opaque string you use to attribute the rating — DI never learns who your users are.
  • Re-submitting for the same (id, end_user) updates the existing rating rather than adding a duplicate.
  • An unknown or foreign id returns 404; a response older than 30 days returns 409. The endpoint is zero-knowledge and does not count toward usage.

Each surface returns its native error envelope, and authentication, rate-limit, and spend-cap behavior is shared. Status codes (400, 401, 402, 413, 429, 5xx) and retry guidance are in Errors & limits; the observability headers every response carries are in Response headers.