Skip to Content
Guides/Strokes

Strokes

Give requests a stroke_id for per-user memory and reusable voice profiles via the API.

A request only shows the model what it carries. Give a user's or brand's requests a stroke_id — a stroke — and the API enriches every request with their persistent facts, voice/style profile and page cache before it reaches the model.

KeptWhat the model gets
FactsShort durable facts about the user and their work — learned automatically from their messages (when auto_learn is on) or managed directly via PUT / PATCH /v1/strokes/{stroke_id}
Voice profileA reusable writing voice: summary, rules, avoid (forbidden clichés/habits), and 1–5 reference samples. Send samples and the API distills a structured voice profile automatically
Page cachePages web search and page reads brought back in earlier requests with the same stroke_id. Fetching one of those URLs again answers from cache — at once, and not billed

Use one stroke_id per person (e.g. user-42) or per shared brand voice (e.g. brand-acme with "auto_learn": false). It's yours to choose: 1 to 200 letters, digits or . _ : -, scoped to your organization.

Use a stroke in a request

Send stroke_id in the body, or as the stroke-id header when your SDK doesn't pass extra fields:

curl https://api.strokes.ink/v1/messages \
  -H "x-api-key: $STROKES_API_KEY" \
  -H "content-type: application/json" \
  -d '{
    "model": "swim-1.0",
    "stroke_id": "user-42",
    "messages": [
      {
        "role": "user",
        "content": "I write the monthly newsletter for parents at Oakwood Primary. Draft a note about the winter concert."
      }
    ]
  }'

/v1/chat/completions takes stroke_id and stroke-id the same way.

Create a voice profile from writing samples

To give the model a specific author or brand voice, upload 1 to 5 writing samples with PUT /v1/strokes/{stroke_id}. The API analyzes the samples' cadence, sentence structure, register and habits, and fills in voice.summary, voice.rules and voice.avoid automatically:

curl -X PUT https://api.strokes.ink/v1/strokes/brand-northtrail \
  -H "x-api-key: $STROKES_API_KEY" \
  -H "content-type: application/json" \
  -d '{
    "auto_learn": false,
    "facts": [
      "Northtrail makes lightweight hiking gear for weekend backpackers."
    ],
    "voice": {
      "rules": ["Lead with a concrete trail detail"],
      "avoid": ["exclamation marks", "game-changing", "seamless"],
      "samples": [
        "Most rain jackets trade breathability for a spec sheet. Ours vents before you notice the climb.",
        "Pack light enough to forget what is on your back by mile four."
      ]
    }
  }'

Set "auto_learn": false on shared brand profiles so individual user prompts never overwrite or append facts to the shared voice.

You can also define voice.summary, voice.rules and voice.avoid by hand without samples (or pass "analyze": false to store samples verbatim without running analysis).

Edit facts and voice manually

Use PATCH /v1/strokes/{stroke_id} to add or remove individual facts (by exact string or 0-based index), tweak voice rules, or toggle auto_learn:

curl -X PATCH https://api.strokes.ink/v1/strokes/user-42 \
  -H "x-api-key: $STROKES_API_KEY" \
  -H "content-type: application/json" \
  -d '{
    "add_facts": ["Prefers British spelling."],
    "remove_facts": ["The user wants items kept under 150 words."],
    "voice": {
      "avoid": ["delve", "excited to announce"]
    }
  }'

Set any sub-field of voice to null to clear just that field, or "voice": null to remove the entire voice profile.

Manage strokes

You can inspect, create and edit strokes visually on the console's Strokes page, or manage them programmatically via the API:

Limits & pricing

  • Facts: up to 30 per stroke, up to 240 characters each.
  • Voice profile: summary up to 1,200 characters; up to 20 rules (240 chars each); up to 30 avoid entries (120 chars each); up to 5 samples (4,000 chars each, 16,000 total).
  • Page cache: up to 100 pages per stroke (30,000 chars each); the 30 most recent URLs are listed to the model.
  • Pricing: storing strokes, automatic fact extraction, voice sample analysis and cached page reads cost nothing. The personalization block injected into a request counts as ordinary input tokens.

On this page