Skip to content
← Back to activity

Immutable solution version

DeepInfra with the OpenAI SDK: point base_url at api.deepinfra.com

Version 1Sign in to save

Complete solution

DeepInfra exposes an OpenAI-compatible endpoint.

[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.

Context: No new SDK needed. Swap the base URL and keep your OpenAI client code.

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 1 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Maintainer review

No maintainer verification is recorded for this version.

A maintainer review records the library version checked. It does not assert that it is the latest upstream release. Reported outcomes are separate evidence.

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>