tutorial

How to Monitor Together AI with Vigilmon

"Monitor Together AI's open-source LLM inference platform with Vigilmon — track API availability, model latency, token throughput, rate limits, and set up alerts for inference degradation across serverless and dedicated GPU endpoints."

How to Monitor Together AI with Vigilmon

Together AI provides a unified inference API for running, fine-tuning, and deploying open-source LLMs at scale — Llama 3, Mistral, Qwen, DBRX, and dozens of others — through serverless and dedicated GPU endpoints. Its OpenAI-compatible API lets teams swap it in for production workloads without rewriting application code.

When inference is unavailable or slow, every downstream feature that touches Together AI degrades. Monitoring with Vigilmon gives you immediate visibility into API availability, latency shifts, and silent failures across the models your application depends on.


Why Monitor Together AI

Together AI is a cloud-hosted inference platform, which means your application's reliability is partially tied to their infrastructure. Common failure modes:

  1. API availability — endpoints returning 5xx errors or timing out entirely
  2. Latency degradation — time-to-first-token climbing from sub-second to multi-second, silently breaking real-time use cases
  3. Model-specific outages — one model endpoint (meta-llama/Llama-3-70b-chat-hf) degraded while others remain healthy
  4. Serverless cold starts — serverless endpoints have variable warm-up latency; unexpected spikes indicate cold-start issues
  5. Rate limit exhaustion — hitting per-minute or daily token limits returns 429 errors that look like transient failures
  6. Fine-tuned model endpoint unavailability — custom fine-tuned models hosted on Together AI can go stale or be taken offline

Without monitoring, latency regressions and availability drops are invisible until users report broken features.


Key Metrics to Monitor

| Metric | Why it matters | |--------|---------------| | API availability | Is Together AI's inference API reachable? | | Time-to-first-token (TTFT) | Core latency — should be <1s for serverless, <500ms for dedicated | | Total response time | End-to-end latency including streaming | | Tokens per second | Throughput indicator; drops before TTFT degrades | | HTTP status codes | 429 = rate limit, 503 = capacity issue, 401 = key rotation needed | | Model-specific health | Individual model endpoints may degrade independently |


Setup Guide

1. Monitor the Models Endpoint

The /models endpoint is the lightest available probe — it confirms API reachability and authentication without consuming tokens or GPU time:

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

Security note: Create a dedicated Together AI API key for monitoring only. Do not reuse your production application key.

2. Monitor the Together AI Status Page

Together AI publishes a status page. Add a keyword monitor to catch provider-posted incidents before your API probes fail:

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

This frequently alerts you to incidents before your synthetic probes detect them.

3. Build a Synthetic Latency Probe

For applications where inference latency matters, run a lightweight synthetic check against your primary model on a schedule:

# health/together_probe.py
import time
import os
import httpx

TOGETHER_MONITORING_KEY = os.environ["TOGETHER_MONITORING_API_KEY"]
TOGETHER_BASE_URL = "https://api.together.xyz/v1"

def probe_together_latency(
    model: str = "meta-llama/Llama-3-8b-chat-hf",
) -> dict:
    """
    Minimal inference probe — measures TTFT and total response time.
    Uses a small, fast model to minimize cost and latency.
    """
    headers = {
        "Authorization": f"Bearer {TOGETHER_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"{TOGETHER_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 != "data: [DONE]":
                        import json
                        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 this as a health endpoint:

# app/api/health/together/route.py (FastAPI)
from fastapi import FastAPI
from fastapi.responses import JSONResponse
from health.together_probe import probe_together_latency

app = FastAPI()

@app.get("/health/together")
def together_health():
    result = probe_together_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/together
  2. Keyword check: "ok":true
  3. Interval: 5 minutes
  4. Response time warning: 3000ms
  5. Response time critical: 8000ms
  6. Save

4. Monitor Multiple Models

If your application uses different Together AI models for different tasks (fast routing with a small model, deep reasoning with a large one), create separate probes:

# health/together_multi_model.py

MODELS_TO_PROBE = [
    "meta-llama/Llama-3-8b-chat-hf",      # fast/cheap queries
    "meta-llama/Llama-3-70b-chat-hf",     # complex reasoning
    "mistralai/Mixtral-8x7B-Instruct-v0.1", # fallback model
]

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

Set up a separate Vigilmon monitor per critical model so degradation on one model doesn't mask health of others.

5. Heartbeat Monitoring for Fine-Tune Jobs

Together AI supports serverless and dedicated fine-tuned model endpoints. If your application calls a custom fine-tuned model on a schedule, use a Vigilmon heartbeat monitor to catch silent job failures:

# tasks/batch_inference.py
import httpx
import os

def run_batch_inference():
    # ... your batch inference logic ...
    process_batch()

    # Ping heartbeat on successful completion
    heartbeat_url = os.environ.get("VIGILMON_BATCH_HEARTBEAT")
    if heartbeat_url:
        httpx.get(heartbeat_url, timeout=5)

# Run on a schedule — if this stops completing, Vigilmon alerts you

In Vigilmon:

  1. New Monitor → Heartbeat
  2. Set expected interval to match your job frequency
  3. Copy the ping URL into VIGILMON_BATCH_HEARTBEAT

Alerting

Configure alert channels for your Together AI monitors:

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

Recommended thresholds:

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

Latency threshold setup

  1. Open your Together AI API monitor → Advanced Settings
  2. Response time warning: 3000ms (serverless endpoints can have higher baseline latency)
  3. Response time critical: 10000ms (at this point inference is not viable for interactive use)

Fallback Strategy

If Together AI is degraded and you have a fallback provider:

import os
import httpx

TOGETHER_KEY = os.environ["TOGETHER_API_KEY"]
FALLBACK_KEY = os.environ["OPENAI_API_KEY"]  # or another provider

def generate_with_fallback(prompt: str, model: str = "meta-llama/Llama-3-8b-chat-hf") -> tuple[str, str]:
    """Returns (response_text, provider_used)"""
    try:
        response = httpx.post(
            "https://api.together.xyz/v1/chat/completions",
            headers={"Authorization": f"Bearer {TOGETHER_KEY}"},
            json={
                "model": model,
                "messages": [{"role": "user", "content": prompt}],
                "max_tokens": 1024,
            },
            timeout=10.0,
        )
        response.raise_for_status()
        return response.json()["choices"][0]["message"]["content"], "together_ai"

    except Exception as e:
        print(f"[ai] Together AI failed, falling back: {e}")

        response = httpx.post(
            "https://api.openai.com/v1/chat/completions",
            headers={"Authorization": f"Bearer {FALLBACK_KEY}"},
            json={
                "model": "gpt-4o-mini",
                "messages": [{"role": "user", "content": prompt}],
                "max_tokens": 1024,
            },
            timeout=30.0,
        )
        response.raise_for_status()
        return response.json()["choices"][0]["message"]["content"], "openai"

Log provider_used so you know how often you're in fallback mode. Track this as a metric — sustained fallback use means your primary provider needs attention.


Conclusion

Together AI gives you access to a wide range of open-source models through a single unified API. When that API is degraded — whether through availability issues, latency spikes, or model-specific outages — the impact on your application can be subtle and hard to diagnose without monitoring in place.

Vigilmon's HTTP monitors catch availability failures immediately, latency thresholds surface performance regressions before users notice, and heartbeat monitors ensure batch inference jobs don't silently stop running.

Set up the models endpoint monitor now (5 minutes, costs nothing), then add the synthetic latency probe if Together AI is in your critical inference path.


Further Reading

Monitor your app with Vigilmon

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

Start free →