Grok
Query xAI's Grok via Wire — the answer plus the web sources it cited
POST
https://api.anakin.io/v1/wire/taskRun a prompt against xAI's Grok and get the answer with the web sources it used. Grok runs on your own connected account (auth_mode: "required") — pass its credential_id. Run it with the grok_prompt action on POST /v1/wire/task.
Catalog: grok · action_id: grok_prompt · Credits: 10 / call · Auth: required
Request Body
{
"action_id": "grok_prompt",
"credential_id": "11111111-2222-3333-4444-555555555555",
"params": { "prompt": "best CRM for small teams", "model": "fast" }
}| Parameter | Type | Description |
|---|---|---|
action_id required | string | Set to grok_prompt |
credential_id required | string (UUID) | Your connected Grok account — from GET /v1/wire/identities |
params.prompt required | string | Your question for Grok (≤ 16384 chars) |
params.model | string | fast (Grok 3), expert (Grok 4), or auto. Default fast |
params.timeout | number | Max seconds to wait for the answer. Default 90 |
Code Examples
curl -X POST https://api.anakin.io/v1/wire/task \
-H "X-API-Key: your_api_key" \
-H "Content-Type: application/json" \
-d '{
"action_id": "grok_prompt",
"credential_id": "11111111-2222-3333-4444-555555555555",
"params": { "prompt": "best CRM for small teams", "model": "fast" }
}'import requests
res = requests.post(
'https://api.anakin.io/v1/wire/task',
headers={'X-API-Key': 'your_api_key'},
json={
'action_id': 'grok_prompt',
'credential_id': '11111111-2222-3333-4444-555555555555',
'params': {'prompt': 'best CRM for small teams', 'model': 'fast'},
},
)
job_id = res.json()['job_id']const res = await fetch('https://api.anakin.io/v1/wire/task', {
method: 'POST',
headers: { 'X-API-Key': 'your_api_key', 'Content-Type': 'application/json' },
body: JSON.stringify({
action_id: 'grok_prompt',
credential_id: '11111111-2222-3333-4444-555555555555',
params: { prompt: 'best CRM for small teams', model: 'fast' },
}),
});
const { job_id } = await res.json();Response
202 Accepted{ "status": "processing", "job_id": "…", "poll_url": "/v1/wire/jobs/…" }Poll GET /v1/wire/jobs/{id} until status: "completed":
{
"status": "completed",
"credits_used": 10,
"data": {
"status": "ok",
"data": {
"prompt": "…", "model": "fast", "web_search": true,
"answer_text": "…", "answer_complete": true,
"sources": [ { "url": "https://…", "title": "…" } ],
"conversation_id": "…", "account_email": "…", "accounts_tried": 1, "prompt_sent_at": "…"
},
"meta": { "action_id": "grok_prompt", "catalog_slug": "grok", "envelope_version": "v1" }
}
}| Field | Type | Description |
|---|---|---|
data.data.answer_text | string | The answer |
data.data.answer_complete | boolean | Whether the stream finished within timeout |
data.data.sources | array | Web sources cited — { url, title } |
data.data.model | string | The Grok model used |
data.data.conversation_id | string | The Grok conversation id |
Auth required — omitting
credential_idreturns401 AUTH_REQUIRED. Premium engine: 10 credits/call.model: "expert"uses Grok 4 (slower, deeper). Billed only on success.