Skip to content

Module: LLM Providers

Shared LLM provider pack — the canonical interface for all AI templates. Ships with Anthropic, OpenAI, and Groq providers out of the box, plus optional Bedrock, Vertex AI, Hugging Face, and Ollama providers. Factory-based registry, streaming, token counting via js-tiktoken, circuit breakers, OTel metrics, and a gateway adapter.

Namemodule-llm-providers
Version0.1.0
Categorycomposable-modules
LicenseApache-2.0
Personaengineering
Tagsllm, providers, anthropic, openai, groq, streaming, typescript
Sourcetemplates/module-llm-providers

Render it

Three front doors, one catalog. Pick whichever suits the caller.

# CLI
npx @nanohype/sdk render module-llm-providers --out ./my-app

# SDK
import { LocalSource, renderTemplate } from "@nanohype/sdk";
const result = await renderTemplate(source, "module-llm-providers", variables);

# MCP — from an agent
get_template({ name: "module-llm-providers" })

Prerequisites

ToolVersionWhy
node>=22Node.js runtime for the LLM providers module

Variables

Required

ProjectName string
Kebab-case project name, used as package name and directory Must be lowercase kebab-case starting with a letter.

Optional

Description string — defaults to LLM provider pack for Anthropic, OpenAI, Bedrock, and more
Short project description for package.json and README
DefaultProvider string — defaults to anthropic
Default LLM provider (anthropic, openai, groq, or a custom name)
IncludeBedrock bool
Include AWS Bedrock provider
IncludeVertex bool
Include Google Vertex AI provider
IncludeHuggingFace bool
Include Hugging Face Inference provider
IncludeOllama bool
Include Ollama local inference provider

What it produces

34 files. Placeholder names such as __APP_NAME__ are what the renderer substitutes into.

.env.example
.gitignore
biome.json
package.json
README.md
src/llm-providers/__tests__/adapters.test.ts
src/llm-providers/__tests__/mock.test.ts
src/llm-providers/__tests__/registry.test.ts
src/llm-providers/__tests__/tokens.test.ts
src/llm-providers/adapters/gateway.ts
src/llm-providers/adapters/streaming.ts
src/llm-providers/bootstrap.ts
src/llm-providers/config.ts
src/llm-providers/index.ts
src/llm-providers/logger.ts
src/llm-providers/metrics.ts
src/llm-providers/providers/anthropic.ts
src/llm-providers/providers/bedrock.ts
src/llm-providers/providers/groq.ts
src/llm-providers/providers/huggingface.ts
src/llm-providers/providers/index.ts
src/llm-providers/providers/mock.ts
src/llm-providers/providers/ollama.ts
src/llm-providers/providers/openai.ts
src/llm-providers/providers/registry.ts
src/llm-providers/providers/types.ts
src/llm-providers/providers/vertex.ts
src/llm-providers/resilience/__tests__/circuit-breaker.test.ts
src/llm-providers/resilience/circuit-breaker.ts
src/llm-providers/tokens/counter.ts
src/llm-providers/types.ts
tsconfig.build.json
tsconfig.json
vitest.config.ts

Composes with