Last updated: November 16, 2026
Post to X from any OpenRouter model
OpenRouter gives you hundreds of models behind one key, but none of them can post to X on their own. Give them a tool. In TypeScript, point @openrouter/mcp at https://mcp.opentweet.io/mcp with your ot_ key and the model gets 43 X tools. In Python, one post_to_x function does it. No X developer account, no OAuth code.
On November 16, 2026, OpenRouter's models API listed 468 models, and 405 of them accept tools, from Claude Sonnet 5.5 to DeepSeek Flash to all 14 free variants. Switching which model writes your posts is a one-string change.
7-day free trial with a few limits, or pay now for full limits.
TypeScript: the OpenTweet MCP server in callModel
OpenRouter's Agent SDK docs connect remote MCP servers with createMCPTools. It discovers the tools once, keeps the auth for every call, and hands them to callModel, which runs the tool loop for you.
npm install @openrouter/agent @openrouter/mcp
export OPENROUTER_API_KEY=sk-or-...
export OPENTWEET_API_KEY=ot_...import { OpenRouter } from '@openrouter/agent';
import { callModel } from '@openrouter/agent/call-model';
import { createMCPTools } from '@openrouter/mcp';
const client = new OpenRouter({ apiKey: process.env.OPENROUTER_API_KEY });
// The OpenTweet MCP server: 43 tools to post, schedule and thread on X
const opentweet = await createMCPTools({
url: 'https://mcp.opentweet.io/mcp',
auth: { kind: 'bearer', token: process.env.OPENTWEET_API_KEY! },
});
const result = callModel(client, {
model: 'anthropic/claude-sonnet-5.5', // or any model that accepts tools
input: 'Write one post about our v2.3 release (faster sync, dark mode) and schedule it for 9am ET tomorrow.',
tools: opentweet.tools,
});
console.log(await result.getText());
await opentweet.close();The transport defaults to Streamable HTTP and falls back to SSE, and the OpenTweet server speaks Streamable HTTP. With more than one server, give each a toolNamePrefix and spread their tools arrays together. To expose only the posting tools, use the package's includeTools option.
Built from OpenRouter's docs, not a live run
We wrote this against the @openrouter/mcp and @openrouter/agent docs as of November 16, 2026, and checked the model IDs against the live models API. The OpenTweet side (the MCP URL and bearer key) is the same one every other integration on this site uses.Python: one function tool, any model
OpenRouter is OpenAI-compatible, so the OpenAI Python SDK works with base_url set to OpenRouter. OpenRouter's own MCP guide converts MCP tools to function definitions by hand and manages the MCP session itself. For posting, skipping MCP is simpler: one function that calls the OpenTweet REST API.
import os, json, requests
from openai import OpenAI
client = OpenAI(base_url="https://openrouter.ai/api/v1",
api_key=os.environ["OPENROUTER_API_KEY"])
OT = {"Authorization": f"Bearer {os.environ['OPENTWEET_API_KEY']}"}
tools = [{
"type": "function",
"function": {
"name": "post_to_x",
"description": "Publish a post on X now, or schedule it with scheduled_date (ISO 8601 UTC).",
"parameters": {
"type": "object",
"properties": {
"text": {"type": "string", "description": "The post, under 280 characters"},
"scheduled_date": {"type": "string", "description": "Optional. Omit to publish now."},
},
"required": ["text"],
},
},
}]
def post_to_x(text, scheduled_date=None):
body = {"text": text, **({"scheduled_date": scheduled_date} if scheduled_date else {"publish_now": True})}
r = requests.post("https://opentweet.io/api/v1/posts", headers=OT, json=body, timeout=20)
return r.text
messages = [{"role": "user", "content": "Read this changelog and post one short update to X:\n" + open("CHANGELOG.md").read()[:4000]}]
for _ in range(5):
reply = client.chat.completions.create(model="~deepseek/deepseek-flash-latest",
messages=messages, tools=tools).choices[0].message
messages.append(reply)
if not reply.tool_calls:
print(reply.content); break
for call in reply.tool_calls:
result = post_to_x(**json.loads(call.function.arguments))
messages.append({"role": "tool", "tool_call_id": call.id, "content": result})The loop stops when the model answers without a tool call, or after five turns. The model decides between publishing and scheduling from your prompt. Change model= to anything in the table below; the tool definition stays the same.
Keep a person on publish at first
A model can post the wrong thing as easily as the right one. While you tune the prompt, droppublish_now from the body so posts land as drafts in OpenTweet, approve a week of them, then switch it back.Which model should write your posts
Prices per 1M input / output tokens from OpenRouter's models API on November 16, 2026. All accept tools.
| Model ID | Price | Good for |
|---|---|---|
anthropic/claude-sonnet-5.5 | $2.00 / $10.00 | Threads, replies, anything in your voice |
anthropic/claude-haiku-5.5 | $0.10 / $0.50 | Short posts from structured input |
~deepseek/deepseek-flash-latest | $0.036 / $0.50 | High-volume rewrites (news, RSS, alerts) |
qwen/qwen4-max | $1.50 / $4.50 | Newest flagship (added Nov 16), 1M context |
typesafe/jev-router | The routed model's price | Let Jev pick per request; see the Jev Router page |
Any :free variant (14) | $0 | 50 requests a day until $10 of credits |
A typical post call (about 3,000 tokens in, 300 out) is roughly $0.009 on Sonnet 5.5 and under a tenth of a cent on Haiku 5.5 or DeepSeek Flash, by our arithmetic from those prices. The ~ IDs are aliases that follow the newest model in a family, so your bot upgrades itself; pin a dated ID if you want the voice to stay the same. Free models are capped at 50 requests a day until you buy $10 of credits (limits). Don't want to choose? Jev Router picks per request. Prices move every week; the price tracker bot watches them.
Coding agents: OpenRouter's MCP server plus OpenTweet's
OpenRouter also runs a hosted MCP server at https://mcp.openrouter.ai/mcp. It is for coding assistants: list models, check prices and credits, read the docs, send test messages. It signs in with OAuth and issues a key with a 7-day expiry and a $10 spend limit (docs). It cannot post anywhere, so add OpenTweet's server next to it:
# Claude Code: OpenRouter's data server plus OpenTweet's posting server
claude mcp add --transport http openrouter https://mcp.openrouter.ai/mcp
claude mcp login openrouter
claude mcp add --transport http opentweet https://mcp.opentweet.io/mcp \
--header "Authorization: Bearer $OPENTWEET_API_KEY"Now one prompt can do both: "Find the cheapest model on OpenRouter with tools and 1M context, then post a one-line note about it to X." The same two servers work in Codex, Cursor and OpenCode; see the Claude Code and Codex pages for their config files.
Posting on a schedule
Either run the script from cron (it writes and posts in one go), or run it once a week and ask for a week of posts with times. The model passes scheduled_date, OpenTweet holds the queue and publishes each post when it is due, whether your script is running or not. The second way is cheaper and keeps an unattended model away from "publish now".
- "Turn the last five entries in CHANGELOG.md into five posts and schedule one a day at 15:00 UTC."
- "Write a three-post thread from docs/launch.md and save it as a draft."
- "Which of my posts did best last month? Write two more on that topic." (MCP only: it reads analytics.)
Frequently asked questions
Can OpenRouter post to X (Twitter)?
Not by itself. OpenRouter routes requests to models; it has no X tools, and its chat API takes no server-side MCP parameter. Give the model a tool: connect https://mcp.opentweet.io/mcp with OpenRouter's @openrouter/mcp package (43 tools), or define one post_to_x function that calls the OpenTweet API. Then any OpenRouter model that accepts tools can publish and schedule on X.
Does OpenRouter support MCP servers?
On the client side, yes. @openrouter/mcp connects to a remote MCP server over Streamable HTTP (falling back to SSE) and turns its tools into tools for callModel in @openrouter/agent. Local stdio servers are out of scope for that package. In Python, OpenRouter's guide converts MCP tools to function definitions by hand. The chat completions API itself has no mcp_servers field.
What is mcp.openrouter.ai?
OpenRouter's own hosted MCP server. It lets a coding assistant look up OpenRouter data (models, prices, credits, rankings, docs) and send test messages. It does not post anywhere. Add it next to the OpenTweet MCP server in Claude Code, Codex, Cursor or OpenCode if you want both.
Which OpenRouter models can post to X?
Any model that supports tool calling. On November 16, 2026, 405 of the 468 models in OpenRouter's models API listed "tools" in supported_parameters, including all 14 :free variants. Filter with GET https://openrouter.ai/api/v1/models?supported_parameters=tools.
Can I post to X with a free OpenRouter model?
Yes, if it supports tools, which all 14 free variants did on November 16, 2026. OpenRouter limits :free models to 20 requests a minute and 50 a day until you have bought at least $10 of credits, then 1,000 a day. A post takes one to three requests, so 50 a day is enough for a small account. Posting itself goes through your OpenTweet plan.
Do I need an X developer account or X API key?
No. You log in to X once in OpenTweet and use an ot_ key. X API fees are included in the plan: $19.99/mo, or $29/mo with 10 link posts a day. OpenRouter bills only the model tokens.
How much does one AI-written post cost in tokens?
Very little. At the prices listed on November 16, 2026, a call with about 3,000 input tokens and 300 output tokens costs roughly $0.009 on anthropic/claude-sonnet-5.5 ($2 / $10 per 1M), $0.00045 on anthropic/claude-haiku-5.5 ($0.10 / $0.50) and $0.00026 on ~deepseek/deepseek-flash-latest ($0.036 / $0.50). Our arithmetic from list prices; your prompt size decides the real number.
Keep exploring
Other routes from a model to an X account, with the same key.
Jev Router on OpenRouter
typesafe/jev-router: what it is, what it costs, how to steer it.
AI model price tracker bot
Post OpenRouter price drops and new models to X.
OpenAI Agents SDK
The same tools from another agent framework.
Vercel AI SDK
Post to X from AI SDK tools.
Give any MCP agent a Twitter tool
The general recipe for MCP clients.
OpenTweet MCP server
All 43 tools, documented.
Give every OpenRouter model an X account
One MCP URL, 43 tools, scheduling included. No X developer account.
7-day free trial with a few limits, or pay now for full limits.