Becoming a Task Provider

Earn tokens by offering task execution services on the Autoken network. This guide walks you through registering as a provider and setting up your worker service.

Overview

Providers are services that execute tasks on behalf of Autoken users. As a provider, you:

  • Register with your Autoken account and receive a unique API key
  • Choose which tasks you want to offer from the task catalog
  • Set your own pricing for each task
  • Run a worker service that polls for and executes tasks
  • Earn tokens for each successfully completed task

Why Become a Provider?

Providers earn tokens every time a user executes one of their tasks. Set competitive prices, maintain high reliability, and build a reputation on the network.

Prerequisites

An Autoken account

Sign up if you don't have one

A server or service to run your worker

Any environment that can make HTTP requests

Access to the service you're providing

e.g., proxy APIs, translation services, etc.

Step 1: Register Your Provider

First, get a JWT token by logging in, then register your provider with the tasks you want to offer:

# Register a new provider
curl -X POST https://autoken.devrupt.io/api/v1/providers/register \
  -H "Authorization: Bearer $JWT_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "slug": "my-proxy-service",
    "description": "High-quality residential proxies",
    "tasks": [
      {
        "slug": "proxy-rent",
        "tokenCost": 20000,
        "pricing": {
          "baseCost": 10000,
          "modifiers": {
            "type": {
              "datacenter": 10000,
              "residential": 20000,
              "mobile": 50000
            }
          }
        }
      }
    ]
  }'

The response includes your provider API key:

{
  "providerId": "uuid-here",
  "slug": "my-proxy-service",
  "apiKey": "psk_abc123...",
  "message": "Save this API key securely. It cannot be retrieved again."
}

Important

Save your provider API key (psk_...) immediately! It's only shown once. You'll need it to authenticate your worker service.

Step 2: Set Your Pricing

Prices are stored in tokens. The conversion rate is:

$1.00 = 1,000,000 tokens

$0.01

10,000 tokens

$0.001

1,000 tokens

$0.0001

100 tokens

You can update pricing for existing tasks:

# Update pricing for a task
curl -X PUT https://autoken.devrupt.io/api/v1/providers/pricing/proxy-rent \
  -H "X-API-Key: psk_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "tokenCost": 20000,
    "pricing": {
      "baseCost": 10000,
      "modifiers": {
        "type": {
          "datacenter": 10000,
          "residential": 20000,
          "mobile": 50000
        }
      }
    }
  }'

Step 3: Implement Your Worker

Your worker service needs to continuously:

  1. Poll for pending tasks assigned to your provider
  2. Execute the task using your service
  3. Report the result (success or failure) back to Autoken

Polling for Tasks

# Poll for pending tasks
curl -X GET "https://autoken.devrupt.io/api/v1/execute/pending?tasks=proxy-rent&limit=10" \
  -H "X-API-Key: psk_your_api_key"

Response:

{
  "jobs": [
    {
      "executionId": "exec_abc123",
      "taskName": "proxy-rent",
      "input": {
        "type": "residential",
        "country": "US",
        "duration": 3600
      }
    }
  ]
}

Reporting Results

# Report successful execution
curl -X POST https://autoken.devrupt.io/api/v1/execute/exec_abc123/result \
  -H "X-API-Key: psk_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "success": true,
    "output": {
      "url": "socks5://user:pass@proxy.example.com:1080",
      "expiresAt": "2024-01-15T12:00:00Z",
      "megabytesUsed": 0
    }
  }'

For failures, report the error:

# Report failed execution
curl -X POST https://autoken.devrupt.io/api/v1/execute/exec_abc123/result \
  -H "X-API-Key: psk_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "success": false,
    "error": "No proxies available for requested location"
  }'

Example Worker (TypeScript)

Here's a complete example of a worker service in TypeScript:

import axios from 'axios';

const API_URL = 'https://autoken.devrupt.io/api/v1';
const API_KEY = process.env.AUTOKEN_API_KEY;
const TASKS = ['proxy-rent'];

async function pollAndExecute() {
  while (true) {
    try {
      // Poll for pending tasks
      const { data } = await axios.get(`${API_URL}/execute/pending`, {
        params: { tasks: TASKS.join(','), limit: 5 },
        headers: { 'X-API-Key': API_KEY },
      });

      for (const job of data.jobs) {
        try {
          // Execute the task (your logic here)
          const output = await executeTask(job.taskName, job.input);
          
          // Report success
          await axios.post(
            `${API_URL}/execute/${job.executionId}/result`,
            { success: true, output },
            { headers: { 'X-API-Key': API_KEY } }
          );
        } catch (error) {
          // Report failure
          await axios.post(
            `${API_URL}/execute/${job.executionId}/result`,
            { success: false, error: error.message },
            { headers: { 'X-API-Key': API_KEY } }
          );
        }
      }
    } catch (error) {
      console.error('Polling error:', error.message);
    }

    // Wait before next poll
    await new Promise(resolve => setTimeout(resolve, 1000));
  }
}

async function executeTask(taskName: string, input: any) {
  // Implement your task execution logic here
  if (taskName === 'proxy-rent') {
    return {
      url: 'socks5://user:pass@proxy.example.com:1080',
      expiresAt: new Date(Date.now() + input.duration * 1000).toISOString(),
      megabytesUsed: 0,
    };
  }
  throw new Error(`Unknown task: ${taskName}`);
}

pollAndExecute();

Sandbox Mode & Reliability

New providers start in sandbox mode. This lets you test your implementation before handling real user traffic. Autoken tracks several reliability metrics:

  • Success Rate: Percentage of tasks completed successfully
  • Execution Time: Average time to complete tasks
  • Challenge Tasks: Periodic validation tests to verify functionality
  • Reliability Score: Overall score based on all metrics

Tip: Maintain a high reliability score by responding quickly, handling failures gracefully, and passing challenge tasks consistently.

Managing Your Tasks

View and manage your tasks from the My Tasks page in your dashboard. You can:

  • See all tasks you're currently offering
  • Enable or disable specific tasks
  • Update pricing for each task
  • Monitor execution statistics

Best Practices

  1. Set competitive pricing - Compare with other providers offering the same tasks
  2. Handle failures gracefully - Always report results, even for failures
  3. Monitor execution times - Fast response times improve user experience and your rating
  4. Use stop before maintenance - Disable task acceptance before deployments
  5. Validate pricing on startup - Ensure all modifier combinations have valid prices
  6. Keep your API key secure - Never commit it to version control
  7. Pass sandbox tests first - Verify everything works before going live
  8. Monitor your dashboard - Check your reliability score regularly

Next Steps