tutorial

How to Monitor Fireworks AI with Vigilmon

"Monitor Fireworks AI's high-performance LLM inference platform with Vigilmon — track API availability, token throughput, latency SLAs, function calling reliability, and multi-modal endpoint health."

How to Monitor Fireworks AI with Vigilmon

Fireworks AI is a high-performance LLM inference platform built for production speed and cost efficiency. It serves Llama, Mixtral, Firefunction, Gemma, and fine-tuned variants with competitive latency and cost-per-token, plus first-class support for compound AI workloads: function calling, JSON mode, multi-modal inputs, and fine-tuned model hosting.

For teams running production LLM workloads where latency and cost matter, any degradation in Fireworks AI's inference pipeline directly impacts user experience. Monitoring with Vigilmon gives you immediate visibility into API health, latency trends, and silent failures before users notice.


Why Monitor Fireworks AI

Fireworks AI's core differentiation is speed and reliability for open-source model inference. Its failure modes include:

  1. API availability — inference endpoints returning 5xx errors or becoming unreachable
  2. Latency regression — time-to-first-token climbing above your application's latency budget, degrading chat, autocomplete, or agent response loops
  3. Function calling reliability — structured output and function call modes can degrade independently from standard chat completions
  4. Fine-tuned model endpoint failures — custom-hosted models can be unavailable while base models remain healthy
  5. Rate limiting — aggressive per-account or per-model rate limits returning 429 responses that look like transient errors
  6. JSON mode failures — structured JSON output may fail on certain model/prompt combinations during degraded states

Without monitoring, latency regressions are invisible until your users experience slow responses or broken features.


Key Metrics to Monitor

| Metric | Why it matters | |--------|---------------| | API availability | Is Fireworks AI reachable and responding? | | Time-to-first-token (TTFT) | Core latency — Fireworks targets <500ms for supported models | | Tokens per second | Throughput indicator; drops signal capacity issues | | Function calling success rate | Structured outputs fail before plain completions during degradation | | HTTP 429 rate | Rate limit exhaustion — need throttling or quota increase | | HTTP 503 rate | Capacity issues on the Fireworks backend | | Model-specific health | Degradation is often model-specific |


Setup Guide

1. Monitor the Models Endpoint

The Fireworks AI models endpoint confirms API reachability and authentication without consuming inference credits:

  1. Monitors → New Monitor
  2. Type: HTTP
  3. Method: GET
  4. URL: https://api.fireworks.ai/inference/v1/models
  5. Custom headers:
    • Authorization: Bearer fw_your-dedicated-monitoring-key
  6. Keyword check: accounts/fireworks
  7. Interval: 5 minutes
  8. Response timeout: 10000ms
  9. Save

Security note: Create a dedicated Fireworks AI API key for monitoring only. Never reuse your production application key — if the monitoring key is rotated or revoked, it won't break your application.

2. Monitor the Fireworks AI Status Page

Fireworks AI publishes a status page. Track it with a keyword monitor:

  1. Type: HTTP
  2. URL: https://status.fireworks.ai
  3. Keyword check: All Systems Operational
  4. Interval: 5 minutes
  5. Save

Status page failures often precede API probe failures, giving you earlier warning.

3. Build a Synthetic Latency Probe

For production applications where inference latency is part of your SLA, run a lightweight synthetic probe on a schedule:

# health/fireworks_probe.py
import time
import os
import httpx
import json

FIREWORKS_MONITORING_KEY = os.environ["FIREWORKS_MONITORING_API_KEY"]
FIREWORKS_BASE_URL = "https://api.fireworks.ai/inference/v1"

