# Blockchain IQ market brief for Vercel AI SDK

An AI SDK tool that fetches one Blockchain IQ market brief, validates the response, and returns a compact event checklist. It flags provider data older than two hours, lists assets missing a price, and extracts only events the provider marks high importance. Output includes the Base settlement transaction. It performs no trading and gives no investment advice.

## Run locally

Requires Node.js 22 or newer.

```sh
npm ci
npm test
npm run brief
```

The last command reads the free sample and requests an unsigned quote. It needs no wallet or model credentials.

To make a paid call, use a dedicated Base wallet funded with native USDC and set `BIQ_WALLET_PRIVATE_KEY` in your local environment. Enter the key through a secret manager or hidden shell input. Keep it out of the repository and out of any model prompt.

```sh
npm run brief -- --pay
```

Passing `--pay` approves one 0.01 USDC payment on Base. The tool pins the endpoint, token, recipient, network and exact amount. It refuses quote changes, redirects and a second invocation on the same instance. If the response cannot be processed after settlement, check the transaction before trying again.

## Use it as an AI SDK tool

Create the tool on the server for one authorized request. `operatorApproved` is state your application sets after approval. Keep it outside the model's inputs.

```js
import { generateText } from 'ai';
import { createBriefTool } from './brief.mjs';

const result = await generateText({
  model: yourConfiguredModel,
  tools: {
    blockchainIqBrief: createBriefTool({
      signer: yourBaseSigner,
      approved: operatorApproved,
    }),
  },
  prompt: 'Summarize the upcoming high-importance events in one brief. Include data age.',
});
```

The report interprets timestamps in UTC and preserves event time text as provided by Blockchain IQ. A missing event time remains null. Market data is subject to the provider's [terms](https://www.blockchainiq.co/terms).

## License

MIT. Blockchain IQ's API and data remain subject to its own terms.
