If you've tried to build anything with X's API lately, you've probably hit this wall.
Free tier: post-only. Want to search? That's $100/month for Basic. Want to read threads programmatically, fetch articles, monitor a keyword? Pay up.
For hobbyists and indie builders running agents on home servers, that's a non-starter. I was stripping X search out of my agent's cron jobs one by one, replacing them with nothing, because
the economics didn't work.
Then I found the side door.
The Problem
X's developer API has three tiers. Free lets you post. Basic ($100/month) gets you search. Pro ($5,000/month) gets you firehose access.
For a personal agent doing morning briefings, content monitoring, and community engagement, $100/month for read access is absurd. Especially when you're already paying for Claude Max, your
VPS, and a dozen other things.
The specific capabilities I needed:
- Fetch a specific tweet or thread
- Read X Articles (their long-form format)
- Search by keyword or user
All three require paid X API access. Or so I thought.
The Fix: xAI's Responses API
xAI — the company behind Grok — has its own API. It's OpenAI-compatible, the pricing is reasonable, and it includes something the X API doesn't give you cheaply: Grok's native access to X
data.
Grok is trained on X. It lives on X. When you hit the xAI Responses API and declare x_search as a tool, Grok uses its privileged native access to X to fetch content — no X developer
account required, no $100/month tier.
The endpoint is https://api.x.ai/v1/responses. The model is grok-4-fast. The tools are x_search and web_search.
That's it.
The Implementation
async function fetchXContent(task: string, apiKey: string) {
const res = await fetch("https://api.x.ai/v1/responses", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Authorization": Bearer ${apiKey},
},
body: JSON.stringify({
model: "grok-4-fast",
input: [
{
role: "system",
content: You are an X research agent with full native access to X posts, articles, threads, and users. Return complete content, not summaries.,
},
{ role: "user", content: task },
],
tools: [
{ type: "x_search" },
{ type: "web_search" },
],
}),
});
const data = await res.json();
for (const block of data.output ?? []) {
if (block.type === "message") {
for (const c of block.content ?? []) {
if (c.type === "output_text") return c.text;
}
}
}
}
Call it with natural language:
fetchXContent("fetch the full text of this X article: https://x.com/i/article/...")
fetchXContent("what is @username saying about AI this week")
fetchXContent("fetch this thread: https://x.com/user/status/123")
What It Actually Returns
I tested this against an X Article that's completely inaccessible through any headless browser — X requires JavaScript, Nitter is dead, the Twitter API v2 singleTweet endpoint only returns
the link. The xAI Responses API returned the full article text. Title, sections, body, everything.
Cost
xAI's API pricing for grok-4-fast: $3/million input tokens, $15/million output tokens. A typical fetch call costs a few cents. For agent use you're looking at well under $1/day.
Compare that to $100/month just for search access on X's own API.
Setup in 5 Minutes
- Get an xAI API key at x.ai/api
- Hit https://api.x.ai/v1/responses with the payload above
- Pass your task as natural language
No X developer account. No OAuth. No tier upgrades.
Top comments (0)