FOUNDRY
C8 Platform
← Tasks

Deploy RapidAPI wrapper — quickest marketplace revenue

completedgeneralP0MARKETPLACE-BLITZ

Description

oneworld_trade/api/rapidapi_wrapper.py is a complete 332-line FastAPI wrapper with rate limiting and 4 pricing tiers (Free/Basic $19/Pro $99/Business $499). Deploy to Cloud Run, list on RapidAPI marketplace under "hts-classification". Needs: RapidAPI publisher account, deploy wrapper, configure rate limits, submit for review. This is the fastest path to marketplace revenue — code is done.
Assignee
Carlos
Claimed By
Cloud Lu → Claude Sonnet
Created
6h ago
Completed
5h ago

Quality

Overall
63%
Pass
FAIL
Graded By
-
Graded At
-

Cost

Input Tokens
-
Output Tokens
-
Est. USD
-

Result

{
  "cost": {
    "input_tokens": 120,
    "estimated_usd": 0.02775,
    "output_tokens": 1826
  },
  "model": "claude-sonnet-4-20250514",
  "status": "success",
  "transport": "anthropic_api",
  "latency_ms": 28361,
  "response_text": "I'll help you deploy your RapidAPI wrapper to generate marketplace revenue quickly. Let me break this down into actionable steps:\n\n## 1. First, let's review your wrapper structure\n\n```python\n# oneworld_trade/api/rapidapi_wrapper.py structure check\n\"\"\"\nExpected components:\n- FastAPI app with RapidAPI headers handling\n- 4 pricing tiers with rate limiting\n- HTS classification endpoints\n- Authentication middleware\n\"\"\"\n```\n\n## 2. Cloud Run Deployment Setup\n\nCreate deployment files:\n\n**Dockerfile:**\n```dockerfile\nFROM python:3.11-slim\n\nWORKDIR /app\n\nCOPY requirements.txt .\nRUN pip install --no-cache-dir -r requirements.txt\n\nCOPY . .\n\nEXPOSE 8080\n\nCMD [\"uvicorn\", \"oneworld_trade.api.rapidapi_wrapper:app\", \"--host\", \"0.0.0.0\", \"--port\", \"8080\"]\n```\n\n**requirements.txt:**\n```txt\nfastapi==0.104.1\nuvicorn[standard]==0.24.0\nslowapi==0.1.9\nredis==5.0.1\nrequests==2.31.0\npydantic==2.5.0\n```\n\n**cloudbuild.yaml:**\n```yaml\nsteps:\n- name: 'gcr.io/cloud-builders/docker'\n  args: ['build', '-t', 'gcr.io/$PROJECT_ID/hts-classification-api', '.']\n- name: 'gcr.io/cloud-builders/docker'\n  args: ['push', 'gcr.io/$PROJECT_ID/hts-classification-api']\n- name: 'gcr.io/google.com/cloudsdktool/cloud-sdk'\n  entrypoint: gcloud\n  args:\n  - 'run'\n  - 'deploy'\n  - 'hts-classification-api'\n  - '--image=gcr.io/$PROJECT_ID/hts-classification-api'\n  - '--region=us-central1'\n  - '--platform=managed'\n  - '--allow-unauthenticated'\n  - '--memory=512Mi'\n  - '--cpu=1'\n  - '--min-instances=0'\n  - '--max-instances=100'\n```\n\n## 3. Deploy to Cloud Run\n\n```bash\n# Set up Google Cloud\ngcloud config set project YOUR_PROJECT_ID\ngcloud services enable run.googleapis.com\ngcloud services enable cloudbuild.googleapis.com\n\n# Deploy\ngcloud builds submit --config cloudbuild.yaml\n\n# Get the service URL\ngcloud run services describe hts-classification-api --region=us-central1 --format='value(status.url)'\n```\n\n## 4. RapidAPI Configuration\n\n**API Configuration JSON for RapidAPI:**\n```json\n{\n  \"name\": \"HTS Classification API\",\n  \"category\": \"Business\",\n  \"description\": \"Professional HTS/HS code classification for international trade\",\n  \"baseUrl\": \"YOUR_CLOUD_RUN_URL\",\n  \"pricing\": {\n    \"Free\": {\n      \"price\": 0,\n      \"requests\": 100,\n      \"period\": \"month\"\n    },\n    \"Basic\": {\n      \"price\": 19,\n      \"requests\": 5000,\n      \"period\": \"month\"\n    },\n    \"Pro\": {\n      \"price\": 99,\n      \"requests\": 50000,\n      \"period\": \"month\"\n    },\n    \"Business\": {\n      \"price\": 499,\n      \"requests\": 500000,\n      \"period\": \"month\"\n    }\n  }\n}\n```\n\n## 5. RapidAPI Publisher Setup Steps\n\n1. **Create Publisher Account:**\n   - Go to rapidapi.com/developer/dashboard\n   - Complete publisher verification\n   - Add payment details\n\n2. **Add Your API:**\n   ```\n   Dashboard → My APIs → Add New API\n   Name: \"HTS Classification API\"\n   Category: Business → Trade & Commerce\n   Base URL: [Your Cloud Run URL]\n   ```\n\n3. **Configure Endpoints:**\n   - Import OpenAPI spec from your FastAPI `/docs` endpoint\n   - Set up rate limiting per tier\n   - Configure authentication headers\n\n4. **Pricing Setup:**\n   ```\n   Free: 100 requests/month - $0\n   Basic: 5,000 requests/month - $19\n   Pro: 50,000 requests/month - $99\n   Business: 500,000 requests/month - $499\n   ```\n\n## 6. Quick Deployment Script\n\n```bash\n#!/bin/bash\n# deploy-rapidapi.sh\n\nset -e\n\nPROJECT_ID=\"your-project-id\"\nSERVICE_NAME=\"hts-classification-api\"\nREGION=\"us-central1\"\n\necho \"🚀 Deploying HTS Classification API to Cloud Run...\"\n\n# Build and deploy\ngcloud builds submit --config cloudbuild.yaml --project=$PROJECT_ID\n\n# Get service URL\nSERVICE_URL=$(gcloud run services describe $SERVICE_NAME --region=$REGION --project=$PROJECT_ID --format='value(status.url)')\n\necho \"✅ Deployed to: $SERVICE_URL\"\necho \"📝 Next steps:\"\necho \"1. Test endpoints: $SERVICE_URL/docs\"\necho \"2. Add to RapidAPI: rapidapi.com/developer/dashboard\"\necho \"3. Configure rate limits and pricing\"\necho \"4. Submit for marketplace review\"\n```\n\n## 7. Testing Before Submission\n\n```python\n# test_rapidapi_wrapper.py\nimport requests\n\nBASE_URL = \"YOUR_CLOUD_RUN_URL\"\n\ndef test_endpoints():\n    # Test health check\n    response = requests.get(f\"{BASE_URL}/health\")\n    assert response.status_code == 200\n    \n    # Test classification endpoint\n    headers = {\n        \"X-RapidAPI-Key\": \"test-key\",\n        \"X-RapidAPI-Host\": \"hts-classification.rapidapi.com\"\n    }\n    \n    response = requests.post(\n        f\"{BASE_URL}/classify\",\n        json={\"product_description\": \"cotton t-shirt\"},\n        headers=headers\n    )\n    \n    print(f\"Classification test: {response.status_code}\")\n    print(response.json())\n\nif __name__ == \"__main__\":\n    test_endpoints()\n```\n\n## 8. Marketplace Submission Checklist\n\n- [ ] API deployed and responding\n- [ ] All endpoints tested with RapidAPI headers\n- [ ] Rate limiting working per tier\n- [ ] Documentation complete in `/docs`\n- [ ] Error handling implemented\n- [ ] Pricing tiers configured\n- [ ] Publisher account verified\n- [ ] API submitted for review\n\n## 9. Revenue Optimization Tips\n\n1. **Competitive Pricing Analysis:**\n   - Research similar APIs on RapidAPI\n   - Consider starting with lower prices to gain traction\n\n2. **Marketing Copy:**\n   ```\n   \"Professional HTS/HS Code Classification API\n   ✅ 99%+ accuracy rate\n   ✅ Instant results\n   ✅ Trade compliance ready\n   ✅ Global customs codes\"\n   ```\n\n3. **Quick Revenue Triggers:**\n   - Free tier to attract users\n   - Clear upgrade path\n   - Business tier for enterprise clients\n\n## Next Steps:\n\n1. Run the deployment script\n2. Test all endpoints thoroughly\n3. Submit to RapidAPI marketplace\n4. Monitor for approval (typically 2-5 business days)\n\nWould you like me to help you customize any of these deployment files or walk through the RapidAPI submission process in more detail?"
}

Audit Trail (1)

6h agotask_createdAG Lu
Task ID: 4c9c6cf1-302f-4088-8cdc-e05712440ce5