Leverage DeepInfra’s powerful command models and more.

DeepInfra supports a wide range of models. See their library of models here.

We recommend experimenting to find the best-suited model for your use-case. Here are some general recommendations:

  • deepseek-ai/DeepSeek-R1-Distill-Llama-70B model is good for reasoning.
  • meta-llama/Llama-2-70b-chat-hf model is good for basic use-cases.
  • meta-llama/Llama-3.3-70B-Instruct model is good for multi-step tasks.

DeepInfra has rate limits. See the docs for more information.

Authentication

Set your DEEPINFRA_API_KEY environment variable. Get your key from here.

export DEEPINFRA_API_KEY=***

Example

Use DeepInfra with your Agent:

from agno.agent import Agent, RunResponse
from agno.models.deepinfra import DeepInfra

agent = Agent(
    model=DeepInfra(id="meta-llama/Llama-2-70b-chat-hf"),
    markdown=True
)

# Print the response in the terminal
agent.print_response("Share a 2 sentence horror story.")

View more examples here.

Params

ParameterTypeDefaultDescription
idstr"meta-llama/Llama-2-70b-chat-hf"The specific model ID used for generating responses.
namestr"DeepInfra"The name identifier for the DeepInfra agent.
providerstr"DeepInfra" + idThe provider of the model, combining "DeepInfra" with the model ID.
api_keyOptional[str]-The API key for authenticating requests to the DeepInfra service. Retrieved from the environment variable DEEPINFRA_API_KEY.
base_urlstr"https://api.deepinfra.com/v1/openai"The base URL for making API requests to the DeepInfra service.

DeepInfra is a subclass of the Model class and has access to the same params.