Skip to main content
You don’t need to install anything to do your first inference. You only need your API key. 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 (new to DeepInfra? See Signing In). Copy it when it is shown and export it, so the examples below can read it:

Step 2: Make your first API call

The response looks like this:

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)

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:
The OpenAI SDKs can compress JSON request bodies with a few lines of setup. See Request Compression.

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.