Skip to main content
Pi is a coding agent. It doesn’t ship DeepInfra as a built-in provider, but it works with any OpenAI-compatible endpoint — so you can add DeepInfra as a custom provider and run any LLM from our catalog.

Configure the provider

Add a deepinfra provider to your Pi configuration. See Pi’s custom provider docs for where the config file lives.
Get your API key from the Dashboard.

Run it

Set your API key in the environment and launch Pi against the model:

Notes on the values

  • id (deepseek-ai/DeepSeek-V4-Flash) must match exactly — it’s case-sensitive and is passed straight through as the model name.
  • The compat block applies to DeepSeek models only — omit it for other models:
    • supportsDeveloperRole: false is required for DeepSeek models. Because they’re marked "reasoning": true, Pi defaults to sending the system prompt with the OpenAI-only developer role, which is rejected with a 422 error. This setting makes Pi use the standard system role instead.
    • thinkingFormat: "deepseek" matches how DeepSeek models stream reasoning tokens (as reasoning_content), so the model’s thinking renders properly in Pi.
  • contextWindow is the model’s full 1M-token window. maxTokens (65536) is just a per-request output cap you can raise or lower to taste.
  • The cost block only drives Pi’s local spend display; the numbers above are DeepInfra’s current per-million-token rates for this model, but they don’t affect requests either way.
To get the current context window and pricing for this or any other model, fetch /v1/openai/models?filter=with_meta, or see the model’s page.

Troubleshooting

422 role validation error — an error like:
means Pi sent the system prompt with the developer role, which isn’t accepted. This happens by default with DeepSeek models because they’re configured with "reasoning": true. Fix it by adding "compat": { "supportsDeveloperRole": false } to the model entry, as shown in the config above. 401 / 402 errors — if requests fail even though the config looks right, confirm your API key and balance with a direct API call. This bypasses Pi entirely and tells you whether the issue is your DeepInfra account or the Pi config:
If this returns a normal completion, your key and balance are good. A 401 means the key is wrong; a 402/quota error means the account needs funding.

Learn more

Custom providers

Pi’s guide to defining a custom provider.

Providers overview

How Pi handles providers and models.

Chat Completions

DeepInfra’s OpenAI-compatible API.

Authentication

API keys and scoped JWTs.