Connect the Predictions connector
Events live on the Predictions connector, which is a second connector next to Gina Read. They are not on the read-only connection.
The Predictions connector is write access (Degen mode). Its trading tools can move funds, even though the event tools never do. Add it from your client’s setup guide: ChatGPT, Codex, Claude or Grok. Keep both connectors. A read-only token or an old Gina execute grant is not a substitute for a Predictions grant with
tools:execute.
You also need a finished Predictions account with delegated signing in Ask Gina. Without it, creating a subscription fails with PREDICTION_EVENTS_ACCOUNT_NOT_READY.
What you get
Subscriptions deliver the following event names. Each name carries a version.- The scope is the whole Polymarket trading account, including orders placed outside Ask Gina. For those,
clientRefisnull. - A new subscription only sees transitions dated after it was created, with a few seconds of grace. Earlier ones are never delivered, including ones Ask Gina learns about later while it catches up.
- A subscription made with the event tools always receives health events, by webhook and by pull, and a filter never removes them. A subscription an MCP Events client creates receives them only if it subscribed to
prediction.subscription.health.v1. - Decimal values are strings.
kind such as gap, auth, source_disconnected, source_reconnected, delivery_failing, paused, terminated or limit_exceeded. Treat an unknown kind as informational. A gap means a transition could not be recovered, so read the account state again before you act on it.
Every event arrives in the same envelope:
data follows the versioned schema for the event name. Order and trade events echo the clientRef you passed when you placed the order, so an agent can match an event to its own intent. Pass clientRef and idempotencyKey on tradePredictionMarket and managePredictionOrders; see each tool’s input schema.
The event tools
The Predictions connector exposes event tools as native tools. Use the generated native tools reference for the tool inventory and annotation classes. Read each tool’s input schema fromtools/list for arguments and limits.
A filter can narrow by conditionIds, assetIds, orderIds, clientRefs, clientRefPrefixes, orderEventTypes and tradeStatuses. clientRefPrefixes matches any clientRef that starts with one of its values, so a bot that labels every order bot-<n> can subscribe once with bot-. Fields combine with AND and the values inside one field combine with OR. Empty arrays are rejected, and an omitted filter means everything. Strategy filters such as side or price do not exist.
Example arguments. Create a webhook subscription for one market’s trades, with a destinationId from listWebhookDestinations or from the destination that createWebhookDestination returned:
subscriptionId and cursor that createPredictionEventSubscription returned:
updatePredictionEventSubscription with a partial patch to change a tool-created subscription’s name, filter, destination or pause state. It cannot change subscriptions created through MCP Events. deletePredictionEventSubscription permanently ends a subscription; a tool-created one sends a final terminated health event to its destination.
Each call to an event tool is metered like a read tool. Deliveries to your webhook are not charged per event. Accounts have caps on subscriptions and destinations, and a subscription that exceeds its hourly delivery cap is paused with a limit_exceeded health event. The error details.limit states the current cap.
Register a webhook destination
A destination stores an HTTPS endpoint and the credential Ask Gina uses to deliver events. Registration through MCP and through the settings page shares the same destination cap and rate limits. Destinations from either path appear inlistWebhookDestinations and on the settings page.
The two registration paths below are for kind: "webhook", which uses a Standard Webhooks signing secret. Create the receiver first and copy its endpoint and signing secret if it provides one. This includes grok.com automations, not Grok Bot routines. For bearer-authenticated triggers, follow Claude Code routines or Grok Bot routines instead.
With MCP tools
Your agent can set up a destination without a browser.- Call
createWebhookDestinationwith alabel, the receiver’surl,kind: "webhook"and, if the receiver gave you one, itswhsec_signing secret assecret. - Read the result. It holds the
destination(id, label, host, status and last test),secretGeneratedand anextlist. When you passed nosecret, Ask Gina generates awhsec_secret and returns it once insecret. Store it in your receiver straight away, because no tool or page shows it again. If you lose it, rotate the secret. - If you want to start a test on your receiver, call
sendWebhookTestEventwith thedestinationId. It returns the HTTPstatusyour endpoint answered and anoutcome. - Call
createPredictionEventSubscriptionwith the samedestinationId.
secret. A secret Ask Gina generated would not match the receiver.
createWebhookDestination and a second destination appears, call listWebhookDestinations and call disableWebhookDestination on the extra one. Disabling cannot be undone, so check the ids first.
For kind: "webhook", replace a signing secret with rotateWebhookDestinationSecret, passing the destinationId and an optional new secret. It works on active destinations only and returns a generated secret once if you omit secret. A receiver that supplies its own secret needs its replacement value. To end a destination, call disableWebhookDestination with the destinationId.
The secret passes through your client’s transcript on this path either way: you pass it in as secret, or Ask Gina returns it once in the result. Treat that transcript as holding a credential for this destination. Create, rotate and disable are marked destructive, so hosts ask you to confirm each call before it runs. sendWebhookTestEvent is not destructive, but it reaches your receiver.
On the settings page
- Open askgina.ai/profile/webhooks and choose Add destination.
- Enter a Label and the Webhook or routine URL. Under Receiver type, choose Webhook and enter the receiver’s Signing secret, which starts with
whsec_. For a routine, follow its setup section instead. - If you want to run a test, press Send test event. Ask Gina signs a
prediction.subscription.health.v1event withkind: "test"and shows the HTTP status your endpoint returned. A test can start real work on the receiver.
Rules for a destination
The URL, storage, destination limits and disabling rules apply to every destination kind on both registration paths. Signing, rotation and test bodies depend on the kind.- The URL must be
https, use the default port, carry no credentials and name a public DNS host. IP addresses,localhostand internal names are refused, and so is a host that resolves to a private, loopback, link-local or metadata address. Redirects are never followed and count as failed deliveries. - The secret is stored encrypted and is never shown again. Tools and the page show the host, not the full URL, because a trigger URL can itself be a bearer credential.
- The settings page and tools share the same active-destination cap and rate limits for adding destinations and sending test events. At the destination cap,
createWebhookDestinationfails withWEBHOOK_DESTINATION_LIMIT_REACHED;details.limitstates the current cap. A rate-limited call names theactionand thelimit. - To replace a webhook secret, use Rotate secret on the row or
rotateWebhookDestinationSecret. The previous secret keeps signing alongside the new one for 24 hours, so you can update the receiver without losing deliveries. A Claude routine row uses Replace token and has no such overlap. See Rotate the routine token. - Disabling ends the destination and cannot be reversed. Register a new destination instead. It pauses the subscriptions that use it, and it works from the page (Disable) or from
disableWebhookDestination. - A webhook test signs
prediction.subscription.health.v1withkind: "test". Ask Gina sends it once, retries nothing and does not store it in the event log. It starts a real automation on receivers such as grok.com, so expect it to run. A Claude routine gets a short unsigned test message instead. It starts a real session, uses the routine’s fire quota and takes the destination’s 150-second fire slot. If the routine was fired less than 150 seconds ago, nothing is sent.sendWebhookTestEventreturnsWEBHOOK_ROUTINE_NOT_READYwithdetails.retryAfterSeconds, and the settings page tells you to wait N seconds. Tests are optional, and creating a destination never sends one automatically.
destinationId. The agent sees labels and ids only.
Verify Standard Webhooks signatures
This section applies only tokind: "webhook". Ask Gina signs those deliveries with the Standard Webhooks scheme and sends one event per request. Claude Code routines and Grok Bot routines use Bearer authentication instead, with no Standard Webhooks signature headers.
To verify a request:
- Read the raw body bytes. Do not parse and re-serialize them.
- Build the signed content
{webhook-id}.{webhook-timestamp}.{raw body}. - Strip the
whsec_prefix, base64-decode the rest and use it as the HMAC-SHA256 key. - Compare your base64 digest with each
v1,value in constant time. Accept the request if any one matches. - Reject a timestamp more than five minutes from your clock.
- Return a
2xxstatus to acknowledge the event.
Delivery guarantees
These acknowledgement and retry rules apply tokind: "webhook", not routine destinations.
- Delivery is at least once. Dedupe on
eventId, which equals thewebhook-idheader. The same transition seen live and again during a backfill has oneeventId. - Events for one order or trade arrive in order. There is no global order across orders.
- A
2xxacknowledges the event. A410disables the destination and pauses its subscriptions; register a replacement destination and attach it before resuming. A413skips that event and is never retried. Other failures are retried with exponential backoff, the samewebhook-idand a new signature each time. - A subscription that keeps failing is paused and emits a
pausedhealth event. Resume it withupdatePredictionEventSubscriptionafter you fix the receiver. - An order event and a trade event can describe the same fill. Count a fill once: do not add an order event’s
sizeMatchedto a trade event’ssizefor the same fill.
Pull events with a cursor (Codex and other clients)
A client that cannot receive a webhook reads events instead. Codex is the main case. Pull needs no destination, so it needs no browser and no secret.- Call
createPredictionEventSubscriptionwithout adestinationId. This is a pull subscription. It also keeps Ask Gina’s stream for your account open, so events are recorded. The response includes asubscriptionIdand acursor. - Call
getPredictionEventswith thatsubscriptionIdandcursor. You getevents, a newcursor,hasMoreandtruncated. - Save the returned
cursorand pass it on the next call to read only newer events. IfhasMoreistrue, call again now with the new cursor until it isfalse. - Dedupe on
eventIdacross calls, because delivery is at least once.
subscriptionId. Without it, getPredictionEvents does not read the subscription’s events. It reads the whole retained account log from its oldest event, including events dated before the subscription existed. With subscriptionId, the read starts at the subscription’s start and returns only the events its filter selects, plus its health events.
Keep the cursor where the next call can find it. If your client can lose its conversation, write the cursor to a file. A cursor belongs to one user and one subscription; a cursor from elsewhere fails with PREDICTION_EVENTS_CURSOR_INVALID. Omit the cursor to restart from the subscription’s start.
If truncated is true, the cursor is older than the retained log, so some events were lost. Read the account state again, then continue from the returned cursor.
A pull client can still register an HTTPS receiver that you run for another process. Follow With MCP tools from Codex, then create a subscription with that destinationId. Codex itself still reads by cursor.
An unread pull subscription is eventually paused with a paused health event whose reason is idle. Calling getPredictionEvents with its subscriptionId counts as reading it. Resume a paused one with updatePredictionEventSubscription, passing its id and patch.enabled: true.
Poll from Claude Code
Claude Code can run the read on an interval while a session is open. The/loop command re-runs a prompt on a fixed schedule. See Run prompts on a schedule.
/loop task runs only while Claude Code is running and idle, so closing the session stops it. A recurring task also expires on its own, so check the expiry on that page and recreate the task before it ends. If Claude Code stops, start a new /loop that reads the saved cursor. For polling that does not depend on an open session, a scheduled routine can run the same read. See No push: poll from a scheduled routine. Polling is a read only. It does not place orders, and an event that arrives is not approval to act on it.
Grok webhook triggers
This section is for automations on grok.com, not Grok Bot routines. The two products use different credentials and acknowledgement statuses.- In grok.com, add a Webhook trigger to an automation, save it and copy the endpoint and signing secret. See Grok webhook triggers.
- Call
createWebhookDestinationwith alabel, the trigger endpoint asurl,kind: "webhook"and the trigger’swhsec_signing secret assecret. Always supply that secret; one generated by Ask Gina would not match the receiver. You can register the same endpoint and signing secret on askgina.ai/profile/webhooks instead. - If you want to start a real automation test, call
sendWebhookTestEventwith thedestinationId. Grok’s automation documentation specifies202 Accepted, which confirms acceptance, not completion. - Call
createPredictionEventSubscriptionwith the destination’sdestinationId. A filter such asclientRefslimits it to orders your bot placed with that reference.
rotateWebhookDestinationSecret with the new secret, or use Rotate secret on the same settings row, before the next event.
Claude Code routines
A Claude Code routine can receive events without a receiver of your own. Ask Gina calls the routine’s API trigger, and Claude Code starts a new cloud session for each call. The Claude page walks through creating the routine and registering it. This section describes how delivery behaves. Anthropic marks routines as a research preview and the fire endpoint as experimental, so the details below can change on its side. See Trigger a routine through the API.Register a routine
For a Claude routine, passkind: "claude_routine" to createWebhookDestination or omit kind to infer it from the URL. A Claude routine’s url must be exactly https://api.anthropic.com/v1/claude_code/routines/trig_.../fire, with the routine’s own id in place of the dots. Any other api.anthropic.com address is refused. A kind that contradicts the URL fails with INVALID_ARGUMENTS on kind.
For a routine, the secret is required and must be the routine’s API trigger token, which starts with sk-ant-oat01-. Ask Gina cannot generate one, so createWebhookDestination without a secret fails with INVALID_ARGUMENTS. Register it on askgina.ai/profile/webhooks when you can. Leave Receiver type as Detect from the address or choose Claude routine. The token then never enters a chat. If an agent registers it with the tool, the token stays in that transcript, and the tool result never echoes it. Then create a subscription with the destinationId as for any other destination.
What Ask Gina sends
- Batching. Ask Gina fires a destination at most once every 150 seconds. Each fire carries every event waiting at that moment, oldest first, so a burst of fills becomes one session. Events that do not fit wait for the next fire, and the fire’s text then says that more events are waiting.
- Text. The fire body has one
textfield. It holds a short note, then a JSON array of event envelopes. The text stays under Anthropic’s 65,536-character limit, and an envelope is never split. - Note. The note says that events can repeat, that the reader should dedupe on
eventIdand that the message is not your approval for any trade. - Authentication. Ask Gina sends the token as a bearer token. There are no Standard Webhooks headers, because the receiver is Anthropic and nothing on your side verifies a signature.
eventId values somewhere the routine can write.
Delivery outcomes
A
400 can mean the routine is paused. A 401 means the token is wrong or you regenerated it. A 403 means the account or organization has no access to the endpoint, and a 404 means the routine no longer exists. These answers pause the subscription at once, rather than waiting for repeated failures. A single event envelope too large to fit by itself also pauses the subscription with reason routine_too_large; Ask Gina never splits it. Other failures use normal backoff and pause the subscription if it keeps failing. Fix the cause, then resume with updatePredictionEventSubscription and patch.enabled: true. listPredictionEventSubscriptions shows why one is paused. Ask Gina keeps the status and a fixed reason for a failure, not the text of Anthropic’s error.
Rotate the routine token
Regenerating a token in Claude makes the old one stop at once. Ask Gina cannot keep signing with it for 24 hours as it does for a webhook secret.- In claude.ai, open the routine’s API trigger and click Regenerate. Copy the new token.
- Right away, press Replace token on the routine destination’s row, enter the new Routine API trigger token and press Save token. Or call
rotateWebhookDestinationSecretwith thedestinationIdand the new token assecret. Rotate secret is for webhook rows, not routines.
401 and immediately pause the subscription with reason routine_rejected. Do them back to back. If a delivery paused the subscription, resume it after saving the token with updatePredictionEventSubscription and patch.enabled: true. To stop routine pushes for good, delete the API trigger’s token in claude.ai and call disableWebhookDestination.
Limits and billing
Anthropic applies per-routine and per-account fire limits. Run now, test events and other callers share the quotas, so Ask Gina’s 150-second destination interval does not guarantee quota remains available. Past a limit Anthropic answers429, and Ask Gina waits without counting a delivery failure.
Each session draws on your Claude subscription like an interactive session. Ask Gina does not charge per delivery. Check Anthropic’s usage and limits for the current numbers and for what happens when your subscription limit runs out.
Safety
An event that starts a session is a notification, not a request to trade. The note says so, and Anthropic wraps the text as untrusted data in the session. Treat the fired text that way yourself. A routine that holds the Predictions connector can place orders without you present, because Claude runs it in auto mode. For a routine that only needs to tell you what happened, remove the Predictions connector and report through another one. Orders you want placed still go through Gina in a session where you can confirm them.Grok Bot routines
Grok Bot routines receive events through a bearer-authenticated webhook trigger, not a grok.com automation’s signed webhook. Follow Grok Bot connection setup for registration, test behavior and scheduled cursor reconciliation. An accepted delivery does not prove the routine completed its work.ChatGPT MCP Events
Ask Gina implements these methods on the Predictions endpoint. ChatGPT’s use of them with Ask Gina
has not been verified end to end, and the MCP Events specification is a draft, so method details
can change.
events in its capabilities and handles these methods:
The first
events/poll from a client also creates a pull subscription for it, which keeps Ask Gina’s stream for your account open.
For subscribe, ChatGPT sends the callback URL and a whsec_ secret itself, so you do not register a destination, by tool or on the settings page. Ask Gina first posts a signed verification challenge to the callback and requires ChatGPT to echo it, then activates delivery. A failed verification returns the JSON-RPC error -32015.
A protocol subscription has an expiry. Ask Gina grants a lifetime, returns refreshBefore, and ChatGPT refreshes the subscription before that time. A subscription that is not refreshed before refreshBefore ends. Revoking the token or OAuth grant that created it ends it too. A refresh with a new secret keeps signing with the old and new secrets for a short window.
Streaming is not offered, and ChatGPT does not act on protocol control notifications. Gaps and endings reach a protocol subscription only as prediction.subscription.health.v1 events, and only if it subscribed to that name, which takes no arguments. A subscription to prediction.order.v1 or prediction.trade.v1 receives order or trade events and no health events, so subscribe to the health name as well when you need to learn about gaps and endings.
ChatGPT requires MCP protocol version 2026-07-28 and the draft MCP Events specification.
Check that it works
Steps 1 and 2 only read. Steps 3 and 5 create a destination and a subscription, and your host asks you to confirm step 3. Step 4 is optional: routine tests start real runs and spend usage. Choose the receiver kind before registering it.- In your client, open the tool list for
https://askgina.ai/ai/predictions/mcpand confirmcreateWebhookDestination,sendWebhookTestEventandgetPredictionEventsappear. Confirm that your client marks the create, rotate and disable tools as destructive. - Ask “Use Gina to list my webhook destinations.” Expected: a
destinationslist that has labels, hosts and anextlink to the settings page, and no URLs or secrets. - Ask “Use Gina to register my receiver as a destination.” For
kind: "webhook", supply its URL and itswhsec_signing secret if the receiver made one. For routines, follow the Claude or Grok Bot setup for the URL, kind and credential. Expected: adestinationwith statusactive. Onlykind: "webhook"with no supplied secret returnssecretGenerated: trueand a secret to install in the receiver; routines never generate a credential. - If you want a real test, ask “Use Gina to send a test event to that destination.” Expected:
sendWebhookTestEventreturns an HTTPstatusand anoutcome. Akind: "webhook"receiver gets one signed test event. Routine tests start real runs and spend usage; inspect the run to learn whether it finished. - Ask “Create a prediction event subscription for this destination.” Expected: a subscription with status
activeand acursor. Then, if you choose to, place an order yourself. Confirm that your receiver gets aneventIdfor each transition and that a repeatedeventIdis the same event.
secret. You can pass kind: "claude_routine" or omit kind to infer it from the URL. Step 4 sends a short unsigned test message, starts a real session, uses the routine’s fire quota and takes the destination’s 150-second fire slot. Expect one new run in the routine’s history instead of a signed request. If the slot is not ready, nothing is sent: sendWebhookTestEvent returns WEBHOOK_ROUTINE_NOT_READY with details.retryAfterSeconds. Wait that long before trying again. If you prefer the settings page, register the destination and press Send test event there instead of steps 3 and 4; a refusal tells you to wait N seconds. If a tool is missing, remove the connection and add it again. If you see PREDICTION_EVENTS_ACCOUNT_NOT_READY, finish Predictions account setup in Ask Gina first.