Skip to content

Commit 230443b

Browse files
Add documentation to use FireworksAI on strands (#269)
Add documentation to use FireworksAI on strands --------- Co-authored-by: Mackenzie Zastrow <[email protected]>
1 parent ede0785 commit 230443b

File tree

4 files changed

+88
-0
lines changed

4 files changed

+88
-0
lines changed
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
# FireworksAI
2+
3+
{{ community_contribution_banner }}
4+
5+
[Fireworks AI](https://fireworks.ai) provides blazing fast inference for open-source language models. Fireworks AI is accessible through OpenAI's SDK via full API compatibility, allowing easy and portable integration with the Strands Agents SDK using the familiar OpenAI interface.
6+
7+
## Installation
8+
9+
The Strands Agents SDK provides access to Fireworks AI models through the OpenAI compatibility layer, configured as an optional dependency. To install, run:
10+
11+
```bash
12+
pip install 'strands-agents[openai]' strands-agents-tools
13+
```
14+
15+
## Usage
16+
17+
After installing the `openai` package, you can import and initialize the Strands Agents' OpenAI-compatible provider for Fireworks AI models as follows:
18+
19+
```python
20+
from strands import Agent
21+
from strands.models.openai import OpenAIModel
22+
from strands_tools import calculator
23+
24+
model = OpenAIModel(
25+
client_args={
26+
"api_key": "<FIREWORKS_API_KEY>",
27+
"base_url": "https://api.fireworks.ai/inference/v1",
28+
},
29+
model_id="accounts/fireworks/models/deepseek-v3p1-terminus", # or see https://fireworks.ai/models
30+
params={
31+
"max_tokens": 5000,
32+
"temperature": 0.1
33+
}
34+
)
35+
36+
agent = Agent(model=model, tools=[calculator])
37+
agent("What is 2+2?")
38+
```
39+
40+
## Configuration
41+
42+
### Client Configuration
43+
44+
The `client_args` configure the underlying OpenAI-compatible client. When using Fireworks AI, you must set:
45+
46+
* `api_key`: Your Fireworks AI API key. Get one from the [Fireworks AI Console](https://app.fireworks.ai/settings/users/api-keys).
47+
* `base_url`: `https://api.fireworks.ai/inference/v1`
48+
49+
Refer to [OpenAI Python SDK GitHub](https://github.com/openai/openai-python) for full client options.
50+
51+
### Model Configuration
52+
53+
The `model_config` specifies which Fireworks AI model to use and any additional parameters.
54+
55+
| Parameter | Description | Example | Options |
56+
| ---------- | ------------------------- | ----------------------------------------------------------------- | ------------------------------------------------------------------ |
57+
| `model_id` | Model name | `accounts/fireworks/models/deepseek-v3p1-terminus` | See [Fireworks Models](https://fireworks.ai/models) |
58+
| `params` | Model-specific parameters | `{"max_tokens": 5000, "temperature": 0.7, "top_p": 0.9}` | [API reference](https://docs.fireworks.ai/api-reference) |
59+
60+
## Troubleshooting
61+
62+
### `ModuleNotFoundError: No module named 'openai'`
63+
64+
You must install the `openai` dependency to use this provider:
65+
66+
```bash
67+
pip install 'strands-agents[openai]'
68+
```
69+
70+
### Unexpected model behavior?
71+
72+
Ensure you're using a model ID compatible with Fireworks AI (e.g., `accounts/fireworks/models/deepseek-v3p1-terminus`, `accounts/fireworks/models/kimi-k2-instruct-0905`), and your `base_url` is set to `https://api.fireworks.ai/inference/v1`.
73+
74+
## References
75+
76+
* [Fireworks AI OpenAI Compatibility Guide](https://fireworks.ai/docs/tools-sdks/openai-compatibility#openai-compatibility)
77+
* [Fireworks AI API Reference](https://docs.fireworks.ai/api-reference)
78+
* [Fireworks AI Models](https://fireworks.ai/models)
79+
* [OpenAI Python SDK](https://github.com/openai/openai-python)
80+
* [Strands Agents API](../../api-reference/models.md)
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
2+
<auto-redirect />
3+
4+
This guide has moved to [community/model-providers/fireworksai](../../../community/model-providers/fireworksai.md).
5+

docs/user-guide/quickstart.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -444,6 +444,7 @@ Strands Agents supports several other model providers beyond Amazon Bedrock:
444444
- **[Writer](concepts/model-providers/writer.md)** - Access to Palmyra models
445445
- **[Cohere <sup> community</sup>](../community/model-providers/cohere.md)** - Use Cohere models through an OpenAI compatible interface
446446
- **[CLOVA Studio<sup> community</sup>](../community/model-providers/clova-studio.md)** - Korean-optimized AI models from Naver Cloud Platform
447+
- **[FireworksAI<sup> community</sup>](../community/model-providers/fireworksai.md)** - Use FireworksAI models through an OpenAI compatible interface
447448
- **[Custom Providers](concepts/model-providers/custom_model_provider.md)** - Build your own provider for specialized needs
448449

449450
## Capturing Streamed Data & Events

mkdocs.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ nav:
103103
- Custom Providers: user-guide/concepts/model-providers/custom_model_provider.md
104104
- Cohere<sup> community</sup>: user-guide/concepts/model-providers/cohere.md # ALWAYS ADD A SPACE BEFORE COMMUNITY
105105
- CLOVA Studio<sup> community</sup>: user-guide/concepts/model-providers/clova-studio.md
106+
- FireworksAI<sup> community</sup>: user-guide/concepts/model-providers/fireworksai.md
106107
- Streaming:
107108
- Overview: user-guide/concepts/streaming/overview.md
108109
- Async Iterators: user-guide/concepts/streaming/async-iterators.md
@@ -153,6 +154,7 @@ nav:
153154
- Model Providers:
154155
- Cohere: community/model-providers/cohere.md
155156
- CLOVA Studio: community/model-providers/clova-studio.md
157+
- Fireworks AI: community/model-providers/fireworksai.md
156158

157159
- Contribute ❤️: https://github.com/strands-agents/sdk-python/blob/main/CONTRIBUTING.md
158160
- API Reference:

0 commit comments

Comments
 (0)