{"uid":"cap_deVm0nLS9FmWrcb5BsVLR","slug":"onhub-code-execution-python-based-computational-q-a-19a62f4a","name":"OnHub Code Execution — Python-Based Computational Q&A","description":"OnHub is the pay-per-request API layer for agents. Text inference paid per request with USDC on Base.","url":"https://x402.onhub.ai/v1/code?utm_source=zero.xyz","method":"POST","headers":{},"bodySchema":{"type":"object","properties":{"query":{"type":"string","maxLength":2000,"minLength":3,"description":"A computational question to answer by writing and running Python code, e.g. a calculation, data-processing, or verification task."}}},"responseSchema":{"type":"json","example":{"query":"What is the sum of the first 50 prime numbers?","steps":[{"type":"result","content":"5117\n"}],"answer":"The sum of the first 50 prime numbers is 5,117.","object":"code.result"}},"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.015","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"probe","requiresHandshake":false,"reviewCount":0,"rating":{"score":"0.00","successRate":"0.00","reviews":0,"stars":null,"state":"unrated"},"availabilityStatus":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.015/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.015","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.015","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_C1nt9EC63d6DH09RQhIT5","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.015","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Answers computational questions by writing and executing Python code, returning step-by-step reasoning and a final answer, paid per request in USDC on Base.","exampleAgentPrompt":"Can you compute the sum of the squares of all integers from 1 to 100 by writing and running Python code?","exampleUseCases":[{"title":"Prime number sum verification","prompt":"What is the sum of the first 50 prime numbers? Write and run the Python code to calculate it."},{"title":"Fibonacci sequence computation","prompt":"Calculate the 200th Fibonacci number for me by running Python code — I need the exact value."},{"title":"Statistical data aggregation","prompt":"I have a list of numbers: 14, 27, 3, 98, 56, 42, 71. Can you compute the mean, median, and standard deviation by writing and executing Python code?"}],"resultDescription":"Returns a JSON object with the original query, an array of execution steps (each with a type and content field showing intermediate outputs), and a final human-readable answer string. The object type is 'code.result'.","failureModes":["Query too short (below 3 characters) returns validation error","Query exceeds 2000 character limit returns validation error","Payment not provided or insufficient USDC returns 402 Payment Required","Computationally unbounded or infinite-loop queries may time out","Queries requiring external network access inside the sandbox may fail","Ambiguous or non-computational queries may produce incorrect or empty steps"],"whenToPreferThis":"Choose this endpoint when you need to verify or compute a precise numerical, algorithmic, or data-processing result using executed Python code rather than LLM estimation. It is ideal when accuracy matters (e.g. large sums, sorting, statistics) and a hallucinated answer is unacceptable. Prefer it over a general text inference endpoint when the task is inherently computational and benefits from code execution guarantees.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-10-11T06:45:41.349Z","isFirstParty":false,"canonicalSlug":"onhub-code-execution-python-based-computational-q-a-19a62f4a"}