Skip to content

feat: add Hoonify AI chat provider - #3499

Open
jelveh wants to merge 1 commit into
mainfrom
hoonify-provider
Open

feat: add Hoonify AI chat provider#3499
jelveh wants to merge 1 commit into
mainfrom
hoonify-provider

Conversation

@jelveh

@jelveh jelveh commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Adds Hoonify — an OpenAI-compatible gateway for open-weights models — as a chat provider for the puter-chat-completion interface.

What

  • HoonifyProvider: OpenAI SDK against https://api.hoonify.ai/v1 (overridable via providers.hoonify.apiBaseUrl), streaming with include_usage, tool calling, and Hoonify's top_k sampling extension via custom.top_k.
  • Static model catalog (GLM-5.2, Gemma 4 31B Instruct, Qwen3.6-27B) priced from Hoonify's published catalog. Static rather than fetched because GET /v1/models carries no prices — a dynamic catalog would meter usage at zero cost.
  • Registered as an aggregator so its aliases can never shadow first-party providers. Catalog ids are namespaced (hoonify:<vendor>/<model>); the lowercased ids map back to exact-case wire ids via a wireId field. Qwen/Qwen3.6-27B deliberately gets no vendor-scoped alias — it collides with an existing Alibaba alias, and a colliding alias drops the whole model from the routing map (a test pins this).
  • Enabled by providers.hoonify.apiKey; disabled otherwise. No puter.js/type changes needed — model discovery is dynamic.

Testing

  • 23 offline unit tests (mocked OpenAI SDK, real in-memory PuterServer + live MeteringService): request shape, alias/wire-id resolution, non-stream + streaming output, metering costs, tool calls, error passthrough.
  • Env-gated integration test (PUTER_TEST_AI_HOONIFY_API_KEY) — passes against the live API, as does a driver-level end-to-end completion. Live checks also confirmed the models endpoint matches the shipped catalog and that streaming emits a final usage chunk.
  • Driver suites pass (44/44 incl. updated registration/cost-line assertions); full backend run shows no new failures vs a stashed-HEAD baseline.

No auth/permission surface changes; the provider only activates when a key is configured.

@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 93.32%
⬆️ +0.02%
20788 / 22274
🔵 Statements 91.72%
⬆️ +0.03%
22262 / 24271
🔵 Functions 89.31%
⬆️ +0.04%
3477 / 3893
🔵 Branches 80.26%
⬆️ +0.02%
15134 / 18855
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
src/backend/drivers/ai-chat/ChatCompletionDriver.ts 93.38%
⬆️ +0.87%
85.04%
⬆️ +0.76%
96.66%
🟰 ±0%
94.69%
⬆️ +0.91%
141-144, 262, 292, 306, 339-341, 431-435, 464, 640, 664, 670, 677, 1047, 1060-1066, 1072-1077, 1107, 1115, 1134
src/backend/drivers/ai-chat/providers/hoonify/HoonifyProvider.ts 100% 87.09% 100% 100%
src/backend/drivers/ai-chat/providers/hoonify/models.ts 100% 100% 100% 100%
Generated in workflow #652 for commit c7c1ec4 by the Vitest Coverage Report Action

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