Skip to main content
You don’t need to install anything to do your first inference. You only need your access token. DeepInfra gives you access to 100+ open-source models at the best prices available.

Step 1: Get your API key

Go to the Dashboard and create an API key. If you’re logged in, examples throughout the docs will have your token pre-filled.

Step 2: Make your first API call

curl "https://api.deepinfra.com/v1/openai/chat/completions" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $DEEPINFRA_TOKEN" \
  -d '{
      "model": "deepseek-ai/DeepSeek-V3",
      "messages": [
        {
          "role": "user",
          "content": "Hello!"
        }
      ]
    }'
The response looks like this:
{
    "id": "chatcmpl-guMTxWgpFf",
    "object": "chat.completion",
    "created": 1694623155,
    "model": "deepseek-ai/DeepSeek-V3",
    "choices": [
        {
            "index": 0,
            "message": {
                "role": "assistant",
                "content": "Hello! It's nice to meet you. Is there something I can help you with?"
            },
            "finish_reason": "stop"
        }
    ],
    "usage": {
        "prompt_tokens": 15,
        "completion_tokens": 16,
        "total_tokens": 31,
        "estimated_cost": 0.0000268
    }
}

That’s it

You’re using the OpenAI Chat Completions API — the same interface you already know. The only changes are:
  • Base URL: https://api.deepinfra.com/v1/openai
  • API key: your DeepInfra token
  • Model: any model from our catalog
The official OpenAI Python and Node.js libraries work out of the box.

Install the SDK (optional)

pip install openai

Next steps

Chat Completions

Learn about the full chat completions API.

Streaming

Stream responses token by token.

Tool Calling

Give models access to external functions.

Model Catalog

Browse 100+ available models.