def probe_fireworks_latency(
    model: str = "accounts/fireworks/models/llama-v3p1-8b-instruct",
) -> dict:
    """
    Minimal inference probe — measures TTFT and total response time.
    Uses a fast, cheap model to minimize probe cost and latency.
    """
    headers = {
        "Authorization": f"Bearer {FIREWORKS_MONITORING_KEY}",
        "Content-Type": "application/json",
    }

    payload = {
        "model": model,
        "messages": [{"role": "user", "content": "Reply with exactly: ok"}],
        "max_tokens": 5,
        "stream": True,
    }

    start = time.time()
    first_token_at = None
    content = ""

    try:
        with httpx.Client(timeout=30) as client:
            with client.stream(
                "POST",
                f"{FIREWORKS_BASE_URL}/chat/completions",
                headers=headers,
                json=payload,
            ) as response:
                response.raise_for_status()
                for line in response.iter_lines():
                    if line.startswith("data: ") and line.strip() != "data: [DONE]":
                        chunk = json.loads(line[6:])
                        delta = chunk["choices"][0].get("delta", {}).get("content", "")
                        if delta and first_token_at is None:
                            first_token_at = time.time()
                        content += delta

        ttft_ms = int((first_token_at - start) * 1000) if first_token_at else None
        total_ms = int((time.time() - start) * 1000)

        return {
            "ok": "ok" in content.lower(),
            "ttft_ms": ttft_ms,
            "total_ms": total_ms,
            "model": model,
        }

    except Exception as e:
        return {
            "ok": False,
            "ttft_ms": None,
            "total_ms": int((time.time() - start) * 1000),
            "error": str(e),
            "model": model,
        }

Expose as a health endpoint:

# app/api/health/fireworks/route.py (FastAPI)
from fastapi import FastAPI
from fastapi.responses import JSONResponse
from health.fireworks_probe import probe_fireworks_latency

app = FastAPI()

@app.get("/health/fireworks")
def fireworks_health():
    result = probe_fireworks_latency()
    if not result["ok"]:
        return JSONResponse(content=result, status_code=503)
    return result

Monitor this endpoint in Vigilmon:

  1. URL: https://yourapp.com/health/fireworks
  2. Keyword check: "ok":true
  3. Interval: 5 minutes
  4. Response time warning: 2000ms
  5. Response time critical: 5000ms
  6. Save

4. Monitor Function Calling Reliability

Function calling and JSON mode are distinct code paths in LLM serving. If your application relies on structured output, add a dedicated probe:

# health/fireworks_function_probe.py
import time
import os
import httpx
import json

FIREWORKS_MONITORING_KEY = os.environ["FIREWORKS_MONITORING_API_KEY"]

HEALTH_CHECK_TOOL = {
    "type": "function",
    "function": {
        "name": "health_check",
        "description": "Return health status",
        "parameters": {
            "type": "object",
            "properties": {
                "status": {
                    "type": "string",
                    "enum": ["ok"],
                }
            },
            "required": ["status"],
        },
    },
}

def probe_function_calling(
    model: str = "accounts/fireworks/models/firefunction-v2",
) -> dict:
    headers = {
        "Authorization": f"Bearer {FIREWORKS_MONITORING_KEY}",
        "Content-Type": "application/json",
    }

    payload = {
        "model": model,
        "messages": [
            {"role": "user", "content": "Call health_check with status ok."}
        ],
        "tools": [HEALTH_CHECK_TOOL],
        "tool_choice": {"type": "function", "function": {"name": "health_check"}},
        "max_tokens": 50,
    }

    start = time.time()
    try:
        with httpx.Client(timeout=30) as client:
            response = client.post(
                "https://api.fireworks.ai/inference/v1/chat/completions",
                headers=headers,
                json=payload,
            )
            response.raise_for_status()
            data = response.json()

        tool_calls = data["choices"][0]["message"].get("tool_calls", [])
        if tool_calls:
            args = json.loads(tool_calls[0]["function"]["arguments"])
            success = args.get("status") == "ok"
        else:
            success = False

        return {
            "ok": success,
            "total_ms": int((time.time() - start) * 1000),
            "model": model,
        }

    except Exception as e:
        return {
            "ok": False,
            "total_ms": int((time.time() - start) * 1000),
            "error": str(e),
            "model": model,
        }

Add a separate Vigilmon monitor for this endpoint so function calling failures are visible independently of plain chat completions.

5. Monitor Multiple Models

Fireworks AI often runs different models for different task types. Monitor each critical model separately:

# health/fireworks_multi_model.py

MODELS_TO_PROBE = [
    "accounts/fireworks/models/llama-v3p1-8b-instruct",   # fast/cheap
    "accounts/fireworks/models/llama-v3p1-70b-instruct",  # complex reasoning
    "accounts/fireworks/models/mixtral-8x7b-instruct",    # fallback
    "accounts/fireworks/models/firefunction-v2",           # function calling
]

def probe_all_models() -> dict:
    results = {}
    for model in MODELS_TO_PROBE:
        results[model] = probe_fireworks_latency(model)
    return {
        "ok": all(r["ok"] for r in results.values()),
        "models": results,
    }

Create one Vigilmon HTTP monitor per critical model. Model-level granularity means a degraded mixtral doesn't mask a healthy llama-v3p1-8b-instruct.


Alerting

Configure alert channels for your Fireworks AI monitors:

  1. Open monitor → Alerts → Add Channel
  2. Recommended setup:
    • Slack #ai-ops: immediate notification on API failure or TTFT spike
    • Email: on-call engineer for 2+ consecutive failures
    • PagerDuty: if Fireworks AI is the sole inference backend for a live user-facing product

Recommended thresholds:

| Monitor | Alert condition | Escalation | |---------|----------------|------------| | Models endpoint | 1 failure | 2 consecutive → email | | Status page keyword | 1 failure | Informational | | Synthetic latency probe | 2 consecutive failures | 3 failures → PagerDuty | | Function calling probe | 1 failure | 2 consecutive → page | | Response time warning | >2000ms | >5000ms → page |

Latency threshold setup

Fireworks AI targets sub-500ms TTFT for supported models. Set your thresholds accordingly:

  1. Open your Fireworks AI monitor → Advanced Settings
  2. Response time warning: 2000ms (TTFT above this means something's wrong)
  3. Response time critical: 5000ms (at this point inference is too slow for interactive use)

Fallback Strategy

When Fireworks AI is degraded, route to a fallback provider:

import os
import httpx

FIREWORKS_KEY = os.environ["FIREWORKS_API_KEY"]
FALLBACK_KEY = os.environ["TOGETHER_API_KEY"]  # or any OpenAI-compatible provider

def generate_with_fallback(prompt: str) -> tuple[str, str]:
    """Returns (response_text, provider_used)"""
    try:
        response = httpx.post(
            "https://api.fireworks.ai/inference/v1/chat/completions",
            headers={"Authorization": f"Bearer {FIREWORKS_KEY}"},
            json={
                "model": "accounts/fireworks/models/llama-v3p1-8b-instruct",
                "messages": [{"role": "user", "content": prompt}],
                "max_tokens": 1024,
            },
            timeout=8.0,  # Fail fast if Fireworks is degraded
        )
        response.raise_for_status()
        return response.json()["choices"][0]["message"]["content"], "fireworks_ai"

    except Exception as e:
        print(f"[ai] Fireworks AI failed, using fallback: {e}")

        response = httpx.post(
            "https://api.together.xyz/v1/chat/completions",
            headers={"Authorization": f"Bearer {FALLBACK_KEY}"},
            json={
                "model": "meta-llama/Llama-3-8b-chat-hf",
                "messages": [{"role": "user", "content": prompt}],
                "max_tokens": 1024,
            },
            timeout=30.0,
        )
        response.raise_for_status()
        return response.json()["choices"][0]["message"]["content"], "together_ai"

Track provider_used as a metric. Sustained fallback use is a signal to investigate your primary provider.


Conclusion

Fireworks AI's value is speed and cost-efficiency for production open-source model inference. Latency regressions and availability gaps erode that value proposition immediately — and without monitoring, they're invisible until users notice.

Vigilmon's HTTP monitors catch availability failures, latency threshold alerts surface performance regressions early, and dedicated function calling probes ensure your structured output pipeline is as reliable as your plain completions.

Start with the models endpoint monitor (5 minutes, free), then layer in the synthetic latency probe and function calling probe if those paths are critical to your application.


Further Reading

Monitor your app with Vigilmon

Free plan — 5 monitors, no credit card required. Up and running in 60 seconds.

Start free →