561 Group Market

Attention Allocation

The exactly-optimal (or, past the exhaustive-search bound, provably near-optimal) subset of budget-and-benefit candidates a fixed budget funds: a bounded-agent resource allocator.

Price
$0.02 USDC per request
Network
Base mainnet, eip155:8453, settled in USDC through the Coinbase CDP facilitator
Method and URL
POST https://market.561.group/v1/attention/allocate
Response type
application/json
Seller
Causeway Services (561 Group)

Input contract

Input that fails this contract is refused with a 4xx status before any payment is requested.

{
  "maxBytes": 102400,
  "bodySchema": {
    "type": "object",
    "properties": {
      "budget": {
        "type": "integer",
        "minimum": 0
      },
      "obstructions": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "id": {
              "type": "string"
            },
            "cost": {
              "type": "integer",
              "minimum": 0
            },
            "benefit": {
              "type": "integer",
              "minimum": 0
            }
          },
          "required": [
            "id",
            "cost",
            "benefit"
          ]
        }
      }
    },
    "required": [
      "budget",
      "obstructions"
    ]
  }
}

Example request

{
  "method": "POST",
  "url": "https://market.561.group/v1/attention/allocate",
  "headers": {
    "accept": "application/json",
    "content-type": "application/json"
  },
  "body": {
    "budget": 10,
    "obstructions": [
      {
        "id": "a",
        "cost": 4,
        "benefit": 9
      },
      {
        "id": "b",
        "cost": 6,
        "benefit": 10
      },
      {
        "id": "c",
        "cost": 3,
        "benefit": 4
      }
    ]
  }
}

Output

{
  "schema": {
    "type": "object",
    "properties": {
      "type": {
        "type": "string"
      },
      "budget": {
        "type": "integer"
      },
      "readNext": {
        "type": "array",
        "items": {
          "type": "string"
        }
      },
      "selected": {
        "type": "array"
      },
      "cost": {
        "type": "integer"
      },
      "benefit": {
        "type": "integer"
      },
      "residual": {
        "type": "integer"
      },
      "exact": {
        "type": "boolean"
      },
      "choiceBits": {
        "type": "number"
      }
    }
  },
  "example": {
    "type": "AttentionAllocation",
    "budget": 10,
    "readNext": [
      "a",
      "b"
    ],
    "selected": [
      {
        "id": "a",
        "cost": 4,
        "benefit": 9
      },
      {
        "id": "b",
        "cost": 6,
        "benefit": 10
      }
    ],
    "cost": 10,
    "benefit": 19,
    "residual": 4,
    "exact": true,
    "choiceBits": 0
  }
}

How to buy with x402

  1. Send the request without payment. The server answers 402 Payment Required with a base64 JSON PAYMENT-REQUIRED header holding the amount, asset, network and payee.
  2. Have your wallet sign an EIP-3009 transferWithAuthorization for exactly those terms (an x402 client library does this for you).
  3. Repeat the identical request with the signed payload in the PAYMENT-SIGNATURE header.
  4. The server verifies, runs the operation, settles, and returns 200 with the result and a PAYMENT-RESPONSE header carrying the settlement receipt.

Read the price without paying

curl --include --request POST --header 'accept: application/json' --header 'content-type: application/json' --data-raw '{"budget":10,"obstructions":[{"id":"a","cost":4,"benefit":9},{"id":"b","cost":6,"benefit":10},{"id":"c","cost":3,"benefit":4}]}' --url 'https://market.561.group/v1/attention/allocate'

This request authorizes nothing; it returns the live payment terms. Read the full explanation of x402.

Machine-readable