> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://developers.meshapi.ai/llms.txt.
> For full documentation content, see https://developers.meshapi.ai/llms-full.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://developers.meshapi.ai/_mcp/server.

# Prompt Templates

> Manage and use prompt templates with the Python SDK.

# Prompt Templates

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

```python
from meshapi import MeshAPI, CreateTemplateParams, ChatCompletionParams, ChatMessage

# Manage templates with your API key
client = MeshAPI(base_url="https://api.meshapi.ai", token="rsk_...")

client.templates.create(
    CreateTemplateParams(
        name="support-agent",
        system="You are a support agent for {{company}}. Be concise and friendly.",
        model="openai/gpt-4o-mini",
        variables=["company"],
    )
)

reply = client.chat.completions.create(
    ChatCompletionParams(
        messages=[ChatMessage(role="user", content="How do I reset my password?")],
        template="support-agent",
        variables={"company": "Acme Corp"},
    )
)
```

## CRUD

```python
from meshapi import UpdateTemplateParams

templates = client.templates.list()
t = client.templates.get(template_id)
client.templates.update(template_id, UpdateTemplateParams(model="openai/gpt-4o"))
client.templates.delete(template_id)
```