# Use DataXAPI in Codex

Give Codex public data from 21 platforms. Paste one prompt and it sets itself up: 5 tools, 207 endpoints, from $0.0003 a call, and a failed call is never charged.

Paste this into Codex:

> Read https://dataxapi.com/agents.md and set up DataXAPI in this agent. My API key is dx_…; use it for every DataXAPI call.

Codex reads that page, adds the MCP server and lists the tools.

## Or set it up by hand

Three steps in a terminal. This is what the prompt above leads Codex to do.

1. Put your key in the environment: Codex reads it from there. Add the line to your shell profile to keep it.

```bash
export DATAXAPI_API_KEY="dx_…"
```

2. Add the server: One command, or the same entry written into `~/.codex/config.toml`.

```bash
dataxapi setup --client codex
```

```toml
[mcp_servers.dataxapi]
url = "https://api.dataxapi.com/mcp"
bearer_token_env_var = "DATAXAPI_API_KEY"
```

3. Restart Codex: Then ask it to list the DataXAPI tools. You should get the five below.

## Check it works

Ask it to list the tools. This is the reply to expect; none of it costs anything.

> List the DataXAPI tools.

DataXAPI is connected with 5 tools: `find` finds the endpoint for a question, `describe` shows its parameters and price, `call` runs it (the only one that is charged), `read_more` re-reads a result for 24 hours, and `account` shows your balance. The catalog has 207 endpoints on 21 platforms.

## A first conversation

A question, the calls it made, and what each one cost.

> What has @nasa posted on TikTok lately?

|  |  |  |
| --- | --- | --- |
| `find({ query: "tiktok account recent videos" })` | Found tiktok.users.videos.list · TikTok user videos · $0.0020 a call | Free |
| `call({ capability: "tiktok.users.videos.list", username: "nasa", max_price: "0.01" })` | Up to 10 videos · compact view | $0.0020 |

2 tool calls · 1 charged · $0.0020

## Tips for Codex

- **Give it its own key.** Create a key named “Codex” with a daily budget in the console. When the budget is used up, calls stop; nothing else on your account is touched.
- **Let the free tools run without asking.** If Codex asks before it runs a tool, allow `find`, `describe`, `read_more` and `account`. Leave `call` on “ask” if you want to approve every charge.
- **Answers fit the context.** A DataXAPI answer stops at about 20 KB on an item boundary and says how to read on; `read_more` gets the rest at no charge.
- **Cap what a call may cost.** Ask it to pass `max_price` with every call. A call that could cost more is refused before anything is charged.

## If something is off

| What you see | Why | Fix |
| --- | --- | --- |
| Codex does not list the DataXAPI tools | Codex was started before the entry was added, or the address is not the one above. | Check the entry, then quit Codex and start it again. |
| `find` works, `call` says `unauthorized` | The key did not reach the service from Codex. The two free tools need no key, so they still answer. | Check that the key is where the entry reads it from, and that it starts with `dx_`. Then restart. |
| `call` says `insufficient_balance` or `key_budget_exceeded` | The balance, or this key's budget, does not cover the price of the call. Nothing was charged. | Ask it to run `account`, then top up or raise the key's budget. |

## All clients

- [Use DataXAPI in Claude Code](https://dataxapi.com/integrations/claude-code/)
- [Use DataXAPI in Cursor](https://dataxapi.com/integrations/cursor/)
- [Use DataXAPI in n8n](https://dataxapi.com/integrations/n8n/)
- [Use DataXAPI in Cherry Studio](https://dataxapi.com/integrations/cherry-studio/)
- [MCP](https://dataxapi.com/mcp/)
- [What an agent reads to set itself up](https://dataxapi.com/agents/)

---

Generated from catalog revision c48ce454ae6c4c65, price book 2. [Page](https://dataxapi.com/integrations/codex/)
