1from apify_client import ApifyClient
2
3
4
5client = ApifyClient("<YOUR_API_TOKEN>")
6
7
8run_input = {
9 "conversion_type": "curl_to_python",
10 "input_data": """curl -X POST 'https://api.example.com/v1/messages' \\
11 -H 'Content-Type: application/json' \\
12 -H 'Authorization: Bearer sk-ant-api03-xxxxx' \\
13 -H 'X-Request-Id: req_12345' \\
14 -d '{
15 \"model\": \"claude-sonnet-4-20250514\",
16 \"max_tokens\": 1024,
17 \"system\": \"You are a helpful assistant.\",
18 \"messages\": [
19 {\"role\": \"user\", \"content\": \"Explain quantum computing in simple terms\"}
20 ]
21 }'""",
22 "add_error_handling": True,
23 "add_type_hints": True,
24 "add_docstrings": True,
25 "timeout_seconds": 30,
26 "max_retries": 3,
27 "base_url_override": "",
28 "output_format": "full",
29 "save_to_key_value_store": True,
30 "proxy_configuration": {},
31}
32
33
34run = client.actor("moving_beacon-owner1/my-actor-67").call(run_input=run_input)
35
36
37print("πΎ Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
38for item in client.dataset(run["defaultDatasetId"]).iterate_items():
39 print(item)
40
41