Skip to main content

Module llm_mock

Module llm_mock 

Source
Expand description

Mock LLM endpoint (OpenAI/Anthropic-compatible) for agent testing (#912). Mock LLM endpoint (#912, #79 round 50 follow-up).

Serves OpenAI-compatible (POST /v1/chat/completions, GET /v1/models) and Anthropic-compatible (POST /v1/messages) endpoints so an agent (Cursor, Claude Code, ChatGPT clients, custom agents) can point its base URL at MockForge and receive correctly-shaped, deterministic completions for scale / offline / failure testing. This is a MOCK: it never calls a real model, it returns canned/templated text with realistic envelopes (ids, usage token counts, finish_reason / stop_reason) and supports SSE streaming when the caller sets stream: true.

Mounted by mockforge serve --llm-mock.

Structs§

LlmMockConfig
Runtime configuration for the mock LLM endpoint.

Functions§

router
Build the axum router exposing the mock LLM endpoints.