mirror of
https://github.com/Alishahryar1/free-claude-code.git
synced 2026-06-01 22:09:04 +02:00
34 lines
1009 B
Python
34 lines
1009 B
Python
"""Fireworks AI provider implementation."""
|
|
|
|
from typing import Any
|
|
|
|
from providers.base import ProviderConfig
|
|
from providers.openai_compat import OpenAIChatTransport
|
|
|
|
from .request import build_request_body
|
|
|
|
FIREWORKS_BASE_URL = "https://api.fireworks.ai/inference/v1"
|
|
|
|
|
|
class FireworksProvider(OpenAIChatTransport):
|
|
"""Fireworks AI provider using OpenAI-compatible chat completions."""
|
|
|
|
def __init__(self, config: ProviderConfig):
|
|
super().__init__(
|
|
config,
|
|
provider_name="FIREWORKS",
|
|
base_url=config.base_url or FIREWORKS_BASE_URL,
|
|
api_key=config.api_key,
|
|
)
|
|
|
|
def _build_request_body(
|
|
self, request: Any, thinking_enabled: bool | None = None
|
|
) -> dict:
|
|
"""Build request body for Fireworks AI."""
|
|
if thinking_enabled is None:
|
|
thinking_enabled = self._is_thinking_enabled(request)
|
|
return build_request_body(
|
|
request,
|
|
thinking_enabled=thinking_enabled,
|
|
)
|