Name and create a key in Settings.
API docs
Use OpenPen from any workflow.
Send a writing request, optional context, and source material. OpenPen creates a draft run and returns final prose.
Start here
Install the skill, or call the API.
Claude and Codex users should install the skill. Builders should create an API key and call /v1/drafts.
Call POST /v1/drafts with the context.
Call GET /v1/drafts/:id until it completes.
Create
Start a draft run
Send only a prompt for OpenPen research, or add raw tool output with supplied_only when your workflow has already researched the subject.
curl -X POST https://openpen.dev/v1/drafts \
-H "Authorization: Bearer naiw_live_..." \
-H "X-Anthropic-API-Key: sk-ant-..." \
-H "Content-Type: application/json" \
-d '{
"prompt": "Write an article about Steve Wozniak's role at Apple.",
"options": {
"mode": "article",
"target_words": "auto"
}
}'curl -X POST https://openpen.dev/v1/drafts \
-H "Authorization: Bearer naiw_live_..." \
-H "X-Anthropic-API-Key: sk-ant-..." \
-H "Content-Type: application/json" \
-d '{
"desired_output": "Write an article about Steve Wozniak's role at Apple.",
"tool_outputs": [
{
"name": "research",
"type": "notes",
"content": "Paste source excerpts, search results, or tool output here."
}
],
"sources": [
{
"type": "text",
"name": "founder_notes",
"provenance": "human_first_party",
"content": "Paste private notes, docs, or transcript excerpts here."
}
],
"options": {
"mode": "article",
"target_words": "auto",
"source_policy": "supplied_only"
}
}'X-Anthropic-API-KeyYour request-scoped Anthropic BYOK credential.desired_outputWhat you want written.messagesVisible agent or chat context.tool_outputsResearch, source excerpts, or tool results.sourcesFirst-party source text. Add provenance.options.modearticle, memo, email, page, script, or post.options.source_policyUse supplied_only only when the draft must not add public-web research.Poll
Get the draft
Runs are async. Store the returned id and poll until the status is succeeded or failed.
curl https://openpen.dev/v1/drafts/<draft_id> \
-H "Authorization: Bearer naiw_live_..."{
"id": "draft_123",
"status": "succeeded",
"draft": { "text": "Final draft in markdown..." },
"usage": { "credits_used": 0, "free_runs_used": 0 }
}{
"id": "draft_123",
"status": "failed",
"error": {
"code": "quality_threshold_not_met",
"message": "OpenPen couldn't complete this request. Try again or adjust the request.",
"retryable": true
}
}Modes
Choose the output shape
Use one mode per request.
articleemailmemopagescriptpostRules
Source text needs provenance. OpenPen does not read hidden chat history.
Async runs onlyUp to five text sourcesUp to 100k source charactersText sources need provenanceAPI pilot runs do not spend OpenPen creditsAnthropic BYOK required for API creation requestsOne active draft at a time during the initial pilotMultiple named API keys up to your account limit