cURL
A copyable cURL request for OptimAI Search.
curl --fail-with-body https://api-onchain.optimai.network/external/v1/search \
-H "X-API-Key: $OPTIMAI_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: curl-search-001" \
-d '{
"query": "What are the latest AI search infrastructure patterns?"
}'Copy the returned id, then poll it:
curl --fail-with-body \
https://api-onchain.optimai.network/external/v1/search/SEARCH_ID \
-H "X-API-Key: $OPTIMAI_API_KEY" | jqPipe to jq when debugging locally:
curl --fail-with-body https://api-onchain.optimai.network/external/v1/search \
-H "X-API-Key: $OPTIMAI_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: curl-agent-search-001" \
-d '{"query":"Analyze OptimAI and current crypto market news","search_mode":"agent"}' | jqAgent mode costs 2 credits, compared with 1 credit for Standard Search. It is text-only and must be selected explicitly.