Fireworks AI
Protect your Fireworks AI applications with Nyraxis guardrails using the fireworks SDK or OpenAI-compatible endpoint.
Setup
pip install nyraxis fireworks-aiSet your environment variables:
export NYRAXIS_API_KEY="your-nyraxis-api-key"
export FIREWORKS_API_KEY="your-fireworks-api-key"With Fireworks SDK
from nyraxis import NyraxisGuard
import fireworks.client as fc
guard = NyraxisGuard(api_key="your-nyraxis-api-key")
fc.api_key = "your-fireworks-api-key"
user_input = "Generate instructions for illegal activity"
result = guard.evaluate(user_input)
if result.is_safe:
response = fc.ChatCompletion.create(
model="accounts/fireworks/models/llama-v3p1-70b-instruct",
messages=[{"role": "user", "content": user_input}]
)
print(response.choices[0].message.content)
else:
print(f"Blocked: {result.reason}")With OpenAI-Compatible Endpoint
from openai import OpenAI
client = OpenAI(
api_key="your-fireworks-api-key",
base_url="https://api.fireworks.ai/inference/v1"
)
result = guard.evaluate(user_input)
if result.is_safe:
response = client.chat.completions.create(
model="accounts/fireworks/models/llama-v3p1-70b-instruct",
messages=[{"role": "user", "content": user_input}]
)What Gets Protected
- Input screening — blocks prompt injections and harmful content before reaching Fireworks models
- SDK flexibility — works with native Fireworks SDK or OpenAI-compatible client
- Fast inference — minimal guardrail latency paired with Fireworks' optimized serving