cURL¶
Every example in this site ultimately comes down to a cURL invocation. This page collects the canonical recipes.
Default — auto-router¶
export SMART_GATEWAY_BASE_URL="https://smart-openrounter.bee1x.one"
export SMART_GATEWAY_API_KEY="$YOUR_GATEWAY_KEY"
curl -sS "$SMART_GATEWAY_BASE_URL/v1/chat/completions" \
-H "Authorization: Bearer $SMART_GATEWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "smart-router",
"messages": [{"role":"user","content":"Reply with PONG."}],
"max_tokens": 8
}'
Force Pro¶
curl -sS "$SMART_GATEWAY_BASE_URL/v1/chat/completions" \
-H "Authorization: Bearer $SMART_GATEWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "smart-router-pro",
"messages": [{"role":"user","content":"[reasoning:high] sketch a semaphore design"}],
"max_tokens": 400
}'
Force Flash¶
curl -sS "$SMART_GATEWAY_BASE_URL/v1/chat/completions" \
-H "Authorization: Bearer $SMART_GATEWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "smart-router-flash",
"messages": [{"role":"user","content":"summarize this file"}],
"max_tokens": 200
}'
Streaming¶
curl -sN "$SMART_GATEWAY_BASE_URL/v1/chat/completions" \
-H "Authorization: Bearer $SMART_GATEWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "smart-router-flash",
"stream": true,
"messages": [{"role":"user","content":"count to 5"}],
"max_tokens": 64
}'
-sN silences the progress bar and disables cURL's internal
buffering, so SSE chunks appear as they arrive.
Dry-run a routing decision¶
curl -sS "$SMART_GATEWAY_BASE_URL/v1/route/decision" \
-H "Authorization: Bearer $SMART_GATEWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"task": {
"task_id":"t1","goal_id":"g1","kind":"DEBUG",
"instruction":"find the race in the auth refresh",
"sensitive":true,"risk_level":"HIGH","blast_radius":"HIGH"
},
"runtime":{"same_error_count":1,"files_touched":6}
}'
Health probe¶
Expected:
The literal "phase":"blueprint" is intentional — it preserves
backward compatibility with earlier probes.
Pretty-print with jq¶
curl -sS "$SMART_GATEWAY_BASE_URL/v1/chat/completions" \
-H "Authorization: Bearer $SMART_GATEWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"smart-router-flash","messages":[{"role":"user","content":"PONG"}],"max_tokens":4}' \
| jq '.model, .choices[0].message.content'
Timeouts and connection settings¶
For production use, set explicit timeouts and disable cURL's default redirect-following (TLS-terminating nginx returns 301 → 443, which cURL would otherwise silently follow):
curl -sS --max-time 60 --connect-timeout 5 \
"$SMART_GATEWAY_BASE_URL/v1/chat/completions" \
-H "Authorization: Bearer $SMART_GATEWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '...'
Verbose for debugging¶
curl -sSv "$SMART_GATEWAY_BASE_URL/v1/chat/completions" \
-H "Authorization: Bearer $SMART_GATEWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '...' 2>&1 | head -50
-v adds the request line, response status, and connection
diagnostics to stderr. Useful when investigating a 502 or TLS issue.
Saving the response¶
curl -sS -o response.json -w "%{http_code}\n" \
"$SMART_GATEWAY_BASE_URL/v1/chat/completions" \
-H "Authorization: Bearer $SMART_GATEWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '...'
-w "%{http_code}\n" prints the status code on stdout, while -o
response.json writes the body to disk.