SDKs
Bash / cURL
Shell-Einzeiler und jq-Pipelines für Ad-hoc-Arbeit
Praktisch für schnelle Checks, CI-Skripte oder das direkte Pipen von Markdown in ein anderes Tool. Kombiniere curl mit jq, um die Response zu zerschneiden.
Konfigurieren
export THUNDERBIT_API_KEY="..."
export API="https://openapi.thunderbit.com/openapi/v1"Eine Seite distillen
curl -sX POST "$API/distill" \
-H "Authorization: Bearer $THUNDERBIT_API_KEY" \
-H "Content-Type: application/json" \
-d '{"url": "https://thunderbit.com/playground"}' \
| jq -r '.data.markdown'Pipe direkt in eine Datei oder ein anderes Tool:
curl -sX POST "$API/distill" \
-H "Authorization: Bearer $THUNDERBIT_API_KEY" \
-d '{"url": "'"$1"'"}' \
| jq -r '.data.markdown' > out.mdStrukturierte Daten extrahieren
curl -sX POST "$API/extract" \
-H "Authorization: Bearer $THUNDERBIT_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"url": "https://example.com/product/iphone-15-pro",
"schema": {
"type": "object",
"properties": {
"name": { "type": "string" },
"price": { "type": "number" }
},
"required": ["name", "price"]
}
}' \
| jq '.data'Batch + Polling
Für Ad-hoc-Batch-Läufe aus der Shell:
JOB=$(curl -sX POST "$API/batch/distill" \
-H "Authorization: Bearer $THUNDERBIT_API_KEY" \
-H "Content-Type: application/json" \
-d '{"urls": ["https://example.com/p1", "https://example.com/p2"]}' \
| jq -r '.data.id')
while :; do
STATUS=$(curl -s "$API/batch/distill/$JOB" \
-H "Authorization: Bearer $THUNDERBIT_API_KEY" \
| jq -r '.data.status')
echo "$STATUS"
[[ "$STATUS" == "COMPLETED" || "$STATUS" == "FAILED" ]] && break
sleep 10
doneIn Produktion bevorzuge Webhooks gegenüber Polling — siehe Webhooks.
Batch über URL-Liste
xargs -a urls.txt -I {} echo '"{}"' \
| paste -sd, - \
| xargs -I {} curl -sX POST "$API/batch/distill" \
-H "Authorization: Bearer $THUNDERBIT_API_KEY" \
-H "Content-Type: application/json" \
-d '{"urls": [{}]}'