response = httpx.get(f"{BASE_URL}/v1/openclaw/lookup/{app_number}")
if response.status_code != 200:
error = response.json()
code = error.get("error_code")
suggestion = error.get("agent_suggestion", "")
if code == "app_not_found":
# Try normalizing the number
normalized = app_number.replace("/", "").replace(",", "")
response = httpx.get(f"{BASE_URL}/v1/openclaw/lookup/{normalized}")
elif code == "missing_api_key":
# Prompt user for API key
return f"I need an API key to proceed. {suggestion}"
elif code == "revoked_api_key":
return f"Your API key has been revoked. {suggestion}"