add-llm-provider
Add support for a new LLM provider in core/llm. Use when the target provider is NOT OpenAI-compatible (if it is, just set OPENAI_BASE_URL — no code change). Mention triggers - new LLM provider, add Anthropic-style backend, model.LLM, GenerateContent, integrate provider X.
- License 许可
- MIT
- 所属仓库
- blouargant/omnis
- 最近更新
- 2026-11-10
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- add-llm-provider
- description
- Add support for a new LLM provider in core/llm. Use when the target provider is NOT OpenAI-compatible (if it is, just set OPENAI_BASE_URL — no code change). Mention triggers - new LLM provider, add Anthropic-style backend, model.LLM, GenerateContent, integrate provider X.
03 SKILL.md 正文
Add a new LLM provider
First, check the cheap path
If the provider exposes an OpenAI-compatible API (Ollama, Groq, Together, vLLM, Mistral, DeepInfra, Fireworks, Azure OpenAI, …), do not write code. Just set:
export OMNIS_PROVIDER=openai_compat
export OPENAI_BASE_URL=https://api.example.com/v1
export OPENAI_API_KEY=sk-…
export OMNIS_MODEL=their-model-id
Done. Test with go run . console.
If the API is genuinely different, continue.
Implement model.LLM
Add a new file under core/llm/ modelled on
anthropic.go or
openai.go. Both are ~200 lines, no SDK.
The interface is:
type LLM interface {
Name() string
GenerateContent(ctx context.Context, req *model.LLMRequest, stream bool)
iter.Seq2[*model.LLMResponse, error]
}
Translation primitives are already in
core/llm/convert.go — reuse
systemTextFromReq, content-part conversions, etc. Don't duplicate.
Register
Edit core/llm/llm.go:
- Add a default model id to the
defaultModelmap. - Add a
casein theNew()switch. - Document the auth env var(s) at the top of the file.
Test
PATH=$HOME/.local/go/bin:$PATH go build ./... && \
PATH=$HOME/.local/go/bin:$PATH go vet ./... && echo OK
export OMNIS_PROVIDER=newprov
export NEWPROV_API_KEY=…
PATH=$HOME/.local/go/bin:$PATH go run . console
> hello, who are you?
The model's Name() should appear in .agent_events.log's
BeforeModel entries.
Update the docs
When the provider works:
- Add a row to the table in
docs/providers.mdand the README. - If env vars differ from the existing pattern, add a note in
.agents/build-and-test/SKILL.md.
Don'ts
- ❌ Don't import a third-party SDK. Use
net/http+ SSE. - ❌ Don't change the
model.LLMinterface — it belongs to ADK. - ❌ Don't add provider-specific behaviour above the dispatcher; keep the rest of the codebase provider-agnostic.
- ❌ Don't drop streaming support;
GenerateContentmust honour thestreamflag.
04 同仓库更多 Skills
skill-creator
Create or update a skill playbook (SKILL.md) for the agent. Use when the user wants to create a new skill, add a skill, define a new agent capability, update an existing skill, edit a skill, refine a skill playbook, or specialise the agent for a new domain.
review
Review a body of work (source code, configuration, documents, infra manifests, …) for correctness, clarity, and obvious risks. Use this skill whenever the user asks for a review, audit or critique.
Fallback PDF text extractor using pdftotext (poppler). Use ONLY when the preferred `liteparse` skill is unavailable or for a quick plain-text dump of a simple text PDF — for the best PDF parsing (scanned, multi-column, layout-heavy, or non-PDF formats) prefer the `liteparse` skill.
pandoc
This skill should be used when converting documents between formats (Markdown, DOCX, PDF, HTML, LaTeX, etc.) using pandoc. Use for format conversion, document generation, and preparing markdown for Google Docs or other word processors.
liteparse
Preferred local parser for extracting text from PDFs, images, and scanned/layout-heavy documents (OCR, screenshots, complex PDFs) — far better than pdftotext. Use this FIRST for any PDF, image, or OCR text-extraction or conversion task. NOTE for Office documents (DOCX, PPTX, XLSX, ODT) — for plain text extraction prefer the `pandoc` skill, which needs no LibreOffice; only use LiteParse for Office docs when you need its layout/OCR/screenshot output. The `pdf` skill (pdftotext) is only a fallback for when LiteParse cannot be installed.
linux-admin
Safely make a change to a Linux workstation — install/remove packages, manage systemd services and timers, edit and validate configuration files, manage users/permissions and networking. Detect the distro and package manager, determine whether the target is package-managed or hand-maintained, preview or simulate every change, back up configs before editing, and prefer the package manager and drop-in overrides so the host stays consistent and secure. Use whenever a change to the local Linux host is required (install, remove, enable, disable, start, stop, edit a config, add a user, change permissions or networking).