Learning resourcesReviewed Ā· xAI

𝕏 Sentiment Tracker

X Sentiment Tracker is a practical guide for developers building a Grok-powered sentiment dashboard, but it uses paid API calls and samples at most 100 popular X posts. It explains daily searches, filtering, structured scoring and progress updates through a web interface or terminal.

Researched 15 Nov 2026

In short.

X Sentiment Tracker is a developer tutorial for building a topic sentiment dashboard with Grok, but its paid searches cover only a limited sample of popular X posts. The documented example uses grok-4.7, parallel daily searches, citation-based filtering and structured sentiment scores. It provides local web and terminal interfaces; installation, runtime behavior and sentiment accuracy have not been assessed.

Researched and written by an AI model and checked by a second AI model. How it works

Covers the complete documentation page at [https://docs.x.ai/cookbook/examples/x-sentiment-tracker.md], captured on 15 November 2026. Linked notebook and repository contents, external licenses, service terms and live pricing are excluded. No explicit license notice appears on the page. No code was executed; installation, retrieval, scoring, streaming, retries, cancellation, performance and billing were not independently verified.

The overview

Identity

This xAI cookbook guide describes an example app that searches X for posts about a topic and uses Grok to assess their sentiment. Its stated uses include brand monitoring and tracking reactions to a launch. The source is [https://docs.x.ai/cookbook/examples/x-sentiment-tracker.md].

The example shares its analysis logic between a local web dashboard and a terminal interface. The page explains how to run it and how its main components work.

Assessment

The documented design is useful for learning how to combine AI search, filtering, structured output and visible progress in one application. Beginners get a concrete example to follow; experienced developers get details about streaming events, retries, cancellation and score validation.

Its suitability for dependable monitoring is unknown. The page provides no accuracy evaluation, deployment evidence or comparison with human sentiment judgments.

Users

The guide fits developers exploring the Grok API, X Search or a small social listening interface. It assumes enough familiarity with Node.js to install dependencies, configure an API key and run commands.

People interested in brand or launch reactions can use the documented dashboard once the example is set up. Adapting it into an ongoing monitoring service would require work beyond what this page establishes.

Capabilities

For a supplied topic, the app searches each of the last 10 days in parallel, collecting up to 10 posts per day and up to 100 before later processing. Topic input can include X search operators.

The dashboard displays search progress, counts of found and retained posts, streamed model reasoning, an overall sentiment score from -1 to +1, positive/neutral/negative proportions, daily sentiment and individual post scores. The terminal displays the same analysis stages.

The page documents a Stop control and cancellation when the page closes.

Using it

Requirements

The documented minimum is Node.js 22.13. The example requires its repository files, npm dependencies and an xAI API key, supplied through XAI_API_KEY or a .env file at the repository root.

Requests depend on the Grok API and X Search. The page does not establish exact dependency versions, account eligibility, rate limits or requirements for hosting the app beyond the local setup.

Mechanism

The shared analyze() function lives in src/sentiment.ts. Its findPosts() step streams a grok-4.7 request using xSearch() for one day. server_tool_call events expose search activity, while citation events identify posts returned by X Search. The app excludes posts without that retrieval evidence and removes duplicates across days.

The client uses retryBeforeOutput to retry a search that fails before an answer starts. A day whose search still fails is skipped and its error is reported. filterPosts() then retains posts expressing feelings about the topic.

scoreSentiment() scores retained posts and the topic overall. Filtering and scoring use low reasoning effort. Because the schema's numeric bounds are not enforced, the app clamps scores to -1 through +1.

src/server.ts forwards progress through server-sent events, which let the server send updates to an open browser connection. An AbortSignal is passed to every request for cancellation. public/index.html displays the events and derives daily sentiment from individual post scores.

Setup

Configure the API key, enter examples/x-sentiment-tracker/typescript in the repository, run npm install, then run npm run web. Open [http://localhost:3000], enter or select a topic and choose Analyze.

For terminal use, the documented command is npm start -- SpaceX. SpaceX is also the default topic. The page does not provide a repository download command or a production deployment procedure.

Example

The documented terminal example analyzes SpaceX. A broader query such as Starship OR Starlink can be entered because the topic is passed into the search query unchanged.

With default settings, the app attempts 10 daily searches, filters the resulting posts and produces individual and overall sentiment scores. No result for either example is supplied, so their scores, retained post counts and conclusions are unknown.

Assessment & evidence

Limitations

The collection targets popular posts and returns at most 10 per day. Deduplication, relevance filtering and failed daily searches can further reduce the sample. Consequently, its sentiment should be interpreted as a judgment about the retained posts; broader public opinion is not established.

Citations help exclude posts that the search did not return, but do not establish the truth of a post or the correctness of its sentiment label. Clamping keeps numbers within the intended range without validating their meaning.

The page does not establish accuracy across languages, sarcasm, ambiguous topics or coordinated posting. It also does not describe scheduling, durable history or production operation.

Reasoning

The example makes several stages visible: what was searched, which posts were retained and how the model explained its scores. This supports inspecting a result and investigating surprising classifications.

A model's explanation is not independent evidence of correctness. The page presents low reasoning effort as a way to reduce scoring time, but supplies no quality comparison between effort settings. The formula for the overall score and the thresholds separating positive, neutral and negative results are not specified here.

Alternatives

The page links to an X sentiment analysis notebook and says the tracker follows the same approach: [https://github.com/xai-org/xai-cookbook/blob/main/examples/x-sentiment-analysis/]. The notebook's contents, requirements and behavior are not assessed.

Within the documented example, the terminal interface offers the same analysis stages without using the dashboard. The page provides no comparison with other sentiment services or models.

Evidence

The findings are supported by the complete xAI documentation page at [https://docs.x.ai/cookbook/examples/x-sentiment-tracker.md]. It supplies setup commands, component names, processing steps, stated limits and approximate usage figures.

The page provides no execution logs, labeled evaluation dataset, accuracy measurements or independent benchmarks. No commands were executed, and the linked implementation was not inspected; operational claims remain documented behavior rather than verified results.

Access & freshness

Costs

The page estimates about $0.80 and a minute and a half per default run. It attributes most of the cost to X Search, listed at $5 per 1,000 fetched posts, with token charges added. These are documentation estimates, not measured results or confirmed current prices.

Exact token rates, token consumption and the billing effects of retries or cancellation are not established. Changing DAYS at the top of src/sentiment.ts reduces the requested collection window, but the page gives no corresponding cost estimate.

Rights

The page contains no explicit code license or redistribution notice. Permission to adapt or redistribute the example code, and rights to display or republish collected X content, are unknown from this page.

Repository licenses and applicable service terms are outside the supplied documentation. Public availability of the guide does not establish those permissions.

Freshness

The documentation was captured on 15 November 2026 at 05:46:22.836 UTC. It names grok-4.7 and Node.js 22.13 or later, but provides no publication date, application release number or dependency versions.

Current model availability, SDK behavior, API pricing and compatibility beyond that captured description are unknown.

Actions

To explore the example, follow the documented local setup and start with a topic whose posts you can interpret. Inspect the retained posts, individual scores and any daily search errors before drawing conclusions from the overall score.

Before adapting it for ongoing monitoring, establish current API access and prices, inspect the implementation and dependency versions, clarify reuse permissions and compare its labels with human judgments on representative posts. Reliability, accuracy and operating costs remain unknown until those questions are resolved.

Evidence for this report

selected-page.txtselected Ā· checked 2026-11-15