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
  • CRUD
Python SDK

Prompt Templates

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

Chat Completions

Next

Batches

Built with

Prompt Templates

Server-stored prompts with {{variable}} interpolation. Reference them by name from chat.completions to skip re-sending system prompts every request.

1from meshapi import MeshAPI, CreateTemplateParams, ChatCompletionParams, ChatMessage
2
3# Manage templates with your API key
4client = MeshAPI(base_url="https://api.meshapi.ai", token="rsk_...")
5
6client.templates.create(
7 CreateTemplateParams(
8 name="support-agent",
9 system="You are a support agent for {{company}}. Be concise and friendly.",
10 model="openai/gpt-4o-mini",
11 variables=["company"],
12 )
13)
14
15reply = client.chat.completions.create(
16 ChatCompletionParams(
17 messages=[ChatMessage(role="user", content="How do I reset my password?")],
18 template="support-agent",
19 variables={"company": "Acme Corp"},
20 )
21)

CRUD

1from meshapi import UpdateTemplateParams
2
3templates = client.templates.list()
4t = client.templates.get(template_id)
5client.templates.update(template_id, UpdateTemplateParams(model="openai/gpt-4o"))
6client.templates.delete(template_id)