Models

What Is Custom LLM Integration?

The work of wiring a non-default LLM — self-hosted, fine-tuned, or third-party — into evaluation, tracing, gateway routing, and fallback infrastructure.

What Is Custom LLM Integration?

Custom LLM integration is the engineering work of wiring a non-default model — a self-hosted open-weight model, a private fine-tune, or a niche commercial provider — into the evaluation, observability, and gateway infrastructure your application already uses for first-party providers. In FutureAGI workflows, it covers SDK compatibility, request-response shape mapping, OpenTelemetry span emission, evaluator support for the new model surface, and routing/fallback rules in the gateway. When done right, the custom model appears on your dashboards exactly like an OpenAI or Anthropic call. When done poorly, it is a blind spot.

Why It Matters in Production LLM and Agent Systems

A custom LLM that is not integrated is not observable, and an unobservable model is one outage away from a Sev-1 you cannot debug. The team picks a self-hosted Llama deployment for cost reasons, wires it directly into the application, and ships. Three weeks later latency p99 doubles, eval-fail-rate spikes, and the trace dashboard shows nothing — the custom call never emitted spans. Engineers have to add instrumentation under fire, while users see degraded responses.

The pain is felt across roles. A platform engineer ships a custom model and discovers the existing Faithfulness evaluator does not consume the response shape it returns. A SRE sees runaway cost on a fallback chain because the custom provider does not surface usage telemetry. A product lead asks for a per-model quality dashboard and finds the custom model is missing from every chart. A compliance reviewer asks where the custom model’s prompts and outputs are logged for audit, and the answer is “in the application logs” — which are not retained for the audit window.

In 2026 stacks the integration surface keeps expanding. Open-weight models, regional providers, fine-tunes per customer, and on-prem deployments are common. Custom LLM integration has to scale across the gateway (routing, fallback, cache), the trace layer (OpenTelemetry attributes), the eval layer (compatibility with reference-free metrics), and the registry (versioned model metadata). Skipping any layer creates exactly the blind spot you cannot afford.

How FutureAGI Handles Custom LLM Integration

FutureAGI’s approach is to expose every layer through its native primitive, so a custom integration looks identical to a first-party one. At the trace layer, the traceAI litellm integration plus a small custom-provider wrapper emits OpenTelemetry spans with llm.provider, llm.model, llm.token_count.prompt, and llm.token_count.completion for any model you can route through LiteLLM — which covers most self-hosted and OpenAI-compatible endpoints. For models with non-standard shapes, traceAI exposes a manual instrumentation API to emit the same span attributes from your code.

At the eval layer, fi.evals evaluators are model-agnostic — they consume input/output/context strings, so AnswerRelevancy, Groundedness, Faithfulness, and TaskCompletion work against any custom model output without modification. At the gateway layer, the Agent Command Center accepts custom-provider configurations and applies the same routing-policies, model-fallback, semantic-cache, and pre-guardrail primitives. Combined with the Model Registry, every custom model gets versioned metadata so a regression eval can pin against a build.

Compared to wiring a custom model directly into application code, the FutureAGI path keeps observability, eval, and fallback uniform — the custom model is not a special case. We’ve found that the integration time is dominated by getting the OpenTelemetry attributes right, not by the model call itself.

How to Measure or Detect It

Treat the custom model as a cohort and slice every metric by it:

  • llm.provider (OTel attribute): the canonical span attribute identifying the model source — filter dashboards by it.
  • llm.model (OTel attribute): the specific model build; pin against it for regression eval.
  • AnswerRelevancy, Groundedness, TaskCompletion: model-agnostic evaluators that work against custom outputs out-of-the-box.
  • Fallback rate (dashboard signal): how often custom-provider failures triggered a fallback to first-party — alert on spikes.
  • Cost per provider: per-provider token cost; verify the custom model’s economics against the assumption.
  • Latency p50/p99 by provider: side-by-side comparison; custom self-hosted models often surprise on tail latency.

Minimal Python:

from fi.evals import AnswerRelevancy

relevancy = AnswerRelevancy()

# custom model call (any provider) — output is a string
response = my_custom_llm(prompt)

result = relevancy.evaluate(input=prompt, output=response)
print(result.score, result.reason)

Common Mistakes

  • Wiring the custom model below the gateway. A direct call bypasses routing, cache, and fallback — restoring those is twice as much work as starting at the gateway.
  • Skipping OpenTelemetry instrumentation. Without llm.provider and llm.model attributes, the custom model never shows up in cohort dashboards.
  • Assuming first-party evaluators won’t work. Most reference-free evaluators (AnswerRelevancy, Groundedness) are model-agnostic — try them before writing a custom one.
  • Hardcoding the provider URL in the application. Use the gateway’s provider configuration so swapping the custom model does not require a deploy.
  • No version pin in the registry. A custom fine-tune that drifts silently between checkpoints invalidates regression evals.

Frequently Asked Questions

What is custom LLM integration?

Custom LLM integration is the wiring required to make a non-default model — self-hosted, fine-tuned, or niche-provider — work alongside first-party providers across evaluation, tracing, gateway routing, and fallback rules.

How is custom LLM integration different from a default provider call?

A default provider call uses a vetted SDK with built-in tracing and eval support. Custom integration adds the request shape, OpenTelemetry instrumentation, evaluator compatibility, and routing rules yourself.

How do you keep a custom LLM integration observable?

FutureAGI's traceAI custom integration emits OpenTelemetry spans with llm.provider and llm.model attributes; pair with fi.evals evaluators run against sampled traces to keep the custom model on parity with first-party ones.