{"openapi":"3.1.0","info":{"title":"SocioLogic RNG","version":"1.0.0","description":"Cryptographically secure random number generation API with verifiable entropy. Pay per call with USDC on Base via x402.","x-guidance":"Use this API when you need unbiased random numbers, UUIDs, dice rolls, coin flips, array shuffling, or weighted random selection. All endpoints return raw entropy for cryptographic verification. Payment is automatic via x402  - send a request, receive a 402 with payment details, pay USDC on Base, retry with the X-PAYMENT header.","contact":{"name":"SocioLogic AI","email":"team@sociologic.ai","url":"https://www.sociologic.ai"}},"x-service-info":{"categories":["randomness","cryptography","utilities","rng","entropy"],"docs":{"homepage":"https://www.sociologic.ai","apiReference":"https://rng.sociologic.ai/openapi.json","llms":"https://rng.sociologic.ai/llms.txt"}},"x-discovery":{"ownershipProofs":["0xdbf107efdf8cf1ca7f22975372e167fd7fbd6f9aee83be57ab1377ed49727f5207737eff7cec46495c06c566a66b9bbd4b37c6b5f9ad550d75184eb7a6ade9621b"]},"servers":[{"url":"https://rng.sociologic.ai"}],"paths":{"/random":{"get":{"operationId":"getRandomFloat","tags":["randomness"],"summary":"Random float between 0 and 1","description":"Generate cryptographically secure random float(s) in [0, 1) using rejection sampling. Use count for multiple values  - price scales linearly ($0.01 per value).","x-payment-info":{"price":{"mode":"dynamic","currency":"USD","min":"0.010000","max":"1.000000"},"protocols":[{"x402":{}},{"mpp":{"method":"tempo","intent":"charge","currency":"0x20C000000000000000000000b9537d11c60E8b50"}}],"offers":[{"amount":null,"currency":"usd","description":"$0.01 per value, scales with count","intent":"charge","method":"tempo"}]},"parameters":[{"name":"count","in":"query","schema":{"type":"integer","default":1,"minimum":1,"maximum":100},"description":"Number of values (default 1, max 100). Price: $0.01 per value."}],"responses":{"200":{"description":"Random float(s) with entropy proof","content":{"application/json":{"schema":{"oneOf":[{"type":"object","description":"Single value (count=1)","properties":{"value":{"type":"number","description":"Random float in [0, 1)"},"type":{"type":"string","enum":["float"]},"range":{"type":"array","items":{"type":"number"}},"entropy":{"type":"object","properties":{"raw":{"type":"integer"},"hex":{"type":"string"}}}}},{"type":"object","description":"Multiple values (count>1)","properties":{"values":{"type":"array","items":{"type":"number"},"description":"Random floats in [0, 1)"},"count":{"type":"integer"},"type":{"type":"string","enum":["float"]},"range":{"type":"array","items":{"type":"number"}},"entropy":{"type":"object","properties":{"raw":{"type":"array","items":{"type":"integer"}},"hex":{"type":"array","items":{"type":"string"}}}}}}]}}}},"402":{"description":"Payment Required"}}}},"/random/int":{"get":{"operationId":"getRandomInt","tags":["randomness"],"summary":"Random integer in range","description":"Generate a cryptographically secure random integer between min and max (inclusive) using rejection sampling to eliminate modulo bias.","x-payment-info":{"price":{"mode":"fixed","currency":"USD","amount":"0.010000"},"protocols":[{"x402":{}},{"mpp":{"method":"tempo","intent":"charge","currency":"0x20C000000000000000000000b9537d11c60E8b50"}}],"offers":[{"amount":"10000","currency":"usd","description":"Random integer in range","intent":"charge","method":"tempo"}]},"parameters":[{"name":"min","in":"query","schema":{"type":"integer","default":0},"description":"Minimum value (inclusive)"},{"name":"max","in":"query","schema":{"type":"integer","default":100},"description":"Maximum value (inclusive)"}],"responses":{"200":{"description":"Random integer with entropy proof","content":{"application/json":{"schema":{"type":"object","properties":{"value":{"type":"integer","description":"Random integer in [min, max]"},"type":{"type":"string","enum":["integer"]},"range":{"type":"array","items":{"type":"integer"}},"entropy":{"type":"object","properties":{"raw":{"type":"integer"},"hex":{"type":"string"}}}}}}}},"402":{"description":"Payment Required"}}}},"/uuid":{"get":{"operationId":"getUuid","tags":["randomness","uuid"],"summary":"Generate UUID v4","description":"Generate cryptographically secure UUID v4(s) with raw entropy bytes. Use count for multiple UUIDs  - price scales linearly ($0.01 per UUID).","x-payment-info":{"price":{"mode":"dynamic","currency":"USD","min":"0.010000","max":"1.000000"},"protocols":[{"x402":{}},{"mpp":{"method":"tempo","intent":"charge","currency":"0x20C000000000000000000000b9537d11c60E8b50"}}],"offers":[{"amount":null,"currency":"usd","description":"$0.01 per value, scales with count","intent":"charge","method":"tempo"}]},"parameters":[{"name":"count","in":"query","schema":{"type":"integer","default":1,"minimum":1,"maximum":100},"description":"Number of UUIDs (default 1, max 100). Price: $0.01 per UUID."}],"responses":{"200":{"description":"UUID v4(s) with entropy proof","content":{"application/json":{"schema":{"oneOf":[{"type":"object","description":"Single UUID (count=1)","properties":{"value":{"type":"string","format":"uuid"},"type":{"type":"string","enum":["uuid"]},"version":{"type":"integer","enum":[4]},"entropy":{"type":"object","properties":{"raw":{"type":"array","items":{"type":"integer"}},"hex":{"type":"array","items":{"type":"string"}}}}}},{"type":"object","description":"Multiple UUIDs (count>1)","properties":{"values":{"type":"array","items":{"type":"string","format":"uuid"}},"count":{"type":"integer"},"type":{"type":"string","enum":["uuid"]},"version":{"type":"integer","enum":[4]},"entropy":{"type":"object","properties":{"raw":{"type":"array","items":{"type":"array","items":{"type":"integer"}}},"hex":{"type":"array","items":{"type":"array","items":{"type":"string"}}}}}}}]}}}},"402":{"description":"Payment Required"}}}},"/dice":{"get":{"operationId":"rollDice","tags":["randomness","games"],"summary":"Roll a die","description":"Roll a die with configurable sides (2-1000). Uses rejection sampling for unbiased results.","x-payment-info":{"price":{"mode":"fixed","currency":"USD","amount":"0.020000"},"protocols":[{"x402":{}},{"mpp":{"method":"tempo","intent":"charge","currency":"0x20C000000000000000000000b9537d11c60E8b50"}}],"offers":[{"amount":"20000","currency":"usd","description":"$0.02 per call","intent":"charge","method":"tempo"}]},"parameters":[{"name":"sides","in":"query","schema":{"type":"integer","default":6,"minimum":2,"maximum":1000},"description":"Number of sides"}],"responses":{"200":{"description":"Die roll with entropy proof","content":{"application/json":{"schema":{"type":"object","properties":{"roll":{"type":"integer","description":"Result (1 to sides)"},"sides":{"type":"integer"},"entropy":{"type":"object","properties":{"raw":{"type":"integer"},"hex":{"type":"string"}}}}}}}},"402":{"description":"Payment Required"}}}},"/coin":{"get":{"operationId":"flipCoin","tags":["randomness","games"],"summary":"Flip a coin","description":"Cryptographically fair coin flip returning heads or tails. Use count for multiple flips in one call  - price scales linearly ($0.02 per flip).","x-payment-info":{"price":{"mode":"dynamic","currency":"USD","min":"0.020000","max":"2.000000"},"protocols":[{"x402":{}},{"mpp":{"method":"tempo","intent":"charge","currency":"0x20C000000000000000000000b9537d11c60E8b50"}}],"offers":[{"amount":null,"currency":"usd","description":"$0.02 per flip, scales with count","intent":"charge","method":"tempo"}]},"parameters":[{"name":"count","in":"query","schema":{"type":"integer","default":1,"minimum":1,"maximum":100},"description":"Number of flips (default 1, max 100). Price: $0.02 per flip."}],"responses":{"200":{"description":"Coin flip(s) with entropy proof","content":{"application/json":{"schema":{"oneOf":[{"type":"object","description":"Single flip (count=1)","properties":{"flip":{"type":"string","enum":["heads","tails"]},"entropy":{"type":"object","properties":{"raw":{"type":"integer"},"hex":{"type":"string"}}}}},{"type":"object","description":"Multiple flips (count>1)","properties":{"flips":{"type":"array","items":{"type":"string","enum":["heads","tails"]}},"count":{"type":"integer"},"entropy":{"type":"object","properties":{"raw":{"type":"array","items":{"type":"integer"}},"hex":{"type":"array","items":{"type":"string"}}}}}}]}}}},"402":{"description":"Payment Required"}}}},"/shuffle":{"post":{"operationId":"shuffleArray","tags":["randomness","utilities"],"summary":"Shuffle an array","description":"Shuffle an array using the Fisher-Yates algorithm with cryptographic randomness. Max 1000 items, 100KB payload.","x-payment-info":{"price":{"mode":"fixed","currency":"USD","amount":"0.020000"},"protocols":[{"x402":{}},{"mpp":{"method":"tempo","intent":"charge","currency":"0x20C000000000000000000000b9537d11c60E8b50"}}],"offers":[{"amount":"20000","currency":"usd","description":"$0.02 per call","intent":"charge","method":"tempo"}]},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"array","items":{},"maxItems":1000,"description":"Array of items to shuffle"},"example":["a","b","c","d","e"]}}},"responses":{"200":{"description":"Shuffled array with entropy proof","content":{"application/json":{"schema":{"type":"object","properties":{"shuffled":{"type":"array","items":{}},"count":{"type":"integer"},"entropy":{"type":"object","properties":{"raw":{"type":"array","items":{"type":"integer"}},"hex":{"type":"array","items":{"type":"string"}}}}}}}}},"402":{"description":"Payment Required"}}}},"/weighted":{"post":{"operationId":"weightedSelect","tags":["randomness","utilities"],"summary":"Weighted random selection","description":"Select a random item from weighted options. Weights can be any positive numbers. Max 1000 items.","x-payment-info":{"price":{"mode":"fixed","currency":"USD","amount":"0.020000"},"protocols":[{"x402":{}},{"mpp":{"method":"tempo","intent":"charge","currency":"0x20C000000000000000000000b9537d11c60E8b50"}}],"offers":[{"amount":"20000","currency":"usd","description":"$0.02 per call","intent":"charge","method":"tempo"}]},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{},"description":"Items to choose from"},"weights":{"type":"array","items":{"type":"number"},"description":"Corresponding weights (positive)"}},"required":["items","weights"]},"example":{"items":["common","uncommon","rare","legendary"],"weights":[0.7,0.2,0.08,0.02]}}}},"responses":{"200":{"description":"Selected item with probability and entropy proof","content":{"application/json":{"schema":{"type":"object","properties":{"selected":{"description":"The selected item"},"selectedIndex":{"type":"integer"},"probability":{"type":"number"},"entropy":{"type":"object","properties":{"raw":{"type":"integer"},"hex":{"type":"string"}}}}}}}},"402":{"description":"Payment Required"}}}}}}