# Grok (xAI) + Dizo

> Give Grok the Dizo tools through the xAI API remote MCP support: Grok calls Dizo directly while it reasons.

Type: MCP client — server URL `https://mcp.dizo.ai/mcp`. No native app needed.

## Steps
1. `pip install xai-sdk` and set `XAI_API_KEY` and `DIZO_API_KEY`.
2. Add Dizo as a remote MCP tool with its server URL and your key as a header.
3. Ask Grok a prospecting question; it calls the Dizo tools it needs.

## Where to go
Pass an `mcp` tool with the server URL and authorization; xAI's servers call Dizo for you.

Open the xAI remote MCP docs: https://docs.x.ai/developers/tools/remote-mcp

## grok_agent.py (xAI SDK)
```
import os
from xai_sdk import Client
from xai_sdk.chat import user
from xai_sdk.tools import mcp

client = Client(api_key=os.environ["XAI_API_KEY"])
chat = client.chat.create(
    model="grok-4.3",
    tools=[mcp(
        server_url="https://mcp.dizo.ai/mcp",
        server_label="dizo",
        extra_headers={"Authorization": f"Bearer {os.environ['DIZO_API_KEY']}"},
    )],
)
chat.append(user("Find 5 VPs of Sales at US fintechs with 200-1000 employees. Quote the cost first."))
print(chat.sample().content)
```

## Responses API (OpenAI-compatible)
```
curl https://api.x.ai/v1/responses \
  -H "Authorization: Bearer $XAI_API_KEY" -H "Content-Type: application/json" \
  -d '{
    "model": "grok-4.3",
    "input": "Who is behind maya@ledgerline.io?",
    "tools": [{ "type": "mcp", "server_label": "dizo", "server_url": "https://mcp.dizo.ai/mcp",
               "headers": { "Authorization": "Bearer '"$DIZO_API_KEY"'" } }]
  }'
```

## Notes
- xAI connects to Dizo from its own servers, so the hosted URL works and no local server is needed.
- Model names change; use any current Grok model from the xAI docs.
- Limit what Grok can spend with a scoped key: set max credits per request and a daily cap on the key.

## Related API docs
- [/docs/search](https://dizo.ai/docs/search.md)
- [/docs/email-to-profile](https://dizo.ai/docs/email-to-profile.md)
- [/docs/keys](https://dizo.ai/docs/keys.md)


## Grok, the xAI API and remote MCP tools

Grok is the family of large language models from xAI, available in xAI's own apps and to developers through the xAI API. That API offers an OpenAI-compatible Responses endpoint and an official Python SDK, and it supports remote MCP tools: you tell the API where an MCP server lives, and Grok can call that server's tools while it reasons through a request.

The distinctive part is where the connection happens. With remote MCP on the xAI API, xAI's servers connect to Dizo on your behalf. You do not run a local MCP process or proxy tool calls through your own code. You pass the Dizo server URL and a header with your key, and Grok decides which Dizo tools to call, calls them and folds the results into its answer. For developers building prospecting assistants or research agents on Grok, that removes most of the plumbing.

## Why give Grok access to Dizo

Language models are good at planning a prospecting task and poor at knowing current facts about specific people. Grok can reason about which roles at a fintech are likely to own a payments decision, but it cannot know who holds that role today or what their work email is. Dizo supplies those facts: 850M professional profiles, 100M+ websites and companies, 800M verified emails and 550M mobiles and direct dials, exposed as tools with their credit cost in each description.

That pairing is especially useful in server-side agents, where nobody is watching each step. Because Dizo charges nothing for lookups that find nothing, publishes an exact quote tool, and lets you cap a key per request, per day and per month, you can let Grok call tools freely inside a known budget. The page's example prompt even asks Grok to quote the cost first, which it can do with the free `dizo_quote` tool.

## Prompts and tasks that suit Grok plus Dizo

These work as single requests to the API with the Dizo tool attached:

- "Find 5 VPs of Sales at US fintechs with 200-1000 employees. Quote the cost first." (the page's example)
- "Who is behind maya@ledgerline.io?" (email to profile, 2 credits if found; the page's Responses API example)
- "How many heads of procurement are there at European manufacturers? Free count only."
- "For these 20 domains, return the most senior marketing leader, trying CMO, then VP Marketing, then Head of Marketing."
- "Enrich vercel.com and summarize latest funding round, headcount band and technologies."
- "Get the mobile number for this person, only if it is not on the Do Not Call registry."
- "Check my remaining Dizo budget for today before starting." (dizo_whoami, free)

## Setup with the xAI SDK

Install the SDK with `pip install xai-sdk` and set two environment variables: `XAI_API_KEY` for xAI and `DIZO_API_KEY` for Dizo. In Python, create a `Client` with your xAI key, then create a chat with a model name and a `tools` list containing one `mcp(...)` entry. That entry takes `server_url="https://mcp.dizo.ai/mcp"`, a `server_label` of `dizo`, and `extra_headers` with the `Authorization: Bearer` header built from `DIZO_API_KEY`.

Append a user message with your prospecting question and call `chat.sample()`. Grok reads the Dizo tool list, decides which tools it needs, calls them through xAI's connection to the Dizo server and returns its answer as `content`. The page's script uses `grok-4.3` as the model; model names change, so use any current Grok model listed in the xAI docs.

If you prefer plain HTTP, the Responses API works the same way. Post to `https://api.x.ai/v1/responses` with your xAI key, a model, an `input` string and a `tools` array containing an object with `type: "mcp"`, `server_label: "dizo"`, `server_url` set to the Dizo MCP URL and a `headers` object with your Dizo bearer key. The [MCP page](/mcp) lists every tool Grok will see.

Whichever route you use, start with a cheap first request such as asking Grok to call `dizo_whoami`. It is free, and the answer confirms three things at once: that xAI reached the server, that your Dizo key authenticated, and which scopes, allowed endpoints and remaining budget the key carries. If that works, any later failure is about the request itself rather than the connection.

## Limiting what Grok can spend

The page's guidance is to use a scoped key: set max credits per request and a daily cap on the key Grok uses. That is the right default for any server-side model with tool access. Create the key with `data:read` scope, a `max_credits_per_request`, a `daily_cap_credits` and a `monthly_cap_credits`, and add an endpoint allow-list if your use case only needs certain tools. Billing write actions need `billing:write`, which Grok should never be given. See the [keys reference](/docs/keys) for the exact fields.

Two more layers help. In your prompt, ask Grok to call `dizo_quote` before any job likely to exceed about 100 credits and to stop if the quote is above your budget. At the account level, set a monthly spend cap; once it is reached, calls return `402 monthly_cap_reached` instead of charging. Alerts go out at 50%, 80% and 100% of every cap, and auto-refill never pushes a month past the cap.

## Costs, worked through

Dizo credits are priced by the size of each single purchase: $0.025 for $10 to $499, $0.021 for $500 to $1,999, $0.017 for $2,000 to $9,999, $0.013 for $10,000 to $49,999 and $0.010 for $50,000 and up. These figures use $0.025 and assume all lookups succeed. They cover Dizo only; xAI bills separately for Grok usage.

The five-VP example is a search returning five people, 0.2 credits, plus five emails if Grok fetches them, 5 credits, so about 5.2 credits or $0.13. The reverse-lookup example is 2 credits, $0.05, if the person is found and nothing otherwise. Scale up to an agent that qualifies 1,000 inbound signups a month with email to profile and finds mobiles for the top 100: up to 2,000 credits plus 1,000 credits, 3,000 in total, $75 if bought at the first tier. A single $500 Builder purchase at $0.021 buys about 23,809 credits, covering several months of that volume. Details are on [pricing](/pricing).

## Example builds

A Slack prospecting bot. Your bot receives a message like "find me three CFOs at mid-sized US logistics companies", passes it to Grok with the Dizo tool attached, and posts the answer back. The key behind the tool has a 50-credit per-request limit and a 500-credit daily cap, so the worst a busy day can cost is bounded before anyone types a message.

Inbound enrichment service. A small service receives new signups, asks Grok to identify each person with email to profile, enrich their company and write a two-line qualification summary. Unmatched emails cost nothing. Grok returns structured text your service writes to the CRM.

Research endpoint for an internal tool. Analysts paste a domain and get a briefing. Grok calls `dizo_enrich_company` and `dizo_org_chart`, then writes the briefing. Each request costs a few credits.

Across all three, keep a log of the `credits_used` value Dizo returns on each call alongside the Grok request id. When you review usage at the end of the month, you can tie every credit to the request that spent it, and spot prompts that consistently trigger more lookups than they need, such as requests that pull mobiles when an email would have done.

## Troubleshooting and security

If Grok answers without calling Dizo, make sure the `tools` list actually includes the MCP entry and that your prompt asks for something Dizo provides. If xAI reports that it could not connect to the MCP server, check the URL and that the bearer header contains a valid key; an unset `DIZO_API_KEY` produces an empty header. If tool calls fail with `402`, a cap was reached. Rate-limit errors come back with `error.retryable` and `error.retry_after`. Because xAI connects from its own servers, an IP allowlist on your Dizo account, which is an enterprise security option, would need to permit those connections.

Keep both keys in environment variables or a secrets manager, never in source code. Use a `dz_test_` key while developing; it returns synthetic data and spends nothing. [Sign up](/signup) for a live key. Work email signups get 250 free credits.

## FAQ

### Do I need to host an MCP server to use Dizo with Grok?
No. With remote MCP on the xAI API, xAI connects to the hosted Dizo server at https://mcp.dizo.ai/mcp from its own servers. You only pass the URL, a label and your Dizo key as a header.

### Which Grok model should I use?
Any current Grok model that supports tool use. The page's example uses grok-4.3, but model names change, so check the xAI docs for the current list.

### Can I use the Responses API instead of the Python SDK?
Yes. The xAI Responses API is OpenAI-compatible. Send a tools array with an mcp entry containing the Dizo server URL, a server label and an Authorization header, as in the curl example on this page. Both routes give Grok the same Dizo tools.

### How do I cap what Grok spends on Dizo?
Use a dedicated Dizo key with data:read scope, a max credits per request and daily and monthly caps. The account monthly cap adds a hard ceiling, and calls return 402 once it is reached.

### Is xAI usage included in Dizo credits?
No. Dizo credits cover Dizo data calls only. Grok model usage is billed by xAI under your xAI account, so budget for both, and set caps in each system rather than relying on one to limit the other.

### Does Grok get charged when Dizo finds nothing?
No. Lookups that return no email, phone or person are free, and searches charge only for results returned. Company enrich follows the same rule: 1 credit, only when the domain matches.
