Skip to content

feat(llms): add fireworks_ai as an openai-compatible provider - #8014

Open
Nagizaaz Shaik (shaikn6) wants to merge 11 commits into
crewAIInc:mainfrom
shaikn6:feat/fireworks-native-provider
Open

Nagizaaz Shaik (shaikn6) wants to merge 11 commits into
crewAIInc:mainfrom
shaikn6:feat/fireworks-native-provider

Conversation

@shaikn6

@shaikn6 Nagizaaz Shaik (shaikn6) commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Related issue

Fixes #8010

Summary

Registers fireworks_ai in OPENAI_COMPATIBLE_PROVIDERS and the factory routing tables (SUPPORTED_NATIVE_PROVIDERS, PROVIDER_ALIASES, _matches_provider_pattern, _get_native_provider), following the DeepInfra change in #7459. LLM(model="fireworks_ai/accounts/fireworks/models/<model>") and provider="fireworks_ai" now build OpenAICompatibleCompletion without LiteLLM.

  • Endpoint https://api.fireworks.ai/inference/v1, key from FIREWORKS_API_KEY, optional FIREWORKS_BASE_URL override.
  • Explicit api_key / base_url take precedence over the env vars; OPENAI_API_KEY / OPENAI_BASE_URL are never used, and a missing key raises an error naming FIREWORKS_API_KEY.
  • Only the fireworks_ai/ prefix is removed, so accounts/fireworks/models/<model-id> reaches the SDK intact. The existing fireworks_ai/ spelling is kept; no fireworks/ alias is added.
  • is_litellm=True still selects the LiteLLM path.

Verification

  • Tests added or updated for the changed behavior
  • Relevant tests and quality checks pass locally

New TestHostedProviders in tests/llms/openai_compatible/test_openai_compatible.py, parametrized by provider. It covers config, prefixed and explicit-provider routing (full accounts/... path preserved), OpenAI env isolation, missing-key error, FIREWORKS_BASE_URL, explicit precedence, the is_litellm=True path, and sync and async calls through an httpx.MockTransport that checks the URL, Authorization header and model id sent. No network or paid calls.

uv run pytest tests/llms/ tests/test_llm.py tests/test_llm_overlay.py tests/utilities/test_converter.py
1089 passed, 23 skipped

With the source change reverted, 7 of the new tests fail. ruff check on the changed source files is clean.

Additional context

The same test class is introduced by #8013 (Groq, #8009). Whichever merges second needs a one-row rebase of HOSTED_PROVIDER_CASES, which I'll handle.

Docs: the Fireworks AI accordion in docs/edge/{en,ar,ko,pt-BR}/concepts/llms.mdx now says it uses the native client, lists FIREWORKS_BASE_URL, and drops the LiteLLM install note. Frozen docs/v*/ snapshots are unchanged.

Prepared with AI assistance (Claude Code), per CONTRIBUTING. I don't have permission to apply the llm-generated label, so could a maintainer add it?


Note

Medium Risk
Touches core LLM factory routing and provider credentials; risk is moderate but mitigated by broad tests and the same pattern used for other OpenAI-compatible hosts.

Overview
Fireworks AI now routes through OpenAICompatibleCompletion instead of LiteLLM when you use fireworks_ai/... model ids or provider="fireworks_ai". Routing tables in llm.py and the CLI’s _NATIVE_ANY_MODEL_PROVIDERS were updated; configuration uses FIREWORKS_API_KEY, default endpoint https://api.fireworks.ai/inference/v1, and optional FIREWORKS_BASE_URL, with full resource paths (e.g. accounts/fireworks/models/...) passed through to the API unchanged.

OpenAICompatibleCompletion gains get_context_window_size() so OpenAI-compatible models resolve limits from the shared catalog (with Fireworks-specific coverage tested). A parametrized TestHostedProviders suite exercises Fireworks routing, env isolation from OPENAI_*, sync/async request shaping, and the legacy is_litellm=True path. Docs in en, ar, ko, pt-BR now describe the native client setup and drop the LiteLLM install note.

Reviewed by Cursor Bugbot for commit d5515d3. Bugbot is set up for automated code reviews on this repo. Configure here.

Register fireworks_ai in the OpenAI-compatible provider registry so
LLM(model="fireworks_ai/accounts/fireworks/models/<model>") and
provider="fireworks_ai" route natively through OpenAICompatibleCompletion
with FIREWORKS_API_KEY and no LiteLLM install. FIREWORKS_BASE_URL
overrides the endpoint, explicit api_key/base_url win over both env vars,
and OPENAI_* settings are never used. Only the fireworks_ai/ prefix is
removed, so the accounts/... resource path reaches the API intact.
is_litellm=True keeps the LiteLLM path.

The Fireworks AI docs accordion is updated in en, ar, ko and pt-BR.

Fixes crewAIInc#8010
@strix-security

strix-security Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

Strix Security Review

Warning

This pull request has 238 commits after the last Strix review (3876dca). Strix has not reviewed these changes.
Automatic review on push is off for this repository. To review the latest changes, tag @strix-security in a comment, or turn on re-review on push.

No security issues found.

Review summary

Reviewed all seven changed files in this PR, which registers fireworks_ai as a native OpenAI-compatible provider. The change is a config-only addition following the established deepinfra pattern: it adds fireworks_ai to the provider routing tables (SUPPORTED_NATIVE_PROVIDERS, PROVIDER_ALIASES, _matches_provider_pattern, _get_native_provider) and adds a ProviderConfig with a public base URL, FIREWORKS_API_KEY, and an optional FIREWORKS_BASE_URL override. No security issues were found: no hardcoded secrets are committed, the model identifier is passed to the OpenAI SDK as a JSON field rather than interpolated into a URL or filesystem path, the base URL override is operator-controlled configuration (not attacker-controlled input), and the provider correctly isolates its API key from OPENAI_API_KEY/OPENAI_BASE_URL. The remaining changes are documentation and test additions.

Updated for 3876dca.


Reviewed by Strix
Re-run review · Configure security review settings

@coderabbitai

coderabbitai Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: f5c3ca4e-70ea-491d-9b0a-d0f3410595bc
📥 Commits

Reviewing files that changed from the base of the PR and between c417141 and 971abc1.

📒 Files selected for processing (2)
  • lib/crewai/src/crewai/llms/providers/openai_compatible/completion.py
  • lib/crewai/tests/llms/openai_compatible/test_openai_compatible.py

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.

📝 Walkthrough

Fireworks AI now uses CrewAI’s native OpenAI-compatible provider routing. Its configuration supports a required API key and an optional base URL. Context-window lookup and tests cover provider models, routing, configuration precedence, and synchronous and asynchronous requests. Provider documentation was updated in four languages.

Changes: Fireworks AI native provider

Layer / File(s) Summary
Provider configuration and routing
lib/crewai/src/crewai/llms/providers/openai_compatible/completion.py, lib/crewai/src/crewai/llm.py, docs/edge/*/concepts/llms.mdx
Adds Fireworks AI provider configuration and native routing. The provider uses FIREWORKS_API_KEY and supports FIREWORKS_BASE_URL. The localized docs describe native OpenAI-client integration and remove the Fireworks-specific LiteLLM installation instructions.
Context-window lookup and request validation
lib/crewai/src/crewai/llms/providers/openai_compatible/completion.py, lib/crewai/tests/llms/openai_compatible/test_openai_compatible.py
Adds context-window lookup using the provider-qualified model ID, then the model ID, with a default fallback. Tests cover routing, provider settings, endpoint and credential precedence, explicit LiteLLM routing, and synchronous and asynchronous requests.

Sequence Diagram(s)

sequenceDiagram
  participant CrewAI
  participant OpenAICompatibleCompletion
  participant FireworksAPI
  CrewAI->>OpenAICompatibleCompletion: Send model request
  OpenAICompatibleCompletion->>FireworksAPI: Send completion with configured URL and credentials
  FireworksAPI-->>OpenAICompatibleCompletion: Return completion response
  OpenAICompatibleCompletion-->>CrewAI: Return completion
Loading

Suggested reviewers: ats3v

Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to 971ab

This change adds native Fireworks AI support through the OpenAI-compatible provider path and keeps the legacy LiteLLM option. The supplied evidence shows no concrete merge-blocking risk.

Pre-merge checks · Passed 4 · Failed 1

Failed Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 55.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 20 functions across 3 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks (4 passed)
Check name Status Explanation
Title check Passed The title clearly and concisely identifies the addition of Fireworks AI as an OpenAI-compatible provider, which is the primary change.
Description check Passed The description includes the required related issue, summary, verification results, test coverage, and additional context. It explains configuration, routing, compatibility behavior, and documentation…
Linked Issues check Passed Issue #8010 is active and has coding requirements. The changes register fireworks_ai as a native OpenAI-compatible provider and route prefixed and explicit-provider models to `OpenAICompatibleComple…
Out of Scope Changes check Passed The changes stay within issue #8010. Source changes implement the requested registry, configuration, routing, and context-window support. Tests validate the requested Fireworks behavior and existing p…
  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Routing fireworks_ai natively sent its models through the OpenAI-only
lookup, which resolves 280 of the 330 fireworks_ai ids in the catalog to
a different limit than the catalog lists. The lookup now uses
provider/model first and the id as given second.
@shaikn6

Copy link
Copy Markdown
Contributor Author

Merged main and added a context-window lookup that follows #8077.

Once fireworks_ai routes natively, its models go through the inherited OpenAI lookup, which resolves 280 of the 330 fireworks_ai/ ids in the catalog to a different limit than the catalog lists. OpenAICompatibleCompletion.get_context_window_size now resolves provider/model in LLM_CONTEXT_WINDOW_SIZES first and the id as given second; a test checks every fireworks_ai/ id in the catalog against its own limit. The same method is in #8013.

One thing I left alone: with is_litellm=True the legacy path strips the now-recognized fireworks_ai/ prefix before its lookup, so an id that also exists bare takes the bare entry's limit. For fireworks_ai/deepseek-v4-flash that is 1,000,000 instead of the 1,048,576 the catalog lists for Fireworks. Happy to change the lookup order there if you want it in this PR.

@mintlify

mintlify Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

Preview approval required

This pull request comes from a fork, so Mintlify won't build a preview until someone with write access approves commit d5515d3.

Approve preview

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Want higher recall? High effort reviews run extra passes and find more bugs. A team admin can switch effort levels in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 7fe2151. Configure here.

Signed-off-by: Nagizaaz Shaik <176337212+shaikn6@users.noreply.github.com>

# Conflicts:
#	lib/crewai/tests/llms/openai_compatible/test_openai_compatible.py
Signed-off-by: Nagizaaz Shaik <176337212+shaikn6@users.noreply.github.com>
…lm extra

Signed-off-by: Nagizaaz Shaik <176337212+shaikn6@users.noreply.github.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE] Add Fireworks AI to native OpenAI-compatible provider routing

1 participant