Skip to main content
The @standardagents/deepinfra package is the first-party DeepInfra provider for Standard Agents. It targets DeepInfra’s OpenAI-compatible Chat Completions API and reads model capabilities and per-million-token prices from the live public catalog.

Install

Scaffolded projects already include the package. Set DEEPINFRA_API_KEY to use your own DeepInfra account; when that key is absent and the project has STANDARD_AGENTS_API_KEY, requests use hosted Standard Agents routing.

Define a model

agents/models/deepinfra_chat.ts
The Builder’s model picker queries https://api.deepinfra.com/v1/models, keeps models tagged chat, and maps catalog context length, vision tags, and input_tokens, output_tokens, and cache_read_tokens pricing. Each result uses bundled local artwork for the model ID’s lab namespace, so model rows show DeepSeek, Meta, Qwen, and other creator marks rather than the DeepInfra provider mark.

Provider options

DeepInfra options belong in providerOptions:
Supported typed options include n, seed, frequency/presence/repetition penalties, top_k, min_p, logit_bias, log probabilities, stop_token_ids, reasoning_effort, reasoning, service_tier, and prompt_cache_key. The schema is passthrough so newly introduced DeepInfra request fields can be used without waiting for a package release. Standard Agents reasoning.level maps to DeepInfra’s none, low, medium, or high effort. A responseFormat JSON schema is converted to strict json_schema output, and Standard Agents tools are converted to strict OpenAI-compatible function definitions.

Pricing and usage

The package exposes live catalog prices on discovered models. DeepInfra returns request-level USD cost as usage.estimated_cost; the provider preserves that value as Standard Agents usage.cost. If an upstream response omits it, the provider falls back to the cached live catalog rates, including cache-read tokens when present. Hosted routing uses the same upstream-reported value for billing, then adds the plan’s router fee. This avoids a stale platform pricing table as DeepInfra’s catalog changes.

Connection configuration

The package honors provider fetch and defaultHeaders overrides, so test transports, instrumentation, and defineProvider sub-providers work without patching the implementation.