TrueCast API

TrueCast API

News aggregator grounded by prediction markets

Created on 10th June 2025

TrueCast API

TrueCast API

News aggregator grounded by prediction markets

The problem TrueCast API solves

One of society’s biggest problems is how do we know what’s true? As trust in traditional media steadily declines and AI-generated fake news spams the internet, prediction markets emerge as a new real-time news source powered by collective intelligence.
The TrueCast API aggregates real-time news, social media sentiment, and other data sources, then grounds them by prediction market odds (if available) to provide verified insights and fact checks.

Here is how it works:

  • The user query is first passed to an orchestrator model which selects the best data sources for this question
  • Currently supported data sources:
    • Perplexity + Tavily web search
    • Real-time social feed using X AI + neynar
    • DeFiLlama and Pyth for DeFi protocol TVL or token prices via CDP AgentKit
    • Truemarkets prediction markets
    • Modular framework to easily add more
  • The collected data is then processed by a final reasoning model that provides an answer
  • AWS Bedrock ApplyGuardrail API is used for contextual grounding check of the final API response with respect to the retrieve data source information and relevance to the user’s query
  • Optional: API response is stored on IPFS via internal x402 call to Pinata API

Ways to access the x402 protected API:

  • AI Agents: Via x402 action provider that I added to CDP AgentKit (https://github.com/coinbase/agentkit/pull/753)
  • Users: Through chat interface and x402 payment
  • Free trial available that uses CBW subaccounts to showcase improved user experience without wallet popups
  • TrueCast agent @truecastagent can be tagged on Farcaster with a query
    • If tagged within a a cast thread, the agent is context aware (via neynar LLM) and can understand queries like: "Is this true?"
    • The first query is free for each user
    • A CDP v2 wallet is created for each users using the fid as unique identifier in

      const account = await cdp.evm.getOrCreateAccount({ name:

      ${authorFid}

      , });

    • Agent sends cast to user with wallet address
    • User can send USDC to this address to continue using the service
    • On subsequent queries, CDP v2 user wallet is used for x402 pay until balance runs out
    • User can check balance by tagging agent with !balance keyword
    • User can withdraw balance by tagging agent with !withdraw keyword

Challenges I ran into

1)The NextJs x402 example could not be ported to the base mainnet facilitator as a there is a 'crypto' dependency on cdp-sdk limiting @coinbase/x402's compatibility to nodejs runtimes. After contacting the CDP team, a temporary workaround was quickly proposed, https://github.com/coinbase/x402/pull/224.

2)On the chat UI, it is inconvenient to have repeated wallet popups for each prompt. Thus I wanted to use CBW subaccounts for an improved user experience. However the subaccount feature is still in beta and only supports base-sepolia and ETH spending limits, while the x402 facilitator only supports USDC payments. To mimic the intended experience as closely as possible I implemented to following strategy as temporary workaround:

  • User connects subaccount and triggers a 0 ETH transfer on base-sepolia to signal the intend to submit the prompt
  • Once confirmed, a CDP server wallet sponsors the actual x402 pay transaction on base mainnet
  • This is currently used as free trial option with 3 credits per user

3)The created CDP v2 user wallets only need to be funded with USDC to use x402pay, as gas is sponsored by the facilitator. However, if a user wants to withdraw the balance, gas is needed. I first tried using CDP v2 smart accounts + paymaster but signedTypedData needed for x402 is not supported. The solution I found is to only sign a transferWithAuthorization with the user wallet and then submit the transaction with an admin CDP v2 wallet sponsoring the gas.

Note:
The API with all features discussed above was developed to be used in an existing project. The API works standalone and has been developed entirely during the hackathon as can be verified from the git history, relevant code is in neynar-webhook and x402-next-standalone folders.

Tracks Applied (3)

Best Use of x402pay + CDPWallet

x402: News aggregation, fact checking API for users and agents AgentKit PR integrating x402 to make services like neynar...Read More

Multiple Prizes: AWS Challenge: Best Use of Amazon Bedrock

Amazon Nova model used for orchestrator, CDP AgentKit tool calls and decision maker for high-performance, low-cost execu...Read More
Amazon Web Services

Amazon Web Services

Best Agentic Use of Pinata

IPFS file storage of TrueCast API response creating immutable, timestamped proof valuable for bookkeeping, audit trails ...Read More

Pinata

Cheer Project

Cheering for a project means supporting a project you like with as little as 0.0025 ETH. Right now, you can Cheer using ETH on Arbitrum, Optimism and Base.

Discussion

Builders also viewed

See more projects on Devfolio