> For the complete documentation index, see [llms.txt](https://seekspeed.gitbook.io/seekspeed-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://seekspeed.gitbook.io/seekspeed-docs/spec-lab/adapters.md).

# Adapters: vLLM, TGI, llama.cpp

The Spec Lab speaks to inference servers via a small adapter interface. Each adapter implements:

```ts
interface SpecAdapter {
  probe(baseUrl: string): Promise<{ ok: boolean; info: string; metrics?: { acceptanceRate?: number; tokensPerStep?: number } }>;
  generate(opts: { baseUrl: string; apiKey?: string; model: string; prompt: string; maxTokens: number; }): Promise<{ totalMs: number; tokensOut: number }>;
}
```

`generate` is identical across adapters — it's an OpenAI-compatible `/chat/completions` call. The interesting difference is `probe`.

## vLLM

Reads Prometheus-format `/metrics` and extracts `vllm:spec_decode_num_*` counters. This is the only adapter that surfaces native acceptance rate and tokens-per-step. Recommended for any [DeepSpec](/seekspeed-docs/spec-lab/deepspec.md) or [DSpark](/seekspeed-docs/spec-lab/dspark.md) workload.

```ts
async function probeVllm(baseUrl: string) {
  const m = await fetch(baseUrl.replace(/\/v1$/, "") + "/metrics");
  if (!m.ok) return { ok: false, info: "vLLM /metrics unreachable" };
  const txt = await m.text();
  const get = (k: string) => {
    const v = txt.match(new RegExp(`^${k}\\s+([0-9eE+\\-.]+)`, "m"));
    return v ? Number(v[1]) : NaN;
  };
  const accepted = get("vllm:spec_decode_num_accepted_tokens_total");
  const drafted  = get("vllm:spec_decode_num_draft_tokens_total");
  const emitted  = get("vllm:spec_decode_num_emitted_tokens_total");
  return {
    ok: true,
    info: "vLLM /metrics exposes spec_decode counters",
    metrics: {
      acceptanceRate: drafted > 0 ? accepted / drafted : undefined,
      tokensPerStep:  accepted > 0 ? emitted / accepted : undefined,
    },
  };
}
```

## TGI

Hits `/info` for model identity. TGI does not expose acceptance counters in the standard release, so the Spec Lab falls back to A/B-only speedup numbers without the bottleneck breakdown.

## llama.cpp

Hits `/props` (or `/v1/models` as a fallback). Same as TGI — A/B speedup only.

## Stub

For local development without an inference server. Generates fake but realistic metric distributions so the UI can be exercised offline.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://seekspeed.gitbook.io/seekspeed-docs/spec-lab/adapters.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
