SDKs
The API speaks Anthropic Messages and OpenAI Chat Completions, so official SDKs work as-is.
There is no Strokes SDK to install: use Anthropic's, with two settings changed — the API key and the base URL.
npm install @anthropic-ai/sdkimport Anthropic from "@anthropic-ai/sdk";
const client = new Anthropic({
apiKey: process.env.STROKES_API_KEY,
baseURL: "https://api.strokes.ink",
});
const message = await client.messages.create({
model: "swim-1.0",
max_tokens: 32000,
messages: [{ role: "user", content: "Hello" }],
});
for (const block of message.content) {
if (block.type === "text") console.log(block.text);
}Without an explicit apiKey / api_key, the SDKs read ANTHROPIC_API_KEY — so pass STROKES_API_KEY in as above, or set the environment variables of the third tab.
OpenAI SDKs
Code written for OpenAI works too, through /v1/chat/completions. Point the OpenAI SDK at https://api.strokes.ink/v1 (this same /v1 base URL also works with the Anthropic SDKs):
import OpenAI from "openai";
const client = new OpenAI({
apiKey: process.env.STROKES_API_KEY,
baseURL: "https://api.strokes.ink/v1",
});
const completion = await client.chat.completions.create({
model: "swim-1.0",
messages: [{ role: "user", content: "Hello" }],
});
console.log(completion.choices[0].message.content);chat.completions.create (streamed or not, with function tools, web search and the model's reasoning as reasoning_content) and models.list work.
Other languages
Any Anthropic SDK or HTTP client works the same way: send JSON to https://api.strokes.ink/v1/messages with the key in x-api-key. Headers the SDKs add, such as anthropic-version, are accepted and ignored.
The Anthropic SDKs require max_tokens; send 32000, the model's maximum, which is what the API uses when the field is left out. The OpenAI SDKs and plain HTTP need none.
What's supported
The SDK's messages.create and messages.stream, and models.list and models.retrieve, with:
- text and image content, system prompts,
stop_sequences,temperatureandtop_p; - tools, with
tool_choice; - web search, on by default, and the
web_searchswitch; - modes, with
mode; - strokes personalization and voice profiles, with
stroke_idorstroke-id; - the reasoning level,
output_config.effort, and the reasoning itself withthinking.
Not supported: document blocks, server tools other than web_search_20250305 and web_fetch_20250910, top_k, container, mcp_servers and citations. See Create a message for every field.