{"uid":"cap_fpc22Gj2I5kRFw-SusFYG","slug":"x402-gateway-rust-code-runner-cargo-run-da8b0246","name":"x402-gateway Rust Code Runner (cargo_run)","description":"Rust Code Runner: Run a Rust file in a sandbox. One call buys up to an hour: submit code (64 KB) and optional stdin (16 KB), get a job_id, then poll the free result endpoint for stdout/stderr (64 KB each), exit code, timings. Results kept 7 days; extend with same code and job_id. Network access outside the major clouds. Price varies with upstream compute ($0.002–$0.10), shown before you pay. Pay per call in USDC on Base via x402 — POST https://x402.freeq.one/tools/cargo_run.","url":"https://x402.freeq.one/tools/cargo_run?utm_source=zero.xyz","method":"POST","headers":{},"bodySchema":{"type":"object","properties":{"job_id":{"type":"string","example":"job_abc123","description":"Extend a previous job with the same zip URL for one more hour"},"zip_url":{"type":"string","description":"Public URL of the zip to run; entrypoint.sh at the zip root runs (a single top-level folder is also accepted)"}}},"responseSchema":{"type":"json","example":{"content":[],"isError":false,"structuredContent":{}}},"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.002","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.002/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.002","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.002","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_f_FEJakJWlnXL07cOC3b6","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.002","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Executes a Rust source file in a sandboxed environment, returning stdout, stderr, exit code, and timings — paid per call in USDC on Base via x402.","exampleAgentPrompt":"Can you run this Rust program for me using the 2021 edition and pass 'Alice\n' as stdin? Here's the code: fn main() { let mut s = String::new(); std::io::stdin().read_line(&mut s).unwrap(); println!(\"Hello, {}\", s.trim()); }","exampleUseCases":[{"title":"Quick Rust snippet testing","prompt":"Run this Rust snippet for me and show me the output — fn main() { let v: Vec<i32> = (1..=10).filter(|x| x % 2 == 0).collect(); println!(\"{:?}\", v); } — use the 2021 edition in debug mode."},{"title":"Rust algorithm benchmarking","prompt":"Compile and run this sorting algorithm in Rust release mode and tell me how long it takes: fn main() { let mut v: Vec<i32> = (0..100000).rev().collect(); v.sort(); println!(\"done\"); }"},{"title":"Interactive Rust program with stdin","prompt":"Execute this Rust program using the 2021 edition and feed it 'hello world\n' as stdin: fn main() { let mut s = String::new(); std::io::stdin().read_line(&mut s).unwrap(); println!(\"You said: {}\", s.trim()); }"}],"resultDescription":"The initial POST returns a job_id. Polling the free result endpoint with that job_id yields: stdout (up to 64 KB), stderr (up to 64 KB), an integer exit code, and compilation/execution timing data. Results are retained for 7 days and can be extended by resubmitting with the same code and job_id.","failureModes":["Code exceeds 64 KB limit — request rejected","Stdin exceeds 16 KB limit — request rejected","Compilation error — job completes with non-zero exit code and compiler error in stderr","Execution timeout (up to 1 hour max) — job terminated","Payment failure via x402 — call not executed","Invalid Rust edition specified — may default or error","Network access to major cloud providers blocked from sandbox — runtime network calls may fail","Result expired after 7 days — polling returns nothing"],"whenToPreferThis":"Choose this endpoint when you need to compile and run arbitrary Rust code in a sandboxed remote environment without setting up local toolchains, CI, or cloud VMs. It is ideal for AI agents that generate or validate Rust code snippets, need execution results as part of a pipeline, and want pay-per-use billing (USDC on Base) with no account or API key setup. Prefer it over general-purpose code execution services when the target language is specifically Rust and you need cargo_run semantics including edition and release-mode control.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-11-15T12:00:45.557Z","isFirstParty":false,"canonicalSlug":"x402-gateway-rust-code-runner-cargo-run-da8b0246"}