Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

Local LLM Mock Server: Stop Wasting API Credits in Dev

Описание и применение

Использование локального сервера‑мок для LLM позволяет разработчикам экономить деньги, устранять сетевые задержки и получать предсказуемые тесты, ускоряя цикл разработки.

Задача

Developers using live LLM APIs during local development and testing incur high costs, network latency, and flaky tests, breaking the inner loop and increasing budget.

Результат

Switching to a local LLM mock server cuts API costs to zero, eliminates network latency and flakiness, and enables deterministic, fast, and reliable testing both locally and in CI/CD.

Рабочий процесс

  • 1. Install a mock server tool such as llm-mock or llmposter. 2. Configure the SDK client to use a local baseURL via an environment variable (e.g., NEXT_PUBLIC_LLM_MOCK_URL). 3. Set NEXT_PUBLIC_LLM_MOCK_URL to http://localhost:3001 in .env.local. 4. Run the mock server locally. 5. Verify that all LLM requests are routed to the mock server. 6. Use the mock to simulate streaming, deterministic responses, and error conditions. 7. Dockerize the mock server and add it to CI/CD pipelines alongside the test runner.

Доказательства

Even with inexpensive models, API costs add up. A test suite running 3,000 calls a day might seem trivial, but at scale, it translates to hundreds of dollars per month per developer.

Источник

By setting NEXT_PUBLIC_LLM_MOCK_URL to http://localhost:3001 in your .env.local file, you instantly shift all traffic to your local server.

Источник

  • Дата записи: 2026-09-17T15:00:11.218Z