Skip to content

Provider for OpenAI-compatible local servers (llama.cpp, vLLM, LM Studio) #10

Open

Description

@AdityaWagh06

Problem
Only Ollama is supported for live runs. llama.cpp's llama-server, vLLM, and LM Studio all expose an OpenAI-compatible /v1/chat/completions endpoint locally. One provider would cover all three, and it would also make it possible to compare runtimes against each other.

Expected behavior

id: llamacpp-q4
provider: openai_compatible
base_url: http://localhost:8080/v1
model: local-model
options: {temperature: 0, seed: 42}

The provider sends messages: [{"role": "user", "content": case.input}] (with an optional system), and reads choices[0].message.content. It uses the standard library only, like the Ollama provider.

Scope / where
src/modeldiff/providers.py, CONFIG_SCHEMA in config.py, build_provider, and the README section on local models. See "Adding a provider" in docs/architecture.md.

Acceptance criteria

  • No API key is required. If an optional api_key_env is supported, it reads the key from an environment variable, and the key never appears in result files.
  • Connection errors, HTTP errors, and malformed responses become ProviderError with a clear message.
  • Usage counts from the response are stored in provider_metadata.

Tests
Mocked urlopen tests modelled on the Ollama tests in tests/test_config_and_providers.py. No running server is needed.

Definition of done
Tests pass, the README is updated, and there is an example config in examples/.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions