Skip to main content

Agent Quickstart

Get your headless agent calling ASG tools. Time to first call: ~2 minutes.
Start free: Use get_status and echo to validate your setup before making paid calls. These tools are always free — no payment required.

Prerequisites

Step 1: Create API Key

  1. Open Console
  2. Connect wallet → API KeysCreate Key
  3. Copy key (starts with sk-agent-...)
export ASG_API_KEY="sk-agent-YOUR_KEY_HERE"

Step 2: Verify Setup (Free)

Test connectivity and auth with the free get_status tool — no payment needed:
curl -X POST https://agent.asgcompute.com/v1/mcp/tools/call \
  -H "Authorization: Bearer $ASG_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "tool": "get_status",
    "params": {}
  }'
Expected response (200):
{
  "ok": true,
  "result": {
    "version": "v5.2.3",
    "status": "healthy",
    "balance_usdc": "11.11"
  }
}
✅ If you see "ok": true, your API key works. Move to the next step.

Step 3: Echo Test (Free)

Validate payload format with the free echo tool — no payment needed:
curl -X POST https://agent.asgcompute.com/v1/mcp/tools/call \
  -H "Authorization: Bearer $ASG_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "tool": "echo",
    "params": {
      "message": "hello from my agent"
    }
  }'
Expected response (200):
{
  "ok": true,
  "result": {
    "echo": "hello from my agent"
  }
}
✅ If your message is echoed back, your request format is correct.

Step 4: Discover Available Tools

List all tools and their billing status:
curl -s https://agent.asgcompute.com/mcp/capabilities \
  | jq '.tools[] | {name, status, billable}'

Step 5: Make a Paid Call

Call a billable tool. If you have pre-funded balance, this returns 200 with the result immediately. If no balance, you get 402 with a quote.
curl -X POST https://agent.asgcompute.com/v1/mcp/tools/call \
  -H "Authorization: Bearer $ASG_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "tool": "inference_chat",
    "params": {
      "model": "openai/gpt-4o-mini",
      "messages": [{"role":"user","content":"Hello!"}]
    }
  }'
If 200 — Success! The result is in data.result.content. If 402 — Payment Required:
{
  "code": "PAYMENT_REQUIRED",
  "quote": {
    "quote_id": "abc123",
    "amount_usdc_microusd": 10000
  },
  "payment_instructions": {
    "network": "solana-mainnet",
    "pay_to": "<treasury_ata>",
    "usdc_mint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"
  },
  "step_id": "step_xyz"
}

Step 6: Pay and Retry

Send USDC on-chain, then retry with proof:
curl -X POST https://agent.asgcompute.com/v1/mcp/tools/call \
  -H "Authorization: Bearer $ASG_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "tool": "inference_chat",
    "params": {
      "model": "openai/gpt-4o-mini",
      "messages": [{"role":"user","content":"Hello!"}]
    },
    "idempotency_key": "550e8400-e29b-41d4-a716-446655440000",
    "payment_proof": {
      "tx_ref": "<solana_tx_signature>",
      "amount_usdc": "0.010000",
      "memo": "<step_id>:<quote_id>:1",
      "quote_id": "<quote_id>",
      "step_id": "<step_id>",
      "network": "solana-mainnet"
    }
  }'
Faster path: Deposit USDC via Console → Balance first. Then paid tool calls deduct from your balance automatically — no per-call on-chain transactions needed.

Available Tools

ToolStatusBillableNotes
get_status✅ ActiveFreeSystem status + balance
echo✅ ActiveFreeValidate auth + payload
inference_chat✅ ActivePaidGPT-4o, Claude, Gemini
optify_vram_estimate✅ ActivePaidGPU memory estimation
sandbox_execute✅ ActivePaidPython/JS code execution
sandbox_cancel✅ ActiveFreeCancel running sandbox
gpu_provision🔜 Coming SoonGPU provisioning
See Tool Availability for the full catalog.

MCP Integration

For agents using the Model Context Protocol, connect directly:
{
  "mcpServers": {
    "asg": {
      "url": "https://agent.asgcompute.com/mcp",
      "transport": "streamable-http",
      "headers": {
        "Authorization": "Bearer sk-agent-YOUR_KEY"
      }
    }
  }
}
Works with Claude Desktop, Cursor, Windsurf, and any MCP-compatible client.

Error Codes

StatusCodeMeaning
200Success
401UNAUTHORIZEDInvalid or missing API key
402PAYMENT_REQUIREDDeposit or pay to continue
403FORBIDDENScope not authorized
429RATE_LIMITEDToo many requests
500Server error (retry with idempotency key)

What’s Next?

SDK Examples

TypeScript and Python code examples

Payment Flow

Complete payment lifecycle guide

Pricing

Service pricing details

Architecture

How ASG works under the hood