Deploy Preds in under 10 minutes
Walk through key creation, your first requests and production monitoring.
Prerequisites
Make sure you have the following before sending requests:
- Preds workspace with the Free tier or any paid plan.
- HTTP client with TLS 1.2+ and JSON support (curl, fetch, HTTPie).
Texts must contain at least 60 words and every call must use HTTPS + JSON.
Base URLs
Use the same version locally and in production.
- `https://preds.hu/api/v1` — production, EU-hosted infrastructure.
- `Content-Type: application/json` and `Authorization: Api-Key …` are required on every request.
Create an API key
Keys live on a workspace and are only shown once.
- Open Dashboard → API keys → “New key”.
- Provide a descriptive label (for example `backend-ingest`).
- Copy the value into your secrets manager immediately.
# store the Preds key securely export PREDS_API_KEY="sk_live_..."
Send the first detection
The synchronous endpoint answers in ~200ms and enforces the 60 word minimum.
Python example
import os
import requests
# Configuration
API_KEY = os.getenv('PREDS_API_KEY')
BASE_URL = 'https://preds.hu/api/v1'
# Prepare request
headers = {
'Authorization': f'Api-Key {API_KEY}',
'Content-Type': 'application/json'
}
payload = {
'text': 'Paste the Hungarian text you want to audit (minimum 60 words).'
}
# Send detection request
response = requests.post(
f'{BASE_URL}/detect/api/',
headers=headers,
json=payload
)
# Handle response
if response.status_code == 200:
data = response.json()
print(f"Prediction: {data['prediction']}")
print(f"Confidence: {data['confidence']}")
print(f"Quota remaining: {data['quota']['remaining']}")
else:
print(f"Error: {response.status_code} - {response.text}")Queue async detections
Use the task-backed endpoint for larger batches or workflows where you prefer polling.
Queue a task (Python)
import os
import requests
import time
# Configuration
API_KEY = os.getenv('PREDS_API_KEY')
BASE_URL = 'https://preds.hu/api/v1'
headers = {
'Authorization': f'Api-Key {API_KEY}',
'Content-Type': 'application/json'
}
# Queue async detection
response = requests.post(
f'{BASE_URL}/detect/async/',
headers=headers,
json={'text': 'Paste the Hungarian text you want to audit.'}
)
task_data = response.json()
task_id = task_data['task_id']
print(f"Task queued: {task_id}")
# Poll for completion
while True:
result_response = requests.get(
f'{BASE_URL}/tasks/{task_id}/result/',
headers=headers
)
result = result_response.json()
if result['status'] == 'completed':
data = result['data']
print(f"Prediction: {data['prediction']}")
print(f"Confidence: {data['confidence']}")
break
elif result['status'] == 'failed':
print(f"Task failed: {result.get('message')}")
break
time.sleep(1) # Wait before polling againPoll for results
curl -X GET https://preds.hu/api/v1/tasks/<task_id>/result/ -H "Authorization: Api-Key $PREDS_API_KEY"
{
"task_id": "b2b6c9c2-1c2e-4e3c-9a3d-43c7c9326d2f",
"status": "completed",
"data": { "prediction": "ai", "confidence": 0.91, "submission_id": 1341 }
}Handle the response
Response format is clean and professional. Use ?detailed=true for full data with segments.
- `prediction` and `confidence` form the primary verdict.
- `request_id` helps with debugging. In detailed mode (`?detailed=true`), `submission_id` is also available.
- docs.gettingStarted.handleResults.items.latency
Hardening checklist
Bake the following into your production deployment.
- Rotate API keys quarterly or immediately after an incident.
- Use separate keys per service so you can audit scope usage.
- Monitor `quota.remaining` and `rate_limit.remaining`.
Troubleshooting
Most integration issues correspond to these signals.
- `code: quota_exceeded` → wait for the new cycle or purchase credits, the response includes remaining values.
- `code: rate_limit_exceeded` → implement exponential backoff and unique request IDs.
- `Text must contain at least 60 words` → surface a friendly error or pad the sample text.
- Still blocked? Email [email protected] with the `request_id`.
Next steps
- Review the full API reference for async, OCR and reporting endpoints.
- Share the contact link if you need help with custom workflows.