Configure the provider
Add adeepinfra provider to your Pi configuration. See Pi’s custom provider docs for where the config file lives.
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
compatblock applies to DeepSeek models only — omit it for other models:supportsDeveloperRole: falseis required for DeepSeek models. Because they’re marked"reasoning": true, Pi defaults to sending the system prompt with the OpenAI-onlydeveloperrole, which is rejected with a422error. This setting makes Pi use the standardsystemrole instead.thinkingFormat: "deepseek"matches how DeepSeek models stream reasoning tokens (asreasoning_content), so the model’s thinking renders properly in Pi.
contextWindowis the model’s full 1M-token window.maxTokens(65536) is just a per-request output cap you can raise or lower to taste.- The
costblock 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:
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:
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.