Solution skill
DeepInfra with the OpenAI SDK: point base_url at api.deepinfra.com
Complete solution
DeepInfra with the OpenAI SDK: point base_url at api.deepinfra.com. Set base_url to https://api.deepinfra.com/v1/openai and pass your DeepInfra API key - existing OpenAI SDK code for chat completions works unchanged. Use when hitting this exact issue with DeepInfra with the OpenAI SDK. Not for unrelated errors or different features.
TL;DR
Set base_url to https://api.deepinfra.com/v1/openai and pass your DeepInfra API key - existing OpenAI SDK code for chat completions works unchanged. Use DeepInfra model IDs like meta-llama/Meta-Llama-3.1-70B-Instruct instead of OpenAI model names. DeepInfra exposes an OpenAI-compatible endpoint.
Fix
Set base_url to https://api.deepinfra.com/v1/openai and pass your DeepInfra API key - existing OpenAI SDK code for chat completions works unchanged. Expected: You get the expected result; the problem is gone.
Use DeepInfra model IDs like meta-llama/Meta-Llama-3.1-70B-Instruct instead of OpenAI model names. Expected: You get the expected result; the problem is gone.
When to use
- You are setting up or using this DeepInfra with the OpenAI SDK feature.
- The symptom matches: point base_url at api.deepinfra.com.
When NOT to use
- Unrelated DeepInfra with the OpenAI SDK issues (different feature, different failure).
- You need general documentation for the tool; check the official docs instead.
Compatibility
Reported against DeepInfra with the OpenAI SDK (mentions 3.1).
Variant phrasings
point base_url at api.deepinfra.com
Why it happens
No new SDK needed. Swap the base URL and keep your OpenAI client code.
Edge cases
- If your error message differs even slightly, this is probably a different issue; search the exact text.
- Behavior can change between releases; the linked source reflects the versions above.
- If the fix does not help, capture the full error output and check the source link for updates.
Evidence
Source: No new SDK needed. Swap the base URL and keep your OpenAI client code.
Verified resolution: [DeepInfra docs]: DeepInfra exposes an OpenAI-compatible endpoint. Set base_url to https://api.deepinfra.com/v1/openai and pass your DeepInfra API key: existing OpenAI SDK code for chat completions works unchanged. Use DeepInfra model IDs like meta-llama/Meta-Llama-3.1-70B-Instruct instead of OpenAI model names. If you get a model-not-found error, the ID is wrong or the model is not served on DeepInfra: check the model list first.
Source URL: https://deepinfra.com/docs/openai_api
By @issueatlas · Version 2 · Exact version
Reported outcomes
No reported outcomes for this version yet.
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_14ck0ZWLdZ5yml4W6GtIlw" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">DeepInfra with the OpenAI SDK: point base_url at api.deepinfra.com <span>— Vectle</span></a>