Skip to content

feat(providers): add chat-completions provider (OpenAI Chat Completions-compatible endpoints) - #127

Merged
Salil Das (sadlilas) merged 2 commits into
mainfrom
add-provider-chat-completions
Aug 18, 2026
Merged

feat(providers): add chat-completions provider (OpenAI Chat Completions-compatible endpoints)#127
Salil Das (sadlilas) merged 2 commits into
mainfrom
add-provider-chat-completions

Conversation

@bkrabach

Copy link
Copy Markdown
Contributor

Summary

Adds chat-completions as a first-class provider in amplifier-agent's provider catalog, wiring up the existing official module amplifier-module-provider-chat-completions. It speaks the OpenAI Chat Completions wire format (/v1/chat/completions) and targets any compatible server — llama.cpp, vLLM, LM Studio, LocalAI, SGLang, TGI, and other OpenAI-compatible endpoints.

The module is listed in the ecosystem MODULES.md but was not selectable from amplifier-agent, whose provider set is hardcoded. ISSUES.md already notes this seam ("adding a provider requires editing five literals … nothing enforces agreement across them"); this PR makes them agree for chat-completions.

Note: this is distinct from the existing openai provider, which uses the OpenAI Responses API and therefore cannot be pointed at a llama.cpp/vLLM server. Filling that gap is the point of this provider.

What changed

Code

  • config/loader.py: add chat-completions to _VALID_PROVIDER_MODULES so provider.module: chat-completions passes config validation.
  • provider_sources.py: add to KNOWN_PROVIDERS and PROVIDER_CATALOG; add a dedicated resolve_credential_detailed branch that reads CHAT_COMPLETIONS_BASE_URL (required) and optional CHAT_COMPLETIONS_API_KEY. A dedicated branch (rather than a PROVIDER_CREDENTIAL_VARS entry) is required because the generic path routes the primary env var into api_key; here the value must land in base_url.
  • bundle.md: declare provider-chat-completions in the install-only stub list so it cold-prepares uniformly with the other providers.

Docs: README, docs/spec/providers-and-models.md, docs/spec/host-config.md, docs/CONFIGURATION.md, docs/spec/bundle-and-cache.md, docs/LAYERS_AND_RELEASES.md, docs/INTEGRATION.md, skills/amplifier-agent/SKILL.md, docs/architecture/architecture.dot, CHANGELOG.md.

Verification (Digital Twin, real model — no mocks)

Verified end-to-end in an isolated container running the patched build (amplifier-agent 0.12.0) against a real Ollama server serving qwen2.5:0.5b:

  • providers list: chat-completions appears; reports resolvable=false/source=none without CHAT_COMPLETIONS_BASE_URL, and flips to resolvable=true/source=env when it is set — exercises both the catalog entry and the credential-resolution branch.
  • Loader negative control: an invalid provider.module is rejected with must be one of [… 'chat-completions' …] — proves the loader gate now includes it (an unpatched build rejects chat-completions outright).
  • Real routing: amplifier-agent run drove real POST /v1/chat/completions calls into the endpoint (confirmed in Ollama's own request log, all HTTP 200) and real, non-empty completions flowed back through the provider — not a silent fallback to another provider.
  • Cold-prepare: bundle prepare succeeds with the 6-provider bundle.md; the prepared bundle declares all six providers including provider-chat-completions.

Honest caveat: a fully-terminated run envelope was not captured because prompt prefill of a 0.5B model on aarch64 CPU (~12 tok/s) makes each agentic call ~4–5 min; the provider path itself is proven by the routing + real-completion evidence above. On a GPU host or a hosted OpenAI-compatible endpoint the same config completes in seconds.

Added chat-completions as an official provider, supporting any OpenAI Chat
Completions-compatible endpoint (llama.cpp, vLLM, LM Studio, LocalAI, etc.).

Changes:
- loader.py: added 'chat-completions' to _VALID_PROVIDER_MODULES
- provider_sources.py: added to KNOWN_PROVIDERS and PROVIDER_CATALOG, with a
  dedicated resolve_credential_detailed branch that correctly routes
  CHAT_COMPLETIONS_BASE_URL (required) into base_url and optional
  CHAT_COMPLETIONS_API_KEY into api_key (not clobbered by host config)

🤖 Generated with Amplifier

Co-Authored-By: Amplifier <240397093+microsoft-amplifier@users.noreply.github.com>
…le stub

Updated bundle.md to add provider-chat-completions to the providers install-only
stub list, ensuring it cold-prepares uniformly with the other providers.

Updated all provider documentation and references:
- README.md: six providers (was five)
- docs/CONFIGURATION.md: env-var and config docs for CHAT_COMPLETIONS_BASE_URL/API_KEY
- docs/spec/providers-and-models.md: detailed chat-completions spec and examples
- docs/spec/host-config.md: config schema entry
- docs/spec/bundle-and-cache.md: six providers reference
- docs/LAYERS_AND_RELEASES.md: six providers reference
- docs/INTEGRATION.md: six providers reference
- docs/architecture/architecture.dot: six providers reference
- skills/amplifier-agent/SKILL.md: six providers reference
- CHANGELOG.md: [Unreleased] entry for chat-completions provider

🤖 Generated with [Amplifier](https://github.com/microsoft/amplifier)

Co-Authored-By: Amplifier <240397093+microsoft-amplifier@users.noreply.github.com>
@sadlilas
Salil Das (sadlilas) force-pushed the add-provider-chat-completions branch from 33155e2 to a731075 Compare August 18, 2026 05:06
@sadlilas
Salil Das (sadlilas) merged commit 409f161 into main Aug 18, 2026
3 checks passed
@sadlilas
Salil Das (sadlilas) deleted the add-provider-chat-completions branch August 18, 2026 05:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants