Skip to content

Reddit and X data in Codex

Add four lines to ~/.codex/config.toml and the Codex CLI can search Reddit and X, read threads and look up accounts through ChatterAPI's hosted MCP server. Codex reads the key from an environment variable, so the file holds no secret.

MCP server URLhttps://api.chatterapi.com/mcp

What you get

  • Every live Reddit and X tool is available as an MCP tool: search, threads, subreddits, users, followers, timelines, leads and brand mentions.
  • Each result includes credits.charged and credits.remaining, so the agent can see what it spent.
  • Every key gets two free tools: chatterapi_account for your balance and chatterapi_list_tools for every tool and its cost.
  • You don't need a Reddit or X developer account. The key works for REST calls too, from the same credit balance.

Set it up

  1. Create an API key

    Sign in at chatterapi.com/signup with Google and create a key on the Keys page. You get 100 free credits. A ca_test_ key returns recorded samples for 0 credits, which helps while you set things up.

  2. Add the server

    Put this in ~/.codex/config.toml, or in a project's .codex/config.toml. Codex sends the value of CHATTERAPI_KEY as a Bearer token.

    ~/.codex/config.toml
    [mcp_servers.chatterapi]
    url = "https://api.chatterapi.com/mcp"
    bearer_token_env_var = "CHATTERAPI_KEY"
    tool_timeout_sec = 90
  3. Or add it from the terminal

    The CLI writes the same entry for you.

    terminal
    codex mcp add chatterapi --url https://api.chatterapi.com/mcp --bearer-token-env-var CHATTERAPI_KEY
  4. Check it

    Run codex mcp list and check that chatterapi is listed.

Try a profile lookup

Ask about an account and Codex calls x_user. The response below is a real recorded call.

Try this prompt

Look up the X account levelsio and tell me the follower count and bio.

{
  "method": "tools/call",
  "params": {
    "name": "x_user",
    "arguments": {
      "handle": "levelsio"
    }
  }
}
response, first 2 rows
{
  "data": {
    "id": "1577241403",
    "handle": "levelsio",
    "name": "@levelsio",
    "bio": "💸http://levels.vc\n📸http://PhotoAI.com $86K/m\n🎮http://VibeJam.com $44K/m\n🏡http://InteriorAI.com $23K/m\n👙@X $13K/m\n🌍http://Nomads.com $7K/m\n🏩http://Hotelist.com $5K/m",
    "followers": 974707,
    "following": 3276,
    "tweets": 181450,
    "verified": false,
    "blueVerified": true,
    "canDm": false,
    "protected": false,
    "location": "📕My book $5K/m 👉",
    "url": "https://readMAKE.com",
    "avatarUrl": "https://pbs.twimg.com/profile_images/2077111020305162240/PwddgOau_400x400.jpg",
    "createdAt": "2013-07-08T09:31:59.000Z"
  }
}

Recorded from a live call on . Long text is shortened and the cursor is cut. A live key is charged 3 credits for this call. A test key returns this same sample for 0 credits.

Limits worth knowing

  • tool_timeout_sec defaults to 60 seconds and startup_timeout_sec to 10. The example raises the tool timeout because some Reddit reads are slower. source
  • Codex loads a project's .codex/config.toml only for trusted projects. source
  • enabled_tools and disabled_tools limit which tools Codex sees from a server. source

Last checked . Sources: Codex MCP docs, Codex config reference.

Questions

Does it cost more through Codex than through REST?
No. MCP and REST call the same tools, cost the same credits and draw from one balance.
Can I try it without spending credits?
Yes. Use a ca_test_ key. Every tool returns a recorded sample for 0 credits, whatever you ask.
Is ChatterAPI part of Reddit or X?
No. ChatterAPI is independent and not affiliated with Reddit, Inc. or X Corp.

What people build with it

AI coding and chat clients

Give your agent Reddit and X data

Sign up and get 100 free credits. No card required.