Installation
Get started with PromptC in your JavaScript or TypeScript project.
Install the Package
Install PromptC using npm, yarn, or pnpm:
npm install @mzhub/promptcyarn add @mzhub/promptcpnpm add @mzhub/promptcInstall a Provider SDK
PromptC supports multiple LLM providers. Install the SDK for your preferred provider:
# OpenAI
npm install openai
# Anthropic (Claude)
npm install @anthropic-ai/sdk
# Google (Gemini)
npm install @google/generative-ai
# Ollama (local models - no SDK needed)
# Just ensure Ollama is running locallyMultiple Providers
You can install multiple provider SDKs and switch between them at runtime. Provider SDKs are optional peer dependencies, so you only pay for what you use.
Set Up API Keys
Create a .env file in your project root:
.env
# Choose the provider(s) you'll use
OPENAI_API_KEY=sk-...
ANTHROPIC_API_KEY=sk-ant-...
GOOGLE_API_KEY=...
GROQ_API_KEY=gsk_...
CEREBRAS_API_KEY=...Security
Never commit your API keys to version control. Add
.env to your .gitignore file.TypeScript Configuration
PromptC is written in TypeScript and includes full type definitions. No additional configuration is needed for TypeScript projects.
tsconfig.json
{
"compilerOptions": {
"module": "ESNext",
"moduleResolution": "bundler",
"strict": true
}
}Verify Installation
Create a simple test file to verify everything is working:
test.js
import { defineSchema, z } from "@mzhub/promptc";
const TestSchema = defineSchema({
description: "A simple test",
inputs: { message: z.string() },
outputs: { response: z.string() }
});
console.log("PromptC installed successfully!");
console.log("Schema inputs:", TestSchema.getInputKeys());Run with:
node --experimental-strip-types test.jsNext: Quick Start Guide →