Persian Version (نسخه فارسی):
• Read on Substack: استفاده هوش مصنوعی و ایجنتها از ایکس (توییتر) بدون نیاز به API و مرورگر
• Read on Dev.to: نسخه فارسی در Dev.to
• Read on Telegra.ph: Instant View (Persian)
GitHub Repository: github.com/dalroot/x-use
License: MIT
Stack: Node.js (Pure HTTPS + GraphQL)
1. The Problem: Why Browser Automation Bottlenecks AI Agents
Connecting AI coding agents (such as Antigravity, Claude Code, or Cursor) to X (formerly Twitter) usually forces developers into one of two painful paths:
- Restrictive & Expensive Official APIs: Write-capable API tiers come with strict quotas and high monthly costs.
- Heavy Headless Browsers: Tools like Puppeteer and Playwright spin up a full Chromium instance — burning 400 MB+ of RAM per run, adding seconds of cold-start latency, and breaking whenever DOM selectors change.
x-use (xuse / agent-x-use) eliminates both bottlenecks. It is a modular Node.js CLI and SDK that communicates directly with X's GraphQL endpoints over pure https — zero Chromium, zero Puppeteer, zero Playwright, and no official API key required.
2. Modular, Zero-Browser Architecture
Everything in x-use runs over Node's built-in https stack, keeping execution in milliseconds even on low-RAM headless servers:
-
src/auth.js— Resolvesauth_tokenandct0from exported browser cookies, environment variables, or~/.x-use/config.json. -
src/transport.js— Pure HTTPS transport, optionalSOCKS5/HTTPproxy normalization, and GraphQL error inspection (catchingdata.errorseven onHTTP 200). -
src/operations/tweets.js—createTweet,replyTweet,postThread,deleteTweet,favoriteTweet, andretweet. -
src/operations/users.js—getProfile,getUserTweets, andsearchTweets. -
bin/x-use.js— Dual-mode CLI: an interactive parent menu (xuse) for humans, plus deterministic--jsonoutput for AI agents.
3. Built Agent-First (--json + SKILL.md)
x-use ships with a ready-to-use SKILL.md so AI agents can immediately operate X without scraping HTML:
# Verify session & proxy connectivity
xuse check --json
# Fetch user profile metadata
xuse profile jack --json
# Publish a single tweet without a browser
xuse tweet "Posted without a browser via x-use" --json
# Publish a full thread from a JSON array
xuse thread ./thread.json --json
Every --json command returns a predictable contract:
{
"ok": true,
"data": {
"tweetId": "2126363786189615433",
"url": "https://x.com/dallsirvan/status/2126363786189615433"
}
}
4. Authentication Without an API Key
Instead of an API key, x-use uses your valid X session cookies (auth_token and ct0). You can configure them once via the interactive parent CLI:
xuse setup --cookies ./cookies.json --proxy socks5h://127.0.0.1:10808
Or pass them directly as environment variables (X_AUTH_TOKEN and X_CT0).
5. Quick Start (CLI & Node.js SDK)
git clone https://github.com/dalroot/x-use.git
cd x-use
npm install
npm link # optional: exposes `xuse`, `x-use`, and `agent-x-use` globally
Using it inside Node.js:
const { XUseClient } = require('x-use');
(async () => {
const client = new XUseClient({
cookiesPath: './cookies.json',
// proxyUrl: 'socks5h://127.0.0.1:10808' // optional
});
await client.init();
const post = await client.createTweet('Hello from x-use!');
console.log(post.url);
})();
Links & Persian Edition
- GitHub Repository (MIT): https://github.com/dalroot/x-use
- Persian Article (Substack): نسخه فارسی در Substack
- Persian Article (Dev.to): نسخه فارسی در Dev.to
- Persian Article (Telegra.ph): نسخه فارسی در Telegra.ph
Top comments (0)