Fireworks AI provides fast inference for popular open-source models, offering high-performance API access to models like Llama, Mistral, and Qwen with optimized inference infrastructure.
This guide explains how to integrate Opik with Fireworks AI using their OpenAI-compatible API endpoints. By using the Opik OpenAI integration, you can easily track and evaluate your Fireworks AI API calls within your Opik projects as Opik will automatically log the input prompt, model used, token usage, and response generated.

First, you’ll need a Comet.com account to use Opik. If you don’t have one, you can sign up for free.
Install the required packages:
Configure Opik to send traces to your Comet project:
Set your Fireworks AI API key as an environment variable:
You can obtain a Fireworks AI API key from the Fireworks AI dashboard.
You can combine the tracked client with Opik’s @track decorator for more comprehensive tracing:

Fireworks AI supports streaming responses, which are also tracked by Opik:
Fireworks AI provides fast inference for a wide range of popular open-source models. Some of the popular models available include:
accounts/fireworks/models/llama-v3p1-8b-instruct, accounts/fireworks/models/llama-v3-70b-instructaccounts/fireworks/models/mixtral-8x7b-instruct-hf, accounts/fireworks/models/mistral-7b-instruct-v0.1accounts/fireworks/models/qwen-72b-chat, accounts/fireworks/models/qwen-14b-chataccounts/fireworks/models/starcoder-16b, accounts/fireworks/models/codellama-34b-instruct-hfFor the complete list of available models, visit the Fireworks AI model catalog.
Once your Fireworks AI calls are logged with Opik, you can view detailed traces in your Opik dashboard. Each API call will create a trace that includes:
API Key Issues: Ensure your FIREWORKS_API_KEY environment variable is set correctly and has sufficient credits.
Model Name Format: Fireworks AI models use the format accounts/fireworks/models/{model-name}. Make sure you’re using the correct model identifier.
Rate Limiting: Fireworks AI has rate limits based on your plan. If you encounter rate limiting, consider implementing exponential backoff in your application.
Base URL: The base URL for Fireworks AI is https://api.fireworks.ai/inference/v1. Ensure you’re using the correct endpoint.
If you encounter issues with the integration:
Make sure to set the following environment variables: