TypeScript / JavaScript SDK

The official SDK is @verna/verna-promptlab-sdk — a typed client for Node and modern runtimes that calls your prompts as versioned, model-agnostic endpoints.

Install

The SDK is distributed through the Verna GitLab package registry. Point the @verna scope at the registry, then install:

npm config set @verna:registry https://gitlab.com/api/v4/packages/npm/
npm install @verna/verna-promptlab-sdk

The @verna scope only affects packages under @verna/…; the rest of your dependencies still resolve from your default registry.

Create a client

import { PromptLabRouterClient } from '@verna/verna-promptlab-sdk';

const client = new PromptLabRouterClient({
  routerUrl: 'https://router.promptlab.vernalabs.net',
  projectId: 'YOUR_PROJECT_ID',
  apiKey: process.env.VERNA_API_KEY, // plp_xxx_xxx
});

Constructor options

OptionRequiredNotes
routerUrlyese.g. https://router.promptlab.vernalabs.net
projectIdyesyour project id
apiKeyone ofproject key (plp_…) — sent as x-api-key
internalServiceKeyone offor trusted internal services instead of apiKey
workspaceIdnomulti-workspace scoping
environmentnoe.g. prod, staging
timeoutMsnorequest timeout (default 30000)
defaultHeadersnoextra headers on every request
fetchnocustom fetch implementation

Execute a prompt

const res = await client.executePrompt('summarize-ticket', {
  inputs: { ticket: 'User cannot log in after a password reset.' },
  // version: '3',                // pin a specific version (defaults to active)
  // options: { temperature: 0.2 },
});

const text = res.outputs[0]?.text;
console.log(text, res.provider.model, res.cost);

executePrompt(promptName, request?) returns a UnifiedExecutionResponse — the same envelope for text and media, sync and async.

Request fields (all optional except your inputs):

  • inputs — values for the prompt’s {{variables}}
  • version — pin a prompt version (defaults to the active one)
  • options — per-call overrides (temperature, maxTokens, seed, executionMode, …)
  • context{ agentId?, metadata? }
  • trace{ correlationId? }

Other methods

await client.listPrompts();                 // active prompts in the project
await client.getPrompt('summarize-ticket'); // one prompt's contract (+ version, template)
await client.getJob(jobId);                 // poll an async (media) job

Async / media jobs

Media generation runs asynchronously. When res.status is queued/running, poll with getJob:

let job = await client.executePrompt('render-hero-image', { inputs: { brief } });
while (job.status !== 'succeeded' && job.status !== 'failed') {
  await new Promise((r) => setTimeout(r, 2000));
  job = await client.getJob(job.async!.jobId);
}
console.log(job.outputs[0]?.url);

Types

The package ships full TypeScript types (PromptLabClientOptions, ExecutePromptRequest, UnifiedExecutionResponse, and the outputs[] union). Import them alongside the client for end-to-end type safety.

No Python SDK is published yet. From Python (or any language), call the HTTP API directly — it’s the same endpoints this SDK wraps.