{"id":"fireworks-ai","title":"Fireworks AI Python SDK","library":"fireworks-ai","description":"Python SDK and OpenAI-compatible API for running open-source and proprietary LLMs on Fireworks AI infrastructure.","status":"active","version":"0.19.20","install":[{"cmd":"pip install fireworks-ai","lang":"bash","label":"Stable (recommended)"},{"cmd":"pip install fireworks-ai==1.0.0a20","lang":"bash","label":"v1 alpha (pre-release, breaking changes)"},{"cmd":"pip install openai","lang":"bash","label":"OpenAI-compatible alternative (no native SDK needed)"}],"dependencies":[{"package":"openai","reason":"Required if using OpenAI-compatible approach instead of native SDK","optional":true}],"imports":[{"symbol":"Fireworks","correct":"from fireworks.client import Fireworks","wrong":"import fireworks","note":"v0.x stable import path"},{"symbol":"OpenAI (Fireworks compat)","correct":"from openai import OpenAI\nclient = OpenAI(base_url='https://api.fireworks.ai/inference/v1', api_key=os.environ['FIREWORKS_API_KEY'])","wrong":"from openai import OpenAI\nclient = OpenAI()","note":"Must override base_url and api_key — defaults point to OpenAI"}],"quickstart":{"code":"from openai import OpenAI\n\nclient = OpenAI(\n    base_url='https://api.fireworks.ai/inference/v1',\n    api_key='YOUR_FIREWORKS_API_KEY'\n)\n\nresponse = client.chat.completions.create(\n    model='accounts/fireworks/models/llama-v3p1-8b-instruct',\n    messages=[{'role': 'user', 'content': 'Hello'}]\n)\nprint(response.choices[0].message.content)","lang":"python","description":"Chat completion using OpenAI-compatible interface (recommended for portability)"},"warnings":[{"severity":"breaking","message":"v1.0.0 alpha SDK (pip install fireworks-ai==1.0.0a*) is NOT stable. It has breaking changes vs v0.x and is still in pre-release as of Jan 2026. pip install fireworks-ai installs v0.19.20 (stable).","affected_versions":"1.0.0a1–1.0.0a20","fix":"Use v0.19.20 for production. Pin explicitly: pip install fireworks-ai==0.19.20"},{"severity":"breaking","message":"Model IDs use full path format: accounts/fireworks/models/<model-name>. Short names like 'llama-3-8b' will fail with 404.","affected_versions":"all","fix":"Always use full model path. Find IDs at fireworks.ai/models"},{"severity":"gotcha","message":"When using OpenAI SDK compatibility, set FIREWORKS_API_KEY env var but pass it explicitly as api_key= — the OpenAI SDK reads OPENAI_API_KEY by default and will silently use the wrong key.","affected_versions":"all","fix":"api_key=os.environ['FIREWORKS_API_KEY'] explicitly in OpenAI() constructor"},{"severity":"gotcha","message":"usage field is not exposed in OpenAI SDK streaming responses against Fireworks. Cast chunk to Any in TypeScript; in Python, usage will be None on stream chunks.","affected_versions":"all","fix":"Use non-streaming for usage tracking, or read usage from the final chunk only"},{"severity":"gotcha","message":"LiteLLM uses FIREWORKS_AI_API_KEY (with _AI_). Native SDK and OpenAI-compat use FIREWORKS_API_KEY. Different env var depending on integration.","affected_versions":"all","fix":"Check integration docs. Set both if mixing LiteLLM with native/OpenAI SDK."},{"severity":"deprecated","message":"Build SDK (native fireworks.client) is marked deprecated in official docs. Fireworks now recommends OpenAI-compatible approach for new projects.","affected_versions":"0.x","fix":"Migrate to OpenAI SDK with base_url override, or wait for stable v1.0.0"}],"last_verified":"2026-02-28","next_check":"2026-05-28","source_url":"https://docs.fireworks.ai","language":"en","source_language":"en","tags":["llm","inference","openai-compatible","python","ai-sdk"]}