Hacktoberfest 2026: die Issues, die Maintainer für den Oktober markiert haben – offen und einsteigerfreundlich. Hacktoberfest-Issues durchsuchen

Add an openai-compatible provider type and registerProvider() for custom providers

Geschlossen
#238 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

@Pratham2511 arbeitet bereits daran.

Seit 21.10.2026.

  • #289 von @Pratham2511 — gemerged

Bewertung

Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Anfängerfreundlichkeit
58/100
Issue-Typ
Feature
Klarheit
Klar beschrieben
Aktivitätsstatus
Aktiv
Tech-Stack
typescript

Rechercherichtung

Start with packages/core/src/providers/base.ts and openai.ts, then review types.ts and the provider config and OpenAI tests named in the issue. Add the compatible provider options and custom provider registry while preserving the built-in provider behavior. Done means the listed acceptance tests pass, pnpm test:coverage and pnpm lint pass, and the @chatcops/core minor changeset is included.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

core enhancement hacktoberfest help wanted

Pointing ChatCops at Ollama, LM Studio, vLLM, Groq or OpenRouter works today through type: 'openai' with a baseURL, but it's awkward. You need an API key even when the server doesn't use one, it sends max_completion_tokens, which many of those servers don't know, and there's no way to turn tools off for a model that can't call them. A provider that isn't OpenAI-shaped can't be plugged in at all: createProvider only knows three types (packages/core/src/providers/base.ts, lines 10 to 27).

What to do

  1. A built-in openai-compatible type:
    provider: {
      type: 'openai-compatible',
      baseURL: 'http://localhost:11434/v1',   // required
      model: 'llama3.2',                      // required, no default
      apiKey: process.env.GROQ_API_KEY,       // optional
      headers: { 'HTTP-Referer': 'https://acme.com' },  // optional, sent on every request
      supportsTools: false,                   // optional, default true
    }
    
    • It runs on the OpenAI SDK, like the openai type. Give OpenAIProvider's constructor (packages/core/src/providers/openai.ts, line 42) a small options argument rather than copying the class. name is 'openai-compatible', and headers becomes the SDK's defaultHeaders.
    • maxTokensParam defaults to 'max_tokens' for this type.
    • Without apiKey, pass a placeholder to the SDK, since it refuses to start with none.
    • With supportsTools: false, don't send tools, and log one warning if the server config has tools.
    • Throw a clear error at setup when baseURL or model is missing.
  2. registerProvider(type, factory) in a new packages/core/src/providers/registry.ts, exported from @chatcops/core:
    registerProvider('my-llm', async (config) => new MyProvider(config));
    
    • createProvider looks up registered types before the built-in switch.
    • Registering a built-in name (claude, openai, gemini, openai-compatible) throws.
    • Registering the same custom name twice replaces it, so hot reload works.
    • ProviderConfig.type (packages/core/src/types.ts) widens to the four built-ins plus (string & {}), so editors still suggest the built-ins.
    • apiKey becomes optional in the type. The three hosted providers throw a clear error at setup when it's missing, which the server already reports nicely since #216.

Where to look

  • packages/core/src/providers/base.ts (createProvider)
  • packages/core/src/providers/openai.ts (constructor and request())
  • packages/core/tests/providers/provider-config.test.ts, openai.test.ts
  • website/src/content/docs/core/providers.mdx (a separate issue updates the docs page once this lands)

Acceptance criteria

  • openai-compatible works without an API key, sends max_tokens, sends the extra headers, and leaves out tools when supportsTools is false (tests with a fake client or a fake fetch)
  • A missing baseURL or model gives a clear setup error
  • registerProvider works for a custom type, refuses built-in names, and replaces on a second register
  • An unknown, unregistered type still gives Unknown provider type: ...
  • If you have Ollama or LM Studio running locally, say in the PR whether a real request worked (optional, but it helps)
  • Changeset for @chatcops/core (minor)
  • pnpm test:coverage and pnpm lint pass

Please get this merged by Nov 3. I rewrite openai.ts after that.


Want to work on this? Comment below and I'll assign it to you. Please take one issue at a time, branch off dev, and open your PR against dev with Closes #<this issue number>. Setup notes (pnpm, build before test) are in CONTRIBUTING.md.

Vorherrschende Sprache
TypeScript
Sterne
13
Forks
7
Ø Merge
3 Std. 28 Min.
Gemergte PRs (30 T.)
182

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus codercops/chatcops

Alle Issues in codercops/chatcops

Ähnliche Issues

Weitere Issues zu TypeScript

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.