# Modes

> Pass a writing mode explicitly — business, academic or creative — or let the API pick.

Source: https://docs.strokes.ink/guides/modes

`swim-1.0` supports three writing modes:

| `mode` | For |
| --- | --- |
| `business` | Writing for work: emails, reports, proposals, plans, marketing and sales copy, product, legal and internal documents |
| `academic` | Scholarly or educational writing: essays, papers, theses, abstracts, literature reviews, study notes, explaining a subject with sources |
| `creative` | Creative and personal writing: fiction, poetry, scripts, lyrics, memoir, personal essays and letters, speeches and toasts |

## Pick a mode, or let the API pick

Pass `mode` in the request body, on [`/v1/messages`](/api/messages) and [`/v1/chat/completions`](/api/chat-completions) alike:

| `mode` | |
| --- | --- |
| left out | The API chooses `business`, `academic` or `creative` for each request based on your system prompt and the latest user message |
| `business`, `academic`, `creative` | Uses that mode directly |

Any other value answers `400 invalid_request_error`.

<Tabs items={["curl","TypeScript","Python"]}>
<Tab value="curl">
```bash
curl https://api.strokes.ink/v1/messages \
  -H "x-api-key: $STROKES_API_KEY" \
  -H "content-type: application/json" \
  -d '{
    "model": "swim-1.0",
    "mode": "business",
    "messages": [
      {
        "role": "user",
        "content": "Write a follow-up to the client: they want a quote by Thursday."
      }
    ]
  }'
```
</Tab>

<Tab value="TypeScript">
```ts
const message = await client.messages.create({
  model: "swim-1.0",
  max_tokens: 32000,
  messages: [
    {
      role: "user",
      content: "Write a follow-up to the client: they want a quote by Thursday.",
    },
  ],
  // @ts-expect-error: a Strokes field the SDK doesn't know
  mode: "business",
});
```
</Tab>

<Tab value="Python">
```python
message = client.messages.create(
    model="swim-1.0",
    max_tokens=32000,
    messages=[
        {
            "role": "user",
            "content": "Write a follow-up to the client: they want a quote by Thursday.",
        }
    ],
    extra_body={"mode": "business"},
)
```
</Tab>
</Tabs>

Name the mode when your product already knows the kind of writing — a "Write an email" action, an academic editor, a fiction workspace. Leave it out in an open chat or an agent, where any request can come.

## Which mode was used

Responses carry the `strokes-mode` header (`business`, `academic` or `creative`) whenever a mode was set or automatically chosen. With the SDKs, read it from the raw response — `client.messages.create(…).withResponse()` in TypeScript, `client.messages.with_raw_response.create(…)` in Python. The console also shows the mode of each request (and whether it was auto-picked) on the [Activity](/console/activity) page.

## How automatic selection works

When `mode` is left out, the API classifies the request from your system prompt and the latest user message before answering. Classification takes a few hundred milliseconds and isn't billed. If a request has no user text or classification times out, the request proceeds without a mode and omits the `strokes-mode` header.
