Official SDKs
Integrate Enprompta into your applications with our official SDKs. Choose the one that fits your stack.
TypeScript SDK
@enprompta/sdkAuto-instrument OpenAI, Anthropic & Gemini, serve versioned prompts, and ship traces — with middleware, retries, and full type safety.
npm install @enprompta/sdkPython SDK
enpromptaAuto-instrument OpenAI, Anthropic & Gemini in one call, plus an async-first client built on httpx with pydantic models.
pip install enpromptaQuick Comparison
| Feature | TypeScript | Python |
|---|---|---|
| API Key Auth | Yes | Yes |
| OAuth2 Auth | Yes | Yes |
| Automatic Retry | Yes (6 strategies) | Yes |
| Middleware System | Yes (extensible) | Yes (basic) |
| Type Safety | Full TypeScript | Type hints + Pydantic |
| Async Support | Native async/await | Async + Sync wrapper |
| Auto-pagination | Async generators | Async generators |
| Minimum Runtime | Node.js 18+ | Python 3.8+ |
Quick Start
import { Enprompta } from '@enprompta/sdk'
const client = new Enprompta({
apiKey: process.env.ENPROMPTA_API_KEY
})
const prompts = await client.prompts.list()
const result = await client.prompts.execute(
'prompt_id',
{
variables: { name: 'World' },
provider: 'openai',
model: 'gpt-4'
}
)from enprompta import Enprompta
client = Enprompta(
api_key=os.environ["ENPROMPTA_API_KEY"]
)
prompts = await client.prompts.list()
result = await client.prompts.execute(
"prompt_id",
variables={"name": "World"},
provider="openai",
model="gpt-4"
)Text vs structured prompts
A prompt can be authored two ways. Most start as text and move to structured when they need a separate system instruction or distinct roles. Modern chat models treat the system role specially, so keeping it separate from the user template produces better, more predictable behaviour than flattening everything into one message.
| Type | Authored as | Served as | Use when |
|---|---|---|---|
| Text (Simple) | One prompt body | content string | A single instruction or template |
| Structured | System + User messages | messages (roles) + composed content | Separate system instructions or roles |
The runtime fetch always returns content (for a structured prompt it's the System and User text composed together, so existing integrations keep working) and messages (the structured form, or null for a text prompt). Prefer messages when present:
const p = await client.prompts.getLive('summariser', { label: 'prod' })
// Works for both prompt types:
const messages = p.messages ?? [{ role: 'user', content: p.content }]
await openai.chat.completions.create({ model: 'gpt-4o', messages })