Skip to content

feat(llm): CustomLLM — canonical Custom LLM provider for any OpenAI-compatible endpoint#165

Merged
nicolotognoni merged 1 commit into
mainfrom
feat/custom-llm
Jun 10, 2026
Merged

feat(llm): CustomLLM — canonical Custom LLM provider for any OpenAI-compatible endpoint#165
nicolotognoni merged 1 commit into
mainfrom
feat/custom-llm

Conversation

@nicolotognoni

Copy link
Copy Markdown
Collaborator

Summary

  • Ships CustomLLM, the canonical name for the generic OpenAI-compatible engine — the industry-standard "Custom LLM" pattern (same concept ElevenLabs Agents / Retell / Vapi expose under that name). One provider works with Hermes, OpenClaw, Ollama/vLLM/LM Studio, or any service implementing /chat/completions (SSE streaming + tool calls).
  • The Hermes / OpenClaw presets are unchanged and documented as thin subclasses of this same engine — use a preset when one exists, CustomLLM for everything else.
  • Hoists the session_key_from="caller_hash" / sessionKeyFrom: "caller_hash" per-caller memory selector from the Hermes preset into the generic provider, so any header-scoped runtime gets cross-call per-caller memory (patter-caller-<hash>, never the raw number).

Implementation

  • Python: new getpatter/llm/custom.py (custom.LLM, provider_key="custom") + top-level CustomLLM export; session_key_from moved into OpenAICompatibleLLMProvider.__init__ (same semantics, same error), hermes.py now delegates to it.
  • TypeScript: new src/llm/custom.ts (CustomLLM, CustomLLMOptions, providerKey='custom') + custom namespace export; sessionKeyFrom added to OpenAICompatibleLLMOptions with the resolution logic in the generic constructor, hermes.ts delegates.
  • Docs: new CustomLLM section in docs/python-sdk/llm.mdx and docs/typescript-sdk/llm.mdx (provider list), cross-linking the Hermes/OpenClaw integration guides.
  • Feature inventory row added (patter_sdk_features.xlsx).
  • No dependencies added.

Breaking change?

No. Additive only: new exports, new optional constructor field on the generic provider; presets behave byte-identically (regression-tested: Hermes session_key_from derivation and validation unchanged).

Test plan

  • Python: pytest tests/ -m 'not soak' — 2371 passed, 0 failed (incl. new tests/test_llm_custom.py, 11 tests: surface, exports, selector derivation, factory precedence, validation, Hermes delegation regression)
  • TypeScript: npx vitest run — 1834 passed, 0 failed (incl. new tests/unit/llm-custom.test.ts, 11 mirrored tests) + npm run lint + npm run build
  • Parity: identical naming map (CustomLLM/custom.LLMCustomLLM/custom.LLM), identical defaults and error messages
  • E2E smoke: N/A (no pipeline/handler changes)

Docs updates

  • docs/python-sdk/llm.mdx — new CustomLLM provider section
  • docs/typescript-sdk/llm.mdx — new CustomLLM provider section

🤖 Generated with Claude Code

…ompatible endpoint

One generic provider under the name the voice-AI ecosystem uses for the
pattern (cf. ElevenLabs/Retell/Vapi 'Custom LLM'): point Patter's pipeline
at any /chat/completions endpoint — agent runtimes (Hermes, OpenClaw),
keyless local gateways (Ollama/vLLM/LM Studio), or your own service.

- Python: getpatter.llm.custom.LLM + top-level CustomLLM export.
- TypeScript: CustomLLM named export + custom namespace + CustomLLMOptions.
- session_key_from='caller_hash' / sessionKeyFrom hoisted from the Hermes
  preset into the generic OpenAICompatibleLLMProvider so any header-scoped
  runtime gets per-caller cross-call memory (patter-caller-<hash>, never
  the raw number); the Hermes preset now delegates to it (behaviour
  unchanged, regression-tested).
- Docs: CustomLLM section in docs/python-sdk/llm.mdx + docs/typescript-sdk/llm.mdx.

Additive only — no defaults changed, presets unchanged.
@mintlify

mintlify Bot commented Jun 10, 2026

Copy link
Copy Markdown

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
patter-06b046ce 🟢 Ready View Preview Jun 10, 2026, 8:49 AM

💡 Tip: Enable Workflows to automatically generate PRs for you.

@nicolotognoni nicolotognoni merged commit 180b5b5 into main Jun 10, 2026
10 checks passed
@nicolotognoni nicolotognoni deleted the feat/custom-llm branch June 10, 2026 21:21
@FrancescoRosciano FrancescoRosciano mentioned this pull request Jun 10, 2026
4 tasks
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