https://api.openfinance.tech/agent/v1. It returns text and is billed in AI credits. It cannot trade by itself. The MCP server gives code the market data and trading tools. This guide uses the inference API for the model and only read actions from the MCP server, so the script never places an order.
What you need
- Your
open_key from External AI. Please make an account at openfinance.tech to get your keys. - AI credits on your account. See Models and AI credits.
- Node.js and a terminal. The same idea works in Python with the OpenAI SDK; see Examples.
Steps
1
Store the key in your environment
2
Check credits and pick a model
availableCredits, then choose a model id from the list. Ids use a provider/model form. A smaller model is enough while you test.3
Install the two client libraries
4
Write the script
Save this as
brief.mts (the .mts ending lets it use top-level await):5
Run it
6
Check what it cost
Run the credits call from step 2 again and compare
usageCredits. Larger models and longer inputs cost more.Make it yours
- Change the data. Swap the action:
get_perp_categoriesfor HIP-3 markets, or thepolymarkettool withsearchfor prediction markets. Every action is listed in the tool reference. - Run it on a schedule with cron or your host’s scheduler, and send the output to wherever you read it.
- Stream the reply by setting
stream: true. See Examples.
Keep it read-only
A script that only summarizes should only call read actions. If you later add trading, show a summary to a person and wait for a yes before each write, the same rule the OpenFinance tools follow. Every trade needs the user’s confirmation, and nothing a model writes is financial advice.Check it worked
- The script prints a summary that matches what the chat says for the same markets.
- Your credit usage went up by a small amount.
Common mistakes
- Rejected for an invalid key. Check that the value starts with
open_. EitherAuthorization: Bearerorx-api-keyworks on the inference API. - Rejected for insufficient credits. Top up in the app and retry.
- Sending a huge payload. Trim market data before you send it. Credits scale with input length.
- A
429. You are calling too fast. Slow the loop down. - Hard-coding a model list. Read ids from
GET /models; the list changes.
Next guides
Build a trading dashboard or bot
Let Build mode write the app for you.
Inference examples
curl, Python and streaming.

