> ## Documentation Index
> Fetch the complete documentation index at: https://docs.deepinfra.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Quickstart

> Make your first API call in 60 seconds — no installation required.

You don't need to install anything to do your first inference. You only need [your API key](https://deepinfra.com/dash/keys). DeepInfra gives you access to 100+ open-source models at the best prices available.

## Step 1: Get your API key

Go to the [Dashboard](https://deepinfra.com/dash/keys) and create an API key (new to DeepInfra? See [Signing In](https://docs.deepinfra.com/account/signing-in.md)). Copy it when it is shown and export it, so the examples below can read it:

```bash theme={null}
export DEEPINFRA_API_KEY=<your DeepInfra API key>
```

## Step 2: Make your first API call

```bash cURL theme={null}
curl "https://api.deepinfra.com/v1/openai/chat/completions" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $DEEPINFRA_API_KEY" \
  -d '{
      "model": "deepseek-ai/DeepSeek-V4-Flash-0731",
      "messages": [
        {
          "role": "user",
          "content": "Hello!"
        }
      ]
    }'
```

```python Python theme={null}
import os

from openai import OpenAI

client = OpenAI(
    api_key=os.environ["DEEPINFRA_API_KEY"],
    base_url="https://api.deepinfra.com/v1/openai",
)

response = client.chat.completions.create(
    model="deepseek-ai/DeepSeek-V4-Flash-0731",
    messages=[{"role": "user", "content": "Hello!"}],
)
print(response.choices[0].message.content)
```

```javascript JavaScript theme={null}
import OpenAI from "openai";

const openai = new OpenAI({
  apiKey: process.env.DEEPINFRA_API_KEY,
  baseURL: "https://api.deepinfra.com/v1/openai",
});

const response = await openai.chat.completions.create({
  model: "deepseek-ai/DeepSeek-V4-Flash-0731",
  messages: [{ role: "user", content: "Hello!" }],
});
console.log(response.choices[0].message.content);
```

The response looks like this:

```json theme={null}
{
    "id": "chatcmpl-guMTxWgpFf",
    "object": "chat.completion",
    "created": 1694623155,
    "model": "deepseek-ai/DeepSeek-V4-Flash-0731",
    "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](https://docs.deepinfra.com/chat/overview.md) — 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](https://deepinfra.com/models)

The official OpenAI Python and Node.js libraries work out of the box.

## Install the SDK (optional)

```bash Python theme={null}
pip install openai
```

```bash JavaScript theme={null}
npm install openai
```

## Compress large requests (optional)

Sending long conversations or big batches? Gzip the request body and add
`Content-Encoding: gzip`. JSON typically shrinks 4–8× on the wire once a body is a few KB.
The tiny body below only shows the shape; compressed, it would grow slightly:

```bash theme={null}
echo '{
  "model": "deepseek-ai/DeepSeek-V4-Flash-0731",
  "messages": [{"role": "user", "content": "Hello!"}]
}' | gzip | curl "https://api.deepinfra.com/v1/openai/chat/completions" \
  -H "Content-Type: application/json" \
  -H "Content-Encoding: gzip" \
  -H "Authorization: Bearer $DEEPINFRA_API_KEY" \
  --data-binary @-
```

The OpenAI SDKs can compress JSON request bodies with a few lines of setup. See
[Request Compression](https://docs.deepinfra.com/request-compression.md).

## Next steps

> [card] [Chat Completions](https://docs.deepinfra.com/chat/overview.md)
>
> Learn about the full chat completions API.

> [card] [Streaming](https://docs.deepinfra.com/chat/streaming.md)
>
> Stream responses token by token.

> [card] [Tool Calling](https://docs.deepinfra.com/chat/tool-calling.md)
>
> Give models access to external functions.

> [card] [Model Catalog](https://docs.deepinfra.com/models.md)
>
> Browse 100+ available models.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.