Get started in minutes with an OpenAI-compatible endpoint
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.
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.
Install SDK
Before installing, ensure that you have the right version of Python installed. Optionally you might want to setup a virtual environment too.
The Fireworks Build SDK provides a declarative way to work with Fireworks resources and is OpenAI API Compatible.
Configure API Key
Step-by-step instructions for setting an environment variable for respective OS platforms:
MacOS/Linux
Depending on your shell, you’ll need to edit either ~/.bash_profile
for Bash or ~/.zshrc
for Zsh
.
You can do this by running the command:
Add a new line to the file with the following:
After saving the file, you’ll need to apply the changes by either restarting your terminal session or running depending on the file you edited.
You can verify that the variable has been set correctly by running echo $FIREWORKS_API_KEY
Windows
You can open Command Prompt by searching for it in the Windows search bar or by pressing Win + R, typing cmd, and pressing Enter.
To verify that the variable has been set correctly, you can close and reopen Command Prompt and type:
Sending the first API Request
You can quickly instantiate the LLM
class and call the Fireworks API. The Build SDK handles deployment management automatically.
You can also pass the API key directly to the LLM constructor: LLM(model="llama4-maverick-instruct-basic", deployment_type="auto", api_key="<FIREWORKS_API_KEY>")
Install SDK
Before installing, ensure that you have the right version of Python installed. Optionally you might want to setup a virtual environment too.
The Fireworks Build SDK provides a declarative way to work with Fireworks resources and is OpenAI API Compatible.
Configure API Key
Step-by-step instructions for setting an environment variable for respective OS platforms:
MacOS/Linux
Depending on your shell, you’ll need to edit either ~/.bash_profile
for Bash or ~/.zshrc
for Zsh
.
You can do this by running the command:
Add a new line to the file with the following:
After saving the file, you’ll need to apply the changes by either restarting your terminal session or running depending on the file you edited.
You can verify that the variable has been set correctly by running echo $FIREWORKS_API_KEY
Windows
You can open Command Prompt by searching for it in the Windows search bar or by pressing Win + R, typing cmd, and pressing Enter.
To verify that the variable has been set correctly, you can close and reopen Command Prompt and type:
Sending the first API Request
You can quickly instantiate the LLM
class and call the Fireworks API. The Build SDK handles deployment management automatically.
You can also pass the API key directly to the LLM constructor: LLM(model="llama4-maverick-instruct-basic", deployment_type="auto", api_key="<FIREWORKS_API_KEY>")
Install SDK
Before installing, ensure that you have the right version of Python installed. Optionally you might want to setup a virtual environment too.
Fireworks AI platform offers drop-in replacement with OpenAI Python Client.
Configure API Key
Step-by-step instructions for setting an environment variable for respective OS platforms:
MacOS/Linux
Depending on your shell, you’ll need to edit either ~/.bash_profile
for Bash or ~/.zshrc
for Zsh
.
You can do this by running the command:
Add a new line to the file with the following:
After saving the file, you’ll need to apply the changes by either restarting your terminal session or running depending on the file you edited.
You can verify that the variable has been set correctly by running
echo $OPENAI_API_KEY
Windows
You can open Command Prompt by searching for it in the Windows search bar or by pressing Win + R, typing cmd, and pressing Enter.
To verify that the variable has been set correctly, you can close and reopen Command Prompt and type:
Sending the first API Request
You can quickly instantiate with the generated API Key and call the Fireworks API through OpenAI Python SDK.
Install SDK
Before installing, ensure that you have the right version of Node. Please make sure you have the npm
installed or a package manager of your choice.
Fireworks AI platform offers drop-in replacement with OpenAI JavaScript Client.
Configure API Key
Step-by-step instructions for setting an environment variable for respective OS platforms:
MacOS/Linux
Depending on your shell, you’ll need to edit either ~/.bash_profile
for Bash or ~/.zshrc
for Zsh
.
You can do this by running the command:
Add a new line to the file with the following:
After saving the file, you’ll need to apply the changes by either restarting your terminal session or running depending on the file you edited.
You can verify that the variable has been set correctly by running
echo $FIREWORKS_API_KEY
Windows
You can open Command Prompt by searching for it in the Windows search bar or by pressing Win + R, typing cmd, and pressing Enter.
To verify that the variable has been set correctly, you can close and reopen Command Prompt and type:
Sending the first API Request
You can quickly instantiate with the generated API Key and call the Fireworks API through OpenAI JavaScript SDK.
cURL is a popular open-source command line tool to send HTTP requests. Most Operating systems ship cURL by default. However, if you are not sure, you can follow the first two steps of this guide to setup cURL. If not, we recommend skipping to Step Three.
Check if your operating system has cURL installed by running curl https://api.fireworks.ai
Setup cURL
MacOS
macOS comes with the cURL tool bundled with the operating system. If you want to upgrade to the latest version shipped by the cURL project, we recommend installing homebrew:
Linux
Most Linux distributions offer curl and libcurl to be installed if they are not installed by default.
Windows
Windows 10 comes with the cURL tool bundled with the operating system since version 1804. If you have an older Windows version or just want to upgrade to the latest version shipped by the cURL project, download the latest official cURL release for Windows from curl.se/windows.
Configure API Key
Step-by-step instructions for setting an environment variable for respective OS platforms:
MacOS/Linux
Depending on your shell, you’ll need to edit either ~/.bash_profile
for Bash or ~/.zshrc
for Zsh
.
You can do this by running the command:
Add a new line to the file with the following:
After saving the file, you’ll need to apply the changes by either restarting your terminal session or running depending on the file you edited.
You can verify that the variable has been set correctly by running echo $FIREWORKS_API_KEY
Windows
You can open Command Prompt by searching for it in the Windows search bar or by pressing Win + R, typing cmd, and pressing Enter.
To verify that the variable has been set correctly, you can close and reopen Command Prompt and type:
Sending the first API Request
Making your first API request with cURL. Notice the use of $FIREWORKS_API_KEY
.
More details on calling various APIs can be found at our API Reference
Learn more about prompting text models
View the full API reference
Customize a model for your specific use case
Get the best speed, reliability, & scalability
Query vision language models
Convert speech to text async or in realtime