For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
DocsAPI ReferenceSDKs
DocsAPI ReferenceSDKs
      • Overview
      • Chat Completions
      • Prompt Templates
      • Files & Batches
      • Embeddings
      • Image Generation
      • Responses (Reasoning)
      • Compare (Multi-model)
      • Models
      • Error Handling
LogoLogo
On this page
  • Prompt Templates
  • Template CRUD
Node.js SDK

Prompt Templates

||View as Markdown|
Was this page helpful?
Edit this page
Previous

Chat Completions

Next

Batches

Built with

Prompt Templates

Templates let you define reusable prompts with {{variable}} slots.

1// Create a template with your API key
2const client = new MeshAPI({
3 baseUrl: "https://api.yourdomain.com",
4 token: "rsk_...",
5});
6
7const template = await client.templates.create({
8 name: "support-agent",
9 system: "You are a helpful customer support agent for {{company}}. Be concise and friendly.",
10 model: "openai/gpt-4o-mini",
11 variables: ["company"],
12});
13
14console.log("Created template:", template.id);
15
16// Use the template in a chat completion (data-plane key)
17const response = await client.chat.completions.create({
18 messages: [{ role: "user", content: "How do I reset my password?" }],
19 template: "support-agent", // template name or UUID
20 variables: { company: "Acme Corp" },
21});
22
23console.log(response.choices[0]?.message.content);

Template CRUD

1// List all templates
2const templates = await client.templates.list();
3
4// Get a specific template
5const t = await client.templates.get("uuid-here");
6
7// Update a template
8const updated = await client.templates.update("uuid-here", {
9 system: "You are a concise assistant for {{company}}.",
10 model: "openai/gpt-4o",
11});
12
13// Delete a template
14await client.templates.delete("uuid-here");