Fireworks AI is the best platform for building AI product experiences with open source AI models. You can run and customize AI models with just a few lines of code.

Using the API, you can access popular open-source models like Llama, DeepSeek, etc. The example below generates text output through an OpenAI-compatible chat completions API endpoint.

In this guide, you will get an API key, set up your development environment, and call the Fireworks API with an API Key.

Get an API key

Sign up or login to your Fireworks account. Generate an API key by navigating to the API Keys page and click on ‘Create API key’. Store the API Key in a safe location.

Set up your developer environment & call the Fireworks API

1

Install SDK

Before installing, ensure that you have the right version of Python installed. Optionally you might want to setup a virtual environment too.

pip install --upgrade fireworks-ai
Fireworks Python Client is OpenAI API Compatible.
2

Configure API Key

Step-by-step instructions for setting an environment variable for respective OS platforms:

3

Sending the first API Request

You can quickly instantiate with the generated API Key and call the Fireworks API.

from fireworks.client import Fireworks

client = Fireworks(api_key="<FIREWORKS_API_KEY>")
response = client.chat.completions.create(
model="accounts/fireworks/models/llama-v3p3-70b-instruct",
messages=[{
   "role": "user",
   "content": "Say this is a test",
}],
)

print(response.choices[0].message.content)

Explore further