Skip to content

feat: add an OpenAI-compatible model adapter example - #4

Merged
autoantohaki merged 1 commit into
mainfrom
feat/openai-compatible-adapter
Oct 21, 2026
Merged

autoantohaki merged 1 commit into
mainfrom
feat/openai-compatible-adapter

Conversation

@autoantohaki

Copy link
Copy Markdown
Member

Requested by mau

Before: the only example adapter returns canned text, so connecting Relay Chat to a local model server means writing an adapter from scratch.

After: relay-chat -- node examples/openai-compatible-model.mjs chats with any server that streams /chat/completions. It defaults to Impossible Inference on http://127.0.0.1:8080/v1 with its curated model, and works with Ollama by changing RELAY_OPENAI_BASE_URL.

How: the adapter turns the Relay Chat request into a chat-completions body (system prompt first, only fields Impossible Inference accepts), parses the SSE stream (ignoring keepalive comments), and emits model, delta, usage, and done chunks. HTTP error envelopes become a protocol error. A test drives it through CommandTransport against a local SSE server.

@autoantohaki
autoantohaki merged commit 3394c39 into main Oct 21, 2026
12 checks passed
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.

1 participant