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 Operations
Go SDK

Prompt Templates

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

Chat Completions

Next

Batches

Built with

Prompt Templates

Templates allow you to skip re-sending system prompts by storing them on the server.

1// Create a template
2tmpl, _ := client.Templates.Create(ctx, meshapi.CreateTemplateParams{
3 Name: "support-agent",
4 System: "You are a helpful agent for {{company}}.",
5 Model: "openai/gpt-4o-mini",
6})
7
8// Use it in a completion
9resp, _ := client.Chat.Completions.Create(ctx, meshapi.ChatCompletionParams{
10 Template: &tmpl.Name,
11 Variables: map[string]string{"company": "Acme Corp"},
12 Messages: []meshapi.ChatMessage{{Role: "user", Content: "Hi!"}},
13})

CRUD Operations

1// List
2list, _ := client.Templates.List(ctx)
3
4// Get
5t, _ := client.Templates.Get(ctx, "uuid-or-name")
6
7// Delete
8_ = client.Templates.Delete(ctx, t.ID)