# null Source: https://docs.asgcompute.com/DOCS_GOVERNANCE # Documentation Governance > **Owner:** CTO / Engineering Lead\ > **Last Updated:** 2026-02-01 ## Ownership | Path | Owner | Reviewers | | ------------ | -------------- | --------- | | `openapi/*` | @security @cto | Required | | `security/*` | @security | Required | | `billing/*` | @cto @finance | Required | | `*` | @docs-team | Optional | See [CODEOWNERS](.github/CODEOWNERS) for enforcement. *** ## Weekly Improvement Routine **Cadence:** Every week, 20 minutes 1. **5 min** — Review analytics: top searches + zero-result queries 2. **10 min** — Pick 3 quick fixes: * Add FAQ block * Add code example * Add "next steps" link 3. **5 min** — Create PR, run CI, merge **PR naming:** `docs: weekly improvements (YYYY-MM-DD)` *** ## OpenAPI Updates Single source of truth: [`openapi/public.openapi.yaml`](openapi/public.openapi.yaml) **Update process:** 1. Edit OpenAPI spec 2. Run `npm run validate:openapi` 3. Update changelog: `guide/changelog.mdx` 4. PR with prefix: `api: ` *** ## Error Code Updates All public error codes in [`resources/errors.mdx`](resources/errors.mdx). **When adding new errors:** 1. Add to gateway error handler 2. Add to docs with description + resolution 3. Ensure code examples show error handling *** ## Incident Response See [SECURITY.md](SECURITY.md) for vulnerability disclosure. **Docs incident process:** 1. Identify leaked content in \[#docs-alerts] 2. Immediate: revert PR or emergency commit 3. Post-incident: update banlist `.leak-banlist.txt` *** ## Partner Portal Access Partner docs require NDA. Access managed via: * **MVP:** Password protection per partner * **Target:** SSO via IdP with `partners` group Audit: All access logged at CDN level. # null Source: https://docs.asgcompute.com/RELEASE_CHECKLIST # Docs Release Checklist Use this checklist before merging any documentation changes to `main`. ## Pre-Merge Checklist ### Content Quality * [ ] Spelling and grammar checked * [ ] Code examples tested and working * [ ] Links validated (internal and external) * [ ] Screenshots up-to-date (if applicable) ### API Changes * [ ] OpenAPI spec (`openapi/public.openapi.yaml`) updated if API changed * [ ] Error codes documented in `/errors` section * [ ] Breaking changes clearly marked with warnings ### Security & Compliance * [ ] White-label scan passed (no vendor leaks) * [ ] Secret scan passed (no keys, tokens, internal URLs) * [ ] No internal architecture details exposed * [ ] No internal URLs or IP addresses ### Navigation & Discovery * [ ] New pages added to `mint.json` navigation * [ ] Page has appropriate frontmatter (title, description) * [ ] Canonical URLs correct ### Changelog * [ ] `CHANGELOG.md` updated for user-facing changes * [ ] Version bump if significant changes ## Post-Merge Verification * [ ] Mintlify build succeeded * [ ] Pages render correctly on production * [ ] No 404s on new/moved pages * [ ] Search index includes new content (\~5 min delay) *** ## Quick Commands ```bash theme={null} # Run all checks locally npm run lint && npm run check:links && npm run check:leaks # Preview locally npm run dev # Validate OpenAPI npm run lint:openapi ``` *** ## Escalation If a security issue is found in production docs: 1. **Immediately** remove sensitive content via direct push (bypass PR) 2. Notify security team in #security-incidents 3. Create post-mortem issue # Error Codes Source: https://docs.asgcompute.com/api/errors ASG error code reference # Error Codes Complete reference for ASG Agent Cloud error codes. ## HTTP Status Codes | Code | Meaning | | :------ | :--------------- | | **200** | Success | | **400** | Bad Request | | **401** | Unauthorized | | **402** | Payment Required | | **404** | Not Found | | **429** | Rate Limited | | **500** | Internal Error | ## ASG Error Codes ### Payment Errors | Code | Message | Resolution | | :--------------------- | :------------------ | :-------------------------- | | `PAYMENT_REQUIRED` | No payment provided | Include payment signature | | `QUOTE_EXPIRED` | Quote has expired | Request new quote | | `PAYMENT_INSUFFICIENT` | Amount below quote | Pay full quoted amount | | `PAYMENT_INVALID` | Invalid signature | Check transaction signature | | `WALLET_MISMATCH` | Wrong sender wallet | Pay from authorized wallet | ### Budget Errors | Code | Message | Resolution | | :---------------- | :----------------------- | :------------------------------- | | `BUDGET_EXCEEDED` | Run/step budget exceeded | Increase budget or start new run | | `QUOTA_EXCEEDED` | Account quota exceeded | Contact support | ### Execution Errors | Code | Message | Resolution | | :------------------ | :-------------------- | :------------------------------ | | `TOOL_NOT_FOUND` | Unknown tool name | Check `tools/list` | | `INVALID_ARGUMENTS` | Bad tool arguments | Check tool schema | | `EXECUTION_TIMEOUT` | Execution timed out | Reduce workload or increase TTL | | `EXECUTION_FAILED` | Tool execution failed | Check logs, retry | ### Resource Errors | Code | Message | Resolution | | :---------------- | :---------------- | :---------------- | | `GPU_UNAVAILABLE` | No GPUs available | Wait and retry | | `LEASE_EXPIRED` | GPU lease expired | Provision new pod | | `LEASE_NOT_FOUND` | Unknown lease ID | Check lease ID | ### Rate Limiting | Code | Message | Resolution | | :----------------- | :------------------ | :------------------ | | `RATE_LIMITED` | Too many requests | Wait and retry | | `CONCURRENT_LIMIT` | Too many concurrent | Wait for completion | ## Error Response Format ```json theme={null} { "jsonrpc": "2.0", "id": 1, "error": { "code": -32000, "message": "ASG Error", "data": { "asg_code": "QUOTE_EXPIRED", "details": "Quote expired at 2026-02-01T12:00:00Z" } } } ``` ## Handling Errors ```typescript theme={null} try { await client.callTool('inference_chat', { ... }); } catch (error) { switch (error.data?.asg_code) { case 'QUOTE_EXPIRED': // Retry with fresh quote break; case 'RATE_LIMITED': // Wait and retry await sleep(error.data.retry_after * 1000); break; case 'BUDGET_EXCEEDED': // Start new run or increase budget break; default: // Log and escalate console.error(error); } } ``` # API Overview Source: https://docs.asgcompute.com/api/overview ASG Agent Cloud API Reference # API Overview ASG Agent Cloud uses the **Model Context Protocol (MCP)** for all tool interactions. ## Endpoints ASG exposes two endpoints — use whichever matches your integration: | Endpoint | Protocol | Use case | | :------------------- | :--------------------- | :---------------------------- | | `/v1/mcp/tools/call` | **REST** (recommended) | Quickstart, most integrations | | `/mcp` | **JSON-RPC 2.0** | MCP-native agent frameworks | Base URL: ``` https://agent.asgcompute.com ``` ## Protocol All requests use **JSON-RPC 2.0** over HTTP POST. ## Request Format ```json theme={null} { "jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": { "name": "tool_name", "arguments": { ... }, "_meta": { "payment": { "tx_signature": "optional-payment-proof" } } } } ``` ## Methods | Method | Description | | :----------- | :------------------- | | `tools/list` | List available tools | | `tools/call` | Execute a tool | ## Authentication All requests require an API key via Bearer token: ```bash theme={null} Authorization: Bearer ``` Create API keys in the [Console](https://agent.asgcompute.com/console). See [Authentication](/security/authentication) for details. ## Response Format ### Success (200) ```json theme={null} { "jsonrpc": "2.0", "id": 1, "result": { "content": "...", "_meta": { "receipt_id": "rcpt_abc123", "debited_usdc_microusd": 10000 } } } ``` ### Payment Required (402) ```json theme={null} { "jsonrpc": "2.0", "id": 1, "error": { "code": 402, "message": "Payment Required", "data": { "quote_id": "quote_xyz", "amount_usdc_microusd": 10000, "expires_at": "2026-02-01T12:01:00Z" } } } ``` ## Active Tools | Tool | Description | Billable | Status | | :--------------------- | :------------------------------ | :------- | :---------- | | `inference_chat` | AI completions with 100+ models | Yes | ✅ Available | | `optify_vram_estimate` | Estimate VRAM requirements | Yes | ✅ Available | | `sandbox_execute` | Execute code in isolation | Yes | ✅ Available | | `sandbox_cancel` | Cancel running sandbox | No | ✅ Available | | `get_status` | System status + balance | No | ✅ Available | | `echo` | Validate auth + connectivity | No | ✅ Available | See [Tool Availability](/guide/tool-availability) for the full catalog and roadmap. ## Rate Limits | Tier | Requests/min | Requests/day | | :--------- | :----------- | :----------- | | Default | 60 | 10,000 | | Enterprise | Custom | Custom | ## Next Steps Full error code reference Use our TypeScript SDK # API Reference Source: https://docs.asgcompute.com/api/reference Complete ASG Agent Cloud API documentation # API Reference This API reference is auto-generated from our OpenAPI specification. ## Overview ASG Agent Cloud uses **MCP (Model Context Protocol)** over HTTP for tool execution. All endpoints accept JSON and return JSON. ## Base URL ``` https://agent.asgcompute.com ``` ## Authentication All requests require Bearer authentication with an API key (created in the [Console](https://agent.asgcompute.com/console)): ```bash theme={null} Authorization: Bearer ``` API keys use the `sk-agent-*` prefix. See [Authentication](/security/authentication) for setup details. ## Endpoints ### Health Check service status. No authentication required. ### MCP Gateway Execute MCP tool calls. Returns 402 with quote if payment needed. ### Receipts List your payment receipts. Get a specific receipt by ID. ### Runs List your execution runs. Get run details by ID. ## OpenAPI Specification The complete API specification is available at: * [View OpenAPI YAML](/openapi/public.openapi.yaml) ## Error Handling All errors follow a consistent format. See [Error Codes](/api/errors) for the complete reference. ```json theme={null} { "code": "QUOTE_EXPIRED", "message": "Quote has expired", "request_id": "req_abc123" } ``` ## Rate Limits | Tier | Requests/min | Burst | | :--------- | :----------- | :----- | | Default | 60 | 10 | | Enterprise | Custom | Custom | Rate limit headers are included in responses: * `X-RateLimit-Limit` * `X-RateLimit-Remaining` * `X-RateLimit-Reset` # null Source: https://docs.asgcompute.com/architecture/adr/ADR-002_service_role_access # ADR-002: Database Access Pattern — Service Role with RLS Enabled **Status:** ACCEPTED\ **Date:** 2026-02-02\ **Author:** ASG Agent Cloud Team *** ## Context The Supabase Security Advisor flagged **21 tables** without Row-Level Security (RLS) policies enabled. This raised concerns about data access controls. However, our architecture uses a **service-to-database** pattern: * All database access flows through trusted backend services (Gateway, Billing Plane, Control Plane) * No direct client-to-database connections exist * Public/Anonymous keys are **never exposed** to clients ## Decision We adopt a **"RLS Enabled + Service Role Bypass"** pattern: ### 1. RLS is ENABLED on all tables * This provides defense-in-depth * Any accidental use of `anon` key returns **zero rows** ### 2. Service Role is used for API operations * All backend services use `service_role` key (stored as secrets) * Service Role **bypasses RLS** for performance (expected Postgres behavior) * Application-layer AuthZ (middleware, scopes, budget guards) controls access ### 3. Anon Key is effectively disabled * No routes or SDK calls use the `anon` key * `anon` access is blocked by RLS policies (even if enabled) ## Evidence Required To validate this ADR, the following must be verified and documented: | Check | Command / Action | Expected Result | | -------------- | ------------------------------------------------------------------------ | ------------------------------------ | | RLS Enabled | `SELECT tablename, rowsecurity FROM pg_tables WHERE schemaname='public'` | All tables show `rowsecurity = true` | | Anon Blocked | Query any table using `anon` key | 0 rows returned OR permission denied | | Secrets Secure | Run Gitleaks / Secrets Scan | No `service_role` key in source | ## Consequences ### Positive * **Performance:** No RLS policy evaluation overhead for API calls * **Security:** Defense-in-depth via RLS for accidental anon access * **Simplicity:** No complex RLS policy maintenance per table ### Negative * **Audit Warnings:** Supabase Advisor will still show "missing policies" (expected) * **Operational Discipline:** All new services must use `service_role` key correctly ## Alternatives Considered 1. **Full RLS with per-table policies:** Rejected due to maintenance complexity and performance overhead for our server-only architecture 2. **Disable RLS entirely:** Rejected due to loss of defense-in-depth ## References * [Supabase RLS Documentation](https://supabase.com/docs/guides/auth/row-level-security) * ADR-001: Database Security Posture (if exists) # Gasless Payments Source: https://docs.asgcompute.com/billing/gasless Pay in USDC, we cover the fees # Gasless Payments With ASG, you pay only in USDC — we handle all blockchain transaction fees. ## What is Gasless? On Solana, every transaction requires a small fee (gas). With ASG: | Traditional Payment | Gasless Payment | | :-------------------- | :-------------------- | | You need USDC | You need USDC | | You need SOL for fees | **We pay the SOL** | | You sign + pay gas | You sign, we relay | | Complex for agents | **Simple for agents** | ## How It Works ```mermaid theme={null} sequenceDiagram participant Agent participant ASG participant Solana Agent->>ASG: Request quote ASG-->>Agent: Quote + payment details Agent->>Agent: Sign USDC transfer Agent->>ASG: Submit signed transfer ASG->>Solana: Relay + pay gas Solana-->>ASG: Confirmation ASG-->>Agent: Receipt ``` ## Benefits ### For Agents * **Single token** — Only need USDC, no SOL management * **Simpler integration** — No gas estimation * **No stuck transactions** — We handle retries ### For Developers * **Better UX** — Users don't need to understand gas * **Predictable costs** — No gas price volatility * **Unified accounting** — Everything in USD ## Technical Details **Implementation:** We sponsor transaction fees using fee-payer relayers. The USDC transfer is still fully on-chain and verifiable. ## Supported Networks Currently: **Solana Mainnet** ## FAQ Standard rate limits apply (see API docs). No per-transaction limits. Gas costs are included in our service pricing. No separate charges. If ASG fails to relay your transaction, no payment is taken. # Billing Overview Source: https://docs.asgcompute.com/billing/overview How ASG billing works # Billing Overview **⚠️ Mainnet Only** — All payments use **Solana mainnet USDC**. There is no devnet or testnet mode. ASG uses a simple, transparent billing model: **pay-per-use with instant settlement**. **Free tools:** `get_status`, `echo`, and `sandbox_cancel` skip the payment flow entirely — no quote, no 402. Use them to verify your setup before depositing funds. ## The Model ```mermaid theme={null} flowchart LR Quote[Get Quote] --> Pay[Pay USDC] Pay --> Execute[Execute] Execute --> Receipt[Get Receipt] ``` ## Key Principles ### 1. Prepaid Only All usage is prepaid. You pay for a Quote, then execute. No credit lines, no invoices. ### 2. Micro-USD Precision All amounts are in **microusd** — 1/1,000,000 of a USD: * \$1.00 = 1,000,000 microusd * \$0.01 = 10,000 microusd * \$0.000001 = 1 microusd ### 3. Instant Settlement Payments settle on Solana in \~400ms. No waiting. ### 4. Exact Pricing You pay exactly the quoted amount. The quote tells you the price before execution — no surprises. ## Flow Example | Step | What Happens | Amount | | :------------- | :---------------------- | :---------------- | | 1. **Quote** | Request tool, get price | Quote: \$0.0024 | | 2. **Pay** | Send USDC on Solana | Paid: \$0.0024 | | 3. **Execute** | Tool runs | — | | 4. **Receipt** | Get proof of work | Debited: \$0.0024 | ## Billing Terms | Term | Definition | | :---------- | :------------------------ | | **Quote** | Price commitment with TTL | | **Payment** | USDC transfer on Solana | | **Receipt** | Proof of completed work | ## Next Steps Detailed rates for all services How we cover transaction fees Understanding receipts # Pricing Source: https://docs.asgcompute.com/billing/pricing ASG service rates # Pricing All prices are pay-per-use with no minimums, commitments, or hidden fees. ## Inference ASG supports a wide range of AI models. Pricing varies by model: | Model | Input | Output | | :---------------------------- | :--------------- | :---------------- | | **openai/gpt-4o-mini** | \$0.15/1M tokens | \$0.60/1M tokens | | **openai/gpt-4.1** | \$2.00/1M tokens | \$8.00/1M tokens | | **openai/gpt-5.2** | \$3.00/1M tokens | \$15.00/1M tokens | | **anthropic/claude-sonnet-4** | \$3.00/1M tokens | \$15.00/1M tokens | | **google/gemini-2.5-pro** | \$1.25/1M tokens | \$10.00/1M tokens | | **deepseek/deepseek-r1** | \$0.55/1M tokens | \$2.19/1M tokens | Exact pricing depends on the upstream model provider. Use the **Quote** to see the exact cost before execution. ## Sandbox | Resource | Rate | | :------------------ | :----------- | | **Execution time** | \$0.0001/sec | | **Package install** | Included | **Minimum charge:** \$0.001 per execution ## Serverless **Coming Soon** — Serverless execution is on the roadmap. See [Roadmap](/resources/roadmap). ## GPU **Coming Soon** — GPU provisioning is on the roadmap. See [Roadmap](/resources/roadmap). *** ## Pricing FAQ No. The prices shown are what you pay. We cover all Solana transaction fees (gasless). No minimum spend. Pay only for what you use. Every tool call returns a **Quote** with the exact price before any payment is required. # Receipts Source: https://docs.asgcompute.com/billing/receipts Proof of completed work # Receipts Every completed tool execution generates a receipt — your proof of work and payment. ## What's in a Receipt? ```json theme={null} { "receipt_id": "rcpt_2026020812345", "step_id": "step_abc123", "run_id": "run_xyz789", "tool": "inference_chat", "quoted_usdc_microusd": 2400, "debited_usdc_microusd": 2400, "created_at": "2026-02-08T12:00:00Z" } ``` ## Receipt Fields | Field | Description | | :---------------------- | :--------------------------------- | | `receipt_id` | Unique receipt identifier | | `step_id` | Execution step this receipt covers | | `run_id` | Parent run identifier | | `tool` | Tool that was executed | | `quoted_usdc_microusd` | Original quote amount | | `debited_usdc_microusd` | Amount charged | | `created_at` | When the receipt was issued | ## Getting Receipts ### In Tool Response Every tool call includes receipt metadata: ```json theme={null} { "result": { "content": "...", "_meta": { "receipt_id": "rcpt_abc123", "debited_usdc_microusd": 85000 } } } ``` ### Query Receipt Retrieve full receipt details: ```bash theme={null} curl -X POST https://agent.asgcompute.com/mcp \ -H "Content-Type: application/json" \ -d '{ "jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": { "name": "billing_get_receipt", "arguments": { "receipt_id": "rcpt_abc123" } } }' ``` ## Receipt Retention Receipts are stored for **30 days**. Export receipts for accounting purposes before expiration. *** ## Verify a Receipt Every receipt is independently verifiable — both through the ASG API and directly on the Solana blockchain. ### Step 1: Look Up the Receipt Use the `billing_get_receipt` tool to retrieve full receipt details by ID: ```bash theme={null} curl -X POST https://agent.asgcompute.com/mcp \ -H "Content-Type: application/json" \ -H "Authorization: Bearer YOUR_API_KEY" \ -d '{ "jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": { "name": "billing_get_receipt", "arguments": { "receipt_id": "rcpt_2026020812345" } } }' ``` **Response:** ```json theme={null} { "result": { "content": [ { "type": "text", "text": "{\"receipt_id\":\"rcpt_2026020812345\",\"tool\":\"inference_chat\",\"quoted_usdc_microusd\":2400,\"debited_usdc_microusd\":2400,\"tx_signature\":\"5UxK...7nPq\",\"created_at\":\"2026-02-08T12:00:00Z\"}" } ] } } ``` ### Step 2: Verify On-Chain Every receipt includes a `tx_signature` field — the Solana transaction signature. Use it to verify the payment on-chain: **Solana Explorer URL format:** ``` https://explorer.solana.com/tx/ ``` For example, if `tx_signature` is `5UxK...7nPq`: ``` https://explorer.solana.com/tx/5UxK...7nPq ``` Bookmark the Solana Explorer link for quick access: [explorer.solana.com](https://explorer.solana.com) ### Step 3: Cross-Reference Verify that the on-chain transaction matches your receipt: | Receipt Field | On-Chain Check | | :---------------------- | :---------------------------------- | | `debited_usdc_microusd` | Amount transferred matches | | `tx_signature` | Transaction exists and is finalized | | `created_at` | Timestamp aligns with block time | All Solana transactions are on **mainnet**. Ensure you're viewing the mainnet explorer, not devnet. ### Programmatic Verification For automated verification, you can query the Solana RPC directly: ```bash theme={null} curl -X POST https://api.mainnet-beta.solana.com \ -H "Content-Type: application/json" \ -d '{ "jsonrpc": "2.0", "id": 1, "method": "getTransaction", "params": [ "YOUR_TX_SIGNATURE", { "encoding": "json", "maxSupportedTransactionVersion": 0 } ] }' ``` This returns the full transaction details including sender, recipient, amount, and confirmation status. # Billing Transparency Source: https://docs.asgcompute.com/billing/transparency How ASG billing works under the hood — quotes, payments, receipts, and margins # Billing Transparency ASG is built on a principle of **full billing transparency**. Every cent is traceable — from quote generation to on-chain settlement. This page explains exactly how your money flows through the system. ## Billing Lifecycle Every paid tool call follows the same deterministic lifecycle: ```mermaid theme={null} sequenceDiagram participant Agent participant ASG Gateway participant Upstream Provider participant Solana Agent->>ASG Gateway: 1. Call tool ASG Gateway->>Upstream Provider: 2. Fetch upstream cost ASG Gateway-->>Agent: 3. Return Quote Agent->>Solana: 4. Sign USDC transfer Agent->>ASG Gateway: 5. Submit payment proof ASG Gateway->>Solana: 6. Verify on-chain ASG Gateway->>Upstream Provider: 7. Execute tool Upstream Provider-->>ASG Gateway: 8. Return result ASG Gateway-->>Agent: 9. Result + Receipt ``` *** ## Step 1: Quote Generation When you call a paid tool, ASG calculates the exact price **before** any payment: 1. **Upstream cost lookup** — ASG queries the upstream provider (e.g., OpenAI, Anthropic) for the current rate. 2. **Margin applied** — A transparent margin is added (see [Margin Disclosure](#margin-disclosure) below). 3. **Quote created** — A quote object is returned with the total price in **microUSD** and a time-to-live (TTL). ```json theme={null} { "quote_id": "qt_20260209_abc123", "tool": "inference_chat", "amount_microusd": 2400, "ttl_seconds": 300, "expires_at": "2026-02-09T12:05:00Z" } ``` Quotes expire after their TTL (typically 5 minutes). If a quote expires, request a new one — pricing may have changed. ### What determines the price? | Factor | Example | | :----------------- | :---------------------------------- | | **Model** | `gpt-4o-mini` vs `claude-sonnet-4` | | **Token count** | Input + output tokens for inference | | **Execution time** | Sandbox charges per second | | **Upstream rate** | Current provider pricing | *** ## Step 2: Payment Verification After receiving a quote, you sign a USDC transfer on Solana: 1. **Agent signs** — Your agent signs a USDC transfer for the quoted amount to ASG's settlement address. 2. **Proof submitted** — The signed transaction (or its signature) is sent to ASG via the `X-Payment` header or `payment_proof` body field. 3. **On-chain verification** — ASG verifies the transaction on Solana mainnet: * Correct amount transferred * Correct recipient address * Transaction finalized on-chain 4. **Idempotency check** — Each transaction signature can only be used once. Replaying the same proof will not result in a double charge. ```bash theme={null} curl -X POST https://agent.asgcompute.com/mcp \ -H "Content-Type: application/json" \ -H "X-Payment: " \ -d '{ "jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": { "name": "inference_chat", "arguments": { "model": "openai/gpt-4o-mini", "messages": [{"role": "user", "content": "Hello"}] } } }' ``` **Mainnet only** — All payments use Solana mainnet USDC. There is no devnet or testnet mode. *** ## Step 3: Receipt Creation After successful execution, a receipt is generated and returned in the response: 1. **Receipt minted** — A unique `receipt_id` is created. 2. **Debit recorded** — The exact amount debited is stored (always matches the quote). 3. **Solana reference** — The on-chain transaction signature (`tx_signature`) is linked to the receipt. 4. **Returned to agent** — The receipt metadata is included in the `_meta` field of the tool response. ```json theme={null} { "result": { "content": [{ "type": "text", "text": "Hello! How can I help?" }], "_meta": { "receipt_id": "rcpt_20260209_def456", "quoted_usdc_microusd": 2400, "debited_usdc_microusd": 2400, "tx_signature": "5UxK...7nPq", "tool": "inference_chat", "created_at": "2026-02-09T12:00:30Z" } } } ``` Every receipt is independently verifiable on the Solana blockchain. See [Receipts](/billing/receipts) for full details. *** ## Step 4: Balance Deductions If you use **prepaid balance** (deposited USDC) instead of per-call payment: 1. **Balance checked** — Your account balance is verified against the quoted amount. 2. **Atomic deduction** — The exact quoted amount is deducted from your balance atomically. 3. **No partial charges** — If the tool fails after payment, the full amount is refunded to your balance. 4. **Receipt issued** — Same receipt flow as direct payment. | Scenario | What happens | | :--------------- | :----------------------------------------- | | Balance ≥ quote | Deduct → Execute → Receipt | | Balance \< quote | Rejected with `insufficient_balance` error | | Execution fails | Full refund to balance | | Quote expired | New quote required | Balance deductions are recorded with the same `tx_signature` traceability as direct Solana payments. *** ## Margin Disclosure ASG charges a transparent margin on top of upstream provider costs. Here's how pricing breaks down: ### What you pay ``` Total price = Upstream cost + ASG margin ``` ### What the margin covers | Component | Description | | :------------------ | :--------------------------------------------------------------- | | **Infrastructure** | Gateway servers, Solana relayers, monitoring | | **Gas sponsorship** | We pay all Solana transaction fees ([Gasless](/billing/gasless)) | | **Reliability** | Automatic retries, failover, idempotency | | **Developer tools** | Console, receipts, analytics, API key management | ### How to see the breakdown Every quote includes the total amount. You can compare ASG pricing with upstream provider rates on our [Pricing](/billing/pricing) page. **Free tools available** — Tools like `get_status` and `echo` are completely free with no margin. Use them to test your integration before making paid calls. *** ## Verification & Audit Every transaction is auditable: 1. **Receipt lookup** — Query any receipt by ID via the `billing_get_receipt` tool. 2. **On-chain verification** — Every `tx_signature` can be verified on [Solana Explorer](https://explorer.solana.com). 3. **Balance history** — Check your current balance and recent transactions via the Console at [agent.asgcompute.com/console](https://agent.asgcompute.com/console). For receipt verification details, see the [Receipts](/billing/receipts) guide. *** ## Next Steps Detailed rates for all services Verify and query receipts How we cover transaction fees High-level billing model # Agent Quickstart Source: https://docs.asgcompute.com/guide/agent-quickstart Get your AI agent calling ASG tools in under 5 minutes # 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 * ASG API key ([create in Console](https://agent.asgcompute.com/console/#/console/keys)) * For paid tools: Solana wallet with USDC (mainnet) ## Step 1: Create API Key 1. Open [Console](https://agent.asgcompute.com/console/) 2. Connect wallet → **API Keys** → **Create Key** 3. Copy key (starts with `sk-agent-...`) ```bash theme={null} 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**: ```bash curl theme={null} 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": {} }' ``` ```python Python theme={null} import requests, os ASG = "https://agent.asgcompute.com/v1/mcp/tools/call" API_KEY = os.environ["ASG_API_KEY"] r = requests.post(ASG, json={ "tool": "get_status", "params": {} }, headers={ "Authorization": f"Bearer {API_KEY}", "Content-Type": "application/json" }) print(r.json()) ``` ```typescript TypeScript theme={null} const ASG = 'https://agent.asgcompute.com/v1/mcp/tools/call'; const API_KEY = process.env.ASG_API_KEY!; const res = await fetch(ASG, { method: 'POST', headers: { 'Authorization': `Bearer ${API_KEY}`, 'Content-Type': 'application/json', }, body: JSON.stringify({ tool: 'get_status', params: {} }), }); console.log(await res.json()); ``` Expected response (200): ```json theme={null} { "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**: ```bash curl theme={null} 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" } }' ``` ```python Python theme={null} import requests, os ASG = "https://agent.asgcompute.com/v1/mcp/tools/call" API_KEY = os.environ["ASG_API_KEY"] r = requests.post(ASG, json={ "tool": "echo", "params": {"message": "hello from my agent"} }, headers={ "Authorization": f"Bearer {API_KEY}", "Content-Type": "application/json" }) print(r.json()) ``` ```typescript TypeScript theme={null} const ASG = 'https://agent.asgcompute.com/v1/mcp/tools/call'; const API_KEY = process.env.ASG_API_KEY!; const res = await fetch(ASG, { method: 'POST', headers: { 'Authorization': `Bearer ${API_KEY}`, 'Content-Type': 'application/json', }, body: JSON.stringify({ tool: 'echo', params: { message: 'hello from my agent' }, }), }); console.log(await res.json()); ``` Expected response (200): ```json theme={null} { "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: ```bash curl theme={null} curl -s https://agent.asgcompute.com/mcp/capabilities \ | jq '.tools[] | {name, status, billable}' ``` ```python Python theme={null} import requests r = requests.get("https://agent.asgcompute.com/mcp/capabilities") for tool in r.json().get("tools", []): print(f"{tool['name']:30} billable={tool.get('billable', 'N/A')}") ``` ```typescript TypeScript theme={null} const res = await fetch('https://agent.asgcompute.com/mcp/capabilities'); const data = await res.json(); for (const tool of data.tools) { console.log(`${tool.name.padEnd(30)} billable=${tool.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. ```bash curl theme={null} 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!"}] } }' ``` ```python Python theme={null} import requests, os ASG = "https://agent.asgcompute.com/v1/mcp/tools/call" API_KEY = os.environ["ASG_API_KEY"] r = requests.post(ASG, json={ "tool": "inference_chat", "params": { "model": "openai/gpt-4o-mini", "messages": [{"role": "user", "content": "Hello!"}] } }, headers={ "Authorization": f"Bearer {API_KEY}", "Content-Type": "application/json" }) data = r.json() # 402 → data["quote"]["quote_id"], data["step_id"] # 200 → data["result"]["content"] (if balance-funded) print(r.status_code, data) ``` ```typescript TypeScript theme={null} const ASG = 'https://agent.asgcompute.com/v1/mcp/tools/call'; const API_KEY = process.env.ASG_API_KEY!; const res = await fetch(ASG, { method: 'POST', headers: { 'Authorization': `Bearer ${API_KEY}`, 'Content-Type': 'application/json', }, body: JSON.stringify({ tool: 'inference_chat', params: { model: 'openai/gpt-4o-mini', messages: [{ role: 'user', content: 'Hello!' }], }, }), }); const data = await res.json(); // 402 → data.quote.quote_id, data.step_id // 200 → data.result.content (if balance-funded) console.log(res.status, data); ``` **If 200 — Success!** The result is in `data.result.content`. **If 402 — Payment Required:** ```json theme={null} { "code": "PAYMENT_REQUIRED", "quote": { "quote_id": "abc123", "amount_usdc_microusd": 10000 }, "payment_instructions": { "network": "solana-mainnet", "pay_to": "", "usdc_mint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v" }, "step_id": "step_xyz" } ``` ## Step 6: Pay and Retry Send USDC on-chain, then retry with proof: ```bash curl theme={null} 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": "", "amount_usdc": "0.010000", "memo": "::1", "quote_id": "", "step_id": "", "network": "solana-mainnet" } }' ``` ```python Python theme={null} import requests, os ASG = "https://agent.asgcompute.com/v1/mcp/tools/call" API_KEY = os.environ["ASG_API_KEY"] r = requests.post(ASG, json={ "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": "", "amount_usdc": "0.010000", "memo": "::1", "quote_id": "", "step_id": "", "network": "solana-mainnet" } }, headers={ "Authorization": f"Bearer {API_KEY}", "Content-Type": "application/json" }) print(r.json()) ``` ```typescript TypeScript theme={null} const ASG = 'https://agent.asgcompute.com/v1/mcp/tools/call'; const API_KEY = process.env.ASG_API_KEY!; const res = await fetch(ASG, { method: 'POST', headers: { 'Authorization': `Bearer ${API_KEY}`, 'Content-Type': 'application/json', }, body: JSON.stringify({ 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: '', amount_usdc: '0.010000', memo: '::1', quote_id: '', step_id: '', network: 'solana-mainnet', }, }), }); console.log(await res.json()); ``` **Faster path:** Deposit USDC via [Console → Balance](https://agent.asgcompute.com/console/#/console/balance) first. Then paid tool calls deduct from your balance automatically — no per-call on-chain transactions needed. ## Available Tools | Tool | Status | Billable | Notes | | ---------------------- | -------------- | -------- | ------------------------ | | `get_status` | ✅ Active | **Free** | System status + balance | | `echo` | ✅ Active | **Free** | Validate auth + payload | | `inference_chat` | ✅ Active | Paid | GPT-4o, Claude, Gemini | | `optify_vram_estimate` | ✅ Active | Paid | GPU memory estimation | | `sandbox_execute` | ✅ Active | Paid | Python/JS code execution | | `sandbox_cancel` | ✅ Active | **Free** | Cancel running sandbox | | `gpu_provision` | 🔜 Coming Soon | — | GPU provisioning | See [Tool Availability](/guide/tool-availability) for the full catalog. ## MCP Integration For agents using the [Model Context Protocol](https://modelcontextprotocol.io/), connect directly: ```json theme={null} { "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 | Status | Code | Meaning | | ------ | ------------------ | ----------------------------------------- | | 200 | — | Success | | 401 | `UNAUTHORIZED` | Invalid or missing API key | | 402 | `PAYMENT_REQUIRED` | Deposit or pay to continue | | 403 | `FORBIDDEN` | Scope not authorized | | 429 | `RATE_LIMITED` | Too many requests | | 500 | — | Server error (retry with idempotency key) | ## What's Next? TypeScript and Python code examples Complete payment lifecycle guide Service pricing details How ASG works under the hood # Architecture Source: https://docs.asgcompute.com/guide/architecture High-level system architecture # Architecture ASG Agent Cloud is designed for reliability, scale, and security. ## System Overview ```mermaid theme={null} flowchart TB subgraph Clients Agent[Your Agent] SDK[ASG SDK] end subgraph ASG["ASG Agent Cloud"] Gateway[Gateway] Billing[Billing Service] Control[Control Plane] end subgraph Compute["Compute Layer"] Inference[Inference ✅] Sandbox[Sandbox ✅] Serverless[Serverless 🔜] GPU[GPU Pods 🔜] end subgraph Chain["Solana"] USDC[USDC Payments] end Agent --> SDK --> Gateway Gateway --> Billing Gateway --> Control Gateway --> Inference Gateway --> Serverless Gateway --> GPU Gateway --> Sandbox Billing --> USDC ``` ## Components ### Gateway The **Gateway** is your primary entry point: * Handles MCP protocol (Streamable HTTP + SSE) * Routes tool calls to services * Enforces rate limits and authentication ### Billing Service The **Billing Service** manages payments: * Generates quotes * Verifies on-chain payments * Issues receipts ### Control Plane The **Control Plane** manages execution: * Run/Step state machine * Budget enforcement * Idempotency and deduplication * Loop detection ### Compute Layer Two active compute services, with more on the roadmap: | Service | Status | Use Case | | :------------- | :-------- | :--------------------------- | | **Inference** | ✅ Active | AI completions (100+ models) | | **Sandbox** | ✅ Active | Isolated code execution | | **Serverless** | 🔜 Coming | Async jobs (Python/Node) | | **GPU Pods** | 🔜 Coming | Dedicated GPU instances | ## Design Principles ### 1. Non-Custodial We never hold your private keys. All payments are on-chain. ### 2. Prepaid Only All usage is prepaid. No credit, no invoices. ### 3. Gasless You pay only in USDC. We cover all Solana fees. ### 4. Isolated Execution All code runs in isolated environments with strict egress policies. *** ## Regions Currently available in **US-West**. Multi-region coming soon. ## SLA Target availability: **99.9%** (working towards SLA documentation). # Core Concepts Source: https://docs.asgcompute.com/guide/concepts Essential concepts for working with ASG Agent Cloud # Core Concepts Understanding these concepts will help you get the most out of ASG Agent Cloud. ## The Payment Flow Every paid tool call follows this flow: ```mermaid theme={null} sequenceDiagram participant Agent participant ASG participant Solana Agent->>ASG: Call tool (no payment) ASG-->>Agent: 402 + Quote Agent->>Solana: Send USDC Solana-->>Agent: TX Signature Agent->>ASG: Call tool (with signature) ASG->>Solana: Verify payment ASG-->>Agent: Result + Receipt ``` ## Key Terms ### Quote A **Quote** is a price commitment for a specific request. It includes: * `quote_id` — Unique identifier * `amount_usdc_microusd` — Price in micro-USD (1/1,000,000 of \$1) * `expires_at` — When the quote expires (typically 60 seconds) ### Receipt A **Receipt** is proof of completed work. It includes: * `receipt_id` — Unique identifier * `debited_usdc_microusd` — Actual cost (may differ from quote) * `step_id` — Reference to the execution step ### Run A **Run** is a container for related work. Runs have: * **Budget** — Maximum spend limit * **TTL** — Time-to-live before auto-cancel * **Steps** — Individual tool executions ### Step A **Step** is a single tool execution within a Run. Each Step: * Has its own budget * Generates one Receipt * Can be retried (max 1 retry) ## Budgets Budgets protect against runaway costs: | Level | Purpose | | :-------------- | :-------------------------- | | **Run Budget** | Total spend limit for a Run | | **Step Budget** | Max spend for a single Step | If a budget is exceeded, you'll receive a `BUDGET_EXCEEDED` error. ## Idempotency Every request can include an **idempotency key**. If you retry with the same key: * Same result returned * No duplicate charges * Same receipt ## TTL (Time-to-Live) Resources have TTLs: * **Quotes** — 60 seconds default * **GPU Leases** — Configurable, requires heartbeat *(Coming soon)* * **Runs** — Configurable per-run *** ## Next Steps System architecture overview Detailed pricing information # Payment Flow Source: https://docs.asgcompute.com/guide/payment-flow Complete guide to the ASG 402 payment flow with working curl examples # Payment Flow Guide **⚠️ Mainnet Only** — All payments use **Solana mainnet USDC**. There is no devnet or testnet mode. ASG Agent Cloud uses a **2-step payment flow** based on the HTTP 402 Payment Required standard. This guide shows you exactly how it works with copy-paste curl examples. ## How It Works ```mermaid theme={null} sequenceDiagram participant Agent participant ASG Gateway participant Solana Agent->>ASG Gateway: POST /v1/mcp/tools/call (no payment) ASG Gateway-->>Agent: 402 + quote + payment_instructions Agent->>Solana: Send USDC to pay_to address Solana-->>Agent: tx_signature Agent->>ASG Gateway: POST /v1/mcp/tools/call (with payment_proof) ASG Gateway->>Solana: Verify payment on-chain ASG Gateway-->>Agent: 200 + result + receipt ``` ## Step 1: Request a Quote Call any billable tool **without** a payment proof. The gateway returns a `402 Payment Required` response with a quote and payment instructions. ```bash theme={null} curl -X POST https://agent.asgcompute.com/v1/mcp/tools/call \ -H "Authorization: Bearer sk-agent-YOUR_KEY" \ -H "Content-Type: application/json" \ -d '{ "tool": "inference_chat", "params": { "model": "google/gemini-2.0-flash-001", "messages": [{"role": "user", "content": "Hello"}] } }' ``` ### 402 Response ```json theme={null} { "code": "PAYMENT_REQUIRED", "message": "Payment required to execute tool", "quote": { "quote_id": "qt_abc123", "tool": "inference_chat", "price_usdc_microusd": 10000, "price_display": "$0.01", "ttl_seconds": 300, "expires_at": "2026-02-08T12:05:00Z" }, "payment_instructions": { "network": "solana-mainnet", "asset": "USDC", "pay_to": "", "usdc_mint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v", "memo_format": "step_id:quote_id:nonce", "methods": ["x402_header", "body_payment_proof"] }, "step_id": "step_xyz" } ``` Save the `quote_id`, `step_id`, `pay_to`, and `usdc_mint` from this response — you'll need them to build the payment. ## Step 2: Pay and Retry After sending USDC on Solana mainnet, retry the **same tool call** with your payment proof attached. ASG supports two methods: ### Method A: Body `payment_proof` (Primary) Include the payment proof directly in the request body: ```bash theme={null} curl -X POST https://agent.asgcompute.com/v1/mcp/tools/call \ -H "Authorization: Bearer sk-agent-YOUR_KEY" \ -H "Content-Type: application/json" \ -d '{ "tool": "inference_chat", "params": { "model": "google/gemini-2.0-flash-001", "messages": [{"role": "user", "content": "Hello"}] }, "payment_proof": { "tx_ref": "YOUR_SOLANA_TX_SIGNATURE", "amount_usdc": "0.01", "memo": "step_xyz:qt_abc123:1", "network": "solana-mainnet" }, "idempotency_key": "unique-key-per-request" }' ``` ### Method B: `X-Payment` Header (x402 Standard) Encode the payment proof as base64 JSON and pass it in the `X-Payment` header: ```bash theme={null} # Encode payment proof as base64 JSON PAYMENT=$(echo -n '{"tx":"YOUR_SOLANA_TX_SIGNATURE","quote_id":"qt_abc123"}' | base64) curl -X POST https://agent.asgcompute.com/v1/mcp/tools/call \ -H "Authorization: Bearer sk-agent-YOUR_KEY" \ -H "X-Payment: $PAYMENT" \ -H "Content-Type: application/json" \ -d '{ "tool": "inference_chat", "params": { "model": "google/gemini-2.0-flash-001", "messages": [{"role": "user", "content": "Hello"}] }, "idempotency_key": "unique-key" }' ``` ### Success Response (200) ```json theme={null} { "ok": true, "result": { "type": "text", "content": "Hello! How can I help you today?" }, "receipt": { "receipt_id": "rcpt_123", "debited_usdc_microusd": 10000 } } ``` ## Field Reference | Field | Description | Example | | :---------------- | :------------------------------------------- | :----------------------- | | `tx_ref` | Solana transaction signature (base58) | `5x7Hk...` | | `amount_usdc` | Amount in USDC (string) | `"0.01"` | | `memo` | Format: `step_id:quote_id:nonce` | `"step_xyz:qt_abc123:1"` | | `network` | Must be `solana-mainnet` | `"solana-mainnet"` | | `idempotency_key` | Unique per request (prevents double-billing) | `"550e8400-..."` | | `quote_id` | Quote ID from 402 response | `"qt_abc123"` | ## Idempotency Always include an `idempotency_key` with your payment proof. If a request is retried with the same key, ASG returns the cached result **without charging again**. This prevents double-billing on network errors. ## Error Handling | Error Code | Meaning | Action | | :----------------- | :-------------------------- | :----------------------- | | `PAYMENT_REQUIRED` | No payment attached | Get quote, pay, retry | | `QUOTE_EXPIRED` | Quote TTL exceeded | Request a new quote | | `INVALID_PAYMENT` | Payment verification failed | Check tx\_ref and amount | | `RATE_LIMITED` | Too many requests | Back off and retry | ## Next Steps See which tools are currently active Understand the billing model TypeScript examples with payment flow Full technical payment contract reference # Quickstart Source: https://docs.asgcompute.com/guide/quickstart Call your first ASG tool in under 3 minutes # Quickstart Get started with ASG Agent Cloud — from zero to first call in 3 minutes. **Start free:** `get_status` and `echo` are **always free** — no payment required. Validate your setup before spending a cent. ## Prerequisites * ASG API key (from [Console → API Keys](https://agent.asgcompute.com/console/#/console/keys)) * For paid tools: Solana wallet with **USDC on mainnet** * Node.js 18+ or Python 3.10+ ## Step 1: Get Your API Key 1. Open [Console](https://agent.asgcompute.com/console/) 2. Connect wallet → **API Keys** → **Create Key** 3. Export the key: ```bash theme={null} export ASG_API_KEY="sk-agent-YOUR_KEY" ``` ## Step 2: First Call — Free (No Payment!) Call `get_status` to verify your key works: ```bash curl theme={null} 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": {}}' ``` ```python Python theme={null} import requests, os ASG = "https://agent.asgcompute.com/v1/mcp/tools/call" API_KEY = os.environ["ASG_API_KEY"] r = requests.post(ASG, json={ "tool": "get_status", "params": {} }, headers={ "Authorization": f"Bearer {API_KEY}", "Content-Type": "application/json" }) print(r.json()) ``` ```typescript TypeScript theme={null} const ASG = 'https://agent.asgcompute.com/v1/mcp/tools/call'; const API_KEY = process.env.ASG_API_KEY!; const res = await fetch(ASG, { method: 'POST', headers: { 'Authorization': `Bearer ${API_KEY}`, 'Content-Type': 'application/json', }, body: JSON.stringify({ tool: 'get_status', params: {} }), }); console.log(await res.json()); ``` ✅ You should see `"ok": true` with your balance and system status. ## Step 3: Discover Tools ```bash curl theme={null} curl -s https://agent.asgcompute.com/mcp/capabilities \ | jq '.tools[] | {name, status, billable}' ``` ```python Python theme={null} import requests r = requests.get("https://agent.asgcompute.com/mcp/capabilities") for tool in r.json().get("tools", []): print(f"{tool['name']:30} billable={tool.get('billable', 'N/A')}") ``` ```typescript TypeScript theme={null} const res = await fetch('https://agent.asgcompute.com/mcp/capabilities'); const data = await res.json(); for (const tool of data.tools) { console.log(`${tool.name.padEnd(30)} billable=${tool.billable}`); } ``` ## Step 4: Make a Paid Call Call a billable tool. If you have balance, it executes immediately. Otherwise, you get a 402 with a quote. ```bash curl theme={null} 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!"}] } }' ``` ```python Python theme={null} import requests, os ASG = "https://agent.asgcompute.com/v1/mcp/tools/call" API_KEY = os.environ["ASG_API_KEY"] r = requests.post(ASG, json={ "tool": "inference_chat", "params": { "model": "openai/gpt-4o-mini", "messages": [{"role": "user", "content": "Hello!"}] } }, headers={ "Authorization": f"Bearer {API_KEY}", "Content-Type": "application/json" }) print(r.status_code, r.json()) ``` ```typescript TypeScript theme={null} const ASG = 'https://agent.asgcompute.com/v1/mcp/tools/call'; const API_KEY = process.env.ASG_API_KEY!; const res = await fetch(ASG, { method: 'POST', headers: { 'Authorization': `Bearer ${API_KEY}`, 'Content-Type': 'application/json', }, body: JSON.stringify({ tool: 'inference_chat', params: { model: 'openai/gpt-4o-mini', messages: [{ role: 'user', content: 'Hello!' }], }, }), }); console.log(res.status, await res.json()); ``` ### If 200: Success! ```json theme={null} { "ok": true, "result": { "type": "text", "content": "Hello! How can I help you?" }, "receipt": { "receipt_id": "rcpt_123", "debited_usdc_microusd": 10000 } } ``` ### If 402: Payment Required You receive a quote with `payment_instructions`: ```json theme={null} { "code": "PAYMENT_REQUIRED", "quote": { "quote_id": "abc123", "amount_usdc_microusd": 10000, "expires_at": "2026-02-10T12:00:00Z" }, "payment_instructions": { "network": "solana-mainnet", "asset": "USDC", "pay_to": "", "usdc_mint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v" }, "step_id": "step_xyz" } ``` ## Step 5: Pay on Solana Mainnet Send USDC to `pay_to` with memo: `{step_id}:{quote_id}:1` **Faster:** Deposit USDC via [Console → Balance](https://agent.asgcompute.com/console/#/console/balance) first. Then all paid calls deduct from your balance automatically — no per-call on-chain transactions needed. ## Step 6: Retry with Payment Proof ```bash curl theme={null} 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": "", "quote_id": "abc123", "step_id": "step_xyz", "memo": "step_xyz:abc123:1", "amount_usdc": "0.010000", "network": "solana-mainnet" } }' ``` ```python Python theme={null} import requests, os ASG = "https://agent.asgcompute.com/v1/mcp/tools/call" API_KEY = os.environ["ASG_API_KEY"] r = requests.post(ASG, json={ "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": "", "quote_id": "abc123", "step_id": "step_xyz", "memo": "step_xyz:abc123:1", "amount_usdc": "0.010000", "network": "solana-mainnet" } }, headers={ "Authorization": f"Bearer {API_KEY}", "Content-Type": "application/json" }) print(r.json()) ``` ```typescript TypeScript theme={null} const ASG = 'https://agent.asgcompute.com/v1/mcp/tools/call'; const API_KEY = process.env.ASG_API_KEY!; const res = await fetch(ASG, { method: 'POST', headers: { 'Authorization': `Bearer ${API_KEY}`, 'Content-Type': 'application/json', }, body: JSON.stringify({ 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: '', quote_id: 'abc123', step_id: 'step_xyz', memo: 'step_xyz:abc123:1', amount_usdc: '0.010000', network: 'solana-mainnet', }, }), }); console.log(await res.json()); ``` ## What's Next? Full agent integration guide with Python + TypeScript examples Runs, Steps, Budgets, and Receipts Working code examples Detailed pricing for all services # Tool Availability Source: https://docs.asgcompute.com/guide/tool-availability Current status of all ASG Agent Cloud tools # Tool Availability Real-time tool status from the production gateway. Use `get_status` or the capabilities endpoint to verify at any time. **Two free tools** — `get_status` and `echo` — require no payment. Use them to test authentication and connectivity before depositing funds. ## Active Tools These tools are live in production and callable via the API: | Tool | Description | Billable | Status | | :--------------------- | :---------------------------------------------- | :------- | :---------- | | `inference_chat` | AI completions with 100+ models | ✅ Yes | ✅ Available | | `optify_vram_estimate` | Estimate VRAM requirements for GPU pods | ✅ Yes | ✅ Available | | `sandbox_execute` | Execute code in secure isolated environment | ✅ Yes | ✅ Available | | `sandbox_cancel` | Cancel a running sandbox execution | ❌ No | ✅ Available | | `get_status` | System status, version, and agent balance | ❌ No | ✅ Available | | `echo` | Echo back params — validate auth & connectivity | ❌ No | ✅ Available | ## Roadmap | Tool | Description | Status | | :------------------ | :-------------------------- | :------------- | | `serverless_deploy` | Deploy serverless functions | 🔧 Upgrading | | `serverless_invoke` | Invoke serverless functions | 🔧 Upgrading | | `serverless_cancel` | Cancel serverless jobs | 🔧 Upgrading | | `gpu_provision` | Provision dedicated GPU pod | 🔜 Coming Soon | | `gpu_heartbeat` | Extend GPU lease | 🔜 Coming Soon | | `gpu_extend` | Extend GPU runtime | 🔜 Coming Soon | | `gpu_status` | Check GPU pod status | 🔜 Coming Soon | | `gpu_terminate` | Terminate GPU pod | 🔜 Coming Soon | | `rag_query` | Query knowledge bases | 🔜 Coming Soon | | `rag_ingest` | Ingest documents | 🔜 Coming Soon | | `rag_delete` | Delete documents | 🔜 Coming Soon | ## Check Live Status Query the capabilities endpoint to get the current tool list directly from the gateway: ```bash theme={null} curl -s https://agent.asgcompute.com/mcp/capabilities | jq '.tools[] | {name, status, billable}' ``` # Why ASG? Source: https://docs.asgcompute.com/guide/why-asg What makes agent-native infrastructure different # Why ASG Agent Cloud? ## The Problem: Clouds Built for Humans Today's cloud infrastructure was designed for **human developers**: | Human Cloud | Problem for Agents | | :----------------- | :------------------------------ | | Registration forms | Agents can't type | | Credit cards | Agents don't have bank accounts | | Hourly minimums | Agents need micro-transactions | | 30-day billing | Agents need instant settlement | | REST APIs | Agents speak protocols | ## The Solution: Infrastructure for Agents ASG Agent Cloud is **purpose-built** for the agent economy: ### 1. Native Protocol Agents connect via **MCP (Model Context Protocol)** — the emerging standard for agent-to-service communication. No HTTP wrappers, no API translations. ### 2. Instant Access No registration. No waiting. No approval queues. Connect → Pay → Compute → Receipt All in one request. ### 3. Micro-Payments Pay exactly for what you use: * Per-token inference * Per-second compute * Per-request execution No minimums. No commitments. ### 4. Gasless USDC Agents pay in **USDC on Solana**. We cover all transaction fees. You only need USDC — no SOL required. ### 5. White-Label Ready Build products on ASG without exposing our brand. Everything is labeled as your service. *** ## Comparison | Feature | Traditional Cloud | ASG Agent Cloud | | :--------- | :---------------- | :-------------- | | Onboarding | Days/Weeks | Instant | | Payment | Credit Card | USDC | | Billing | Monthly | Per-request | | Protocol | REST/GraphQL | MCP | | Minimums | Hourly | None | | Settlement | 30 days | Instant | *** ## Who Uses ASG? * **AI Agent Developers** — Build autonomous agents with compute access * **AI Product Companies** — Embed compute capabilities in products * **Research Labs** — Scale experiments without infrastructure overhead # ASG Agent Cloud Source: https://docs.asgcompute.com/introduction Agent-Native AI Infrastructure — GPUs, Inference, and Compute that speak MCP # Welcome to ASG Agent Cloud ASG Agent Cloud ASG Agent Cloud ## What is ASG Agent Cloud? ASG Agent Cloud is **infrastructure designed for AI agents**. Unlike traditional clouds built for humans, ASG speaks the native language of agents: * **MCP Protocol** — Connect via Model Context Protocol * **Gasless USDC** — Pay per request, we cover the fees * **Instant Access** — No registration, no credit cards, no wait ## Quick Links Call your first tool in under 5 minutes What makes agent-native infrastructure different Pay-per-use with micro-USD precision Full tool and endpoint documentation ## Available Services | Service | Description | Status | | :----------------- | :------------------------------ | :------------- | | **ASG Inference** | AI completions with 100+ models | ✅ Available | | **ASG Sandbox** | Isolated code execution | ✅ Available | | **Optify VRAM** | GPU VRAM estimation | ✅ Available | | **ASG Serverless** | Run async jobs in the cloud | 🔧 Upgrading | | **ASG GPU** | Dedicated H100/A100 pods | 🔜 Coming Soon | ## The Agent Economy Starts Here ASG Agent Cloud is the foundation for the next generation of autonomous AI applications. Built on Solana for instant, low-cost payments and designed from the ground up for agent-to-agent commerce. ## Frequently Asked Questions No sign-up form required. Create an API key in the [Console](https://agent.asgcompute.com/console) and start calling tools immediately. Currently **USDC on Solana**. We cover all transaction fees (gasless). There is no subscription tier — ASG is **pay-per-use** with no minimums. However, free tools (`get_status`, `echo`) are available to verify connectivity and test authentication before depositing funds. See [Tool Availability](/guide/tool-availability). Both! While optimized for agents, the API works for any client that speaks MCP or REST. Learn about our security practices and vulnerability disclosure policy # Payment Contract Source: https://docs.asgcompute.com/payment-contract Canonical 402 payment contract for ASG Agent Cloud # Payment Contract Reference Every paid tool call on ASG follows the **402 Payment Required** flow. This document describes the canonical response shape that agents must parse to build Solana payment instructions. ## 402 Response Shape When an agent calls a tool without payment, the gateway returns: ```json theme={null} { "code": "PAYMENT_REQUIRED", "message": "Payment required to execute tool", "request_id": "req_abc123", "quote": { "quote_id": "qt_xyz789", "tool": "inference_chat", "price_usdc_microusd": 2400, "price_display": "$0.0024", "ttl_seconds": 300, "expires_at": "2026-02-08T10:05:00Z" }, "payment_instructions": { "network": "solana-mainnet", "asset": "USDC", "pay_to": "ATA_ADDRESS_HERE", "destination": "ATA_ADDRESS_HERE", "usdc_mint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v", "memo_format": "asg:{quote_id}", "methods": ["transfer", "solana_pay"], "x402_header_format": "base64url(JSON({tx_signature, quote_id}))", "gasless_supported": true, "payment_methods": ["wallet", "gasless"] }, "step_id": "step_001", "retry": { "method": "POST", "headers": { "X-Payment": "" } } } ``` ## Field Reference | Field | Type | Description | | :------------------ | :--------- | :------------------------------------- | | `network` | `string` | Always `solana-mainnet` | | `asset` | `string` | Always `USDC` | | `pay_to` | `string` | Treasury USDC token account (ATA) | | `destination` | `string` | Same as `pay_to` (alias) | | `usdc_mint` | `string` | USDC SPL token mint address | | `memo_format` | `string` | Required memo: `asg:{quote_id}` | | `methods` | `string[]` | Supported: `transfer`, `solana_pay` | | `gasless_supported` | `boolean` | Whether gasless relay is available | | `payment_methods` | `string[]` | `wallet` (direct) or `gasless` (relay) | ## Payment Flow ``` Agent ASG Gateway Solana │ │ │ │── POST /mcp (tool call) ────►│ │ │◄── 402 + quote + pay_to ─────│ │ │ │ │ │── Build USDC transfer ──────────────────────────────────►│ │ (to pay_to, memo: asg:{quote_id}) │ │◄── tx_signature ────────────────────────────────────────│ │ │ │ │── POST /mcp (same call) ────►│ │ │ X-Payment: base64({ │ │ │ tx_signature, quote_id │ │ │ }) │── Verify on-chain ────────►│ │ │◄── Confirmed ──────────────│ │◄── 200 + result + receipt ───│ │ ``` ## X-Payment Header The retry request must include `X-Payment` header with base64url-encoded JSON: ```json theme={null} { "tx_signature": "5Uj3...", "quote_id": "qt_xyz789" } ``` ## Important Notes * **Network**: Only `solana-mainnet` is supported. All payments must use Solana mainnet USDC. * **Gasless**: ASG covers Solana transaction fees. Agents only need USDC — no SOL required. * **TTL**: Quotes expire after `ttl_seconds` (default 300s / 5 min). Expired quotes return `QUOTE_EXPIRED`. * **Idempotency**: Re-submitting the same `X-Payment` header returns the cached result without re-charging. * **Base URL**: `https://agent.asgcompute.com` # Changelog Source: https://docs.asgcompute.com/resources/changelog ASG release history # Changelog All notable changes to ASG Agent Cloud. ## v5.1.0 — 2026-02-01 ### Added * 🚀 Public Beta launch * 💳 Gasless USDC payments on Solana * 🤖 MCP protocol support * 🎯 Four core services: Inference, Serverless, GPU, Sandbox * 📊 Receipt system with automatic refunds ### Services * **Inference:** 100+ models via `asg-fast`, `asg-balanced`, `asg-powerful` * **Serverless:** Python 3.11 and Node 18 runtimes * **GPU:** RTX 4090, A100, H100 pods * **Sandbox:** Isolated code execution *** ## v5.0.0 — 2026-01-15 (Internal) ### Added * Core billing infrastructure * Control plane with budget enforcement * Gateway with rate limiting * White-label compliance *** ## Versioning ASG follows [Semantic Versioning](https://semver.org/): * **Major:** Breaking changes * **Minor:** New features (backwards compatible) * **Patch:** Bug fixes ## Subscribe For release notifications, watch our [GitHub repository](https://github.com/ASGCompute). # Glossary Source: https://docs.asgcompute.com/resources/glossary ASG terminology reference # Glossary Key terms and concepts used in ASG Agent Cloud. ## A ### Agent An autonomous AI system that can call tools, make decisions, and execute tasks without continuous human intervention. ## B ### Budget Maximum spend limit for a Run or Step. Prevents runaway costs. ## G ### Gasless Payment model where ASG covers Solana transaction fees. Users only need USDC. ## I ### Idempotency Key Unique identifier ensuring a request is processed only once, even if retried. ## L ### Lease A timed allocation of GPU resources. Requires heartbeat to maintain. ## M ### MCP (Model Context Protocol) Standard protocol for agent-to-service communication. Used by ASG for all tool interactions. ### microusd 1/1,000,000 of a USD. ASG uses microusd for precise billing. * 1 USD = 1,000,000 microusd * \$0.01 = 10,000 microusd ## Q ### Quote A price commitment for a specific request with an expiration time. ## R ### Receipt Proof of completed work, including actual cost and refund (if any). ### Run Container for related work. Has a budget, TTL, and contains Steps. ## S ### Step Single tool execution within a Run. Generates one Receipt. ## T ### TTL (Time-to-Live) Expiration time for resources (quotes, leases, runs). ## U ### USDC USD Coin — the stablecoin used for all ASG payments on Solana. # Roadmap Source: https://docs.asgcompute.com/resources/roadmap What's coming to ASG # Roadmap Our planned features and improvements. ## Q1 2026 | Feature | Status | | :----------------------- | :----- | | Public Beta | ✅ Live | | Gasless USDC | ✅ Live | | MCP Protocol | ✅ Live | | Inference (100+ models) | ✅ Live | | Sandbox (code execution) | ✅ Live | | VRAM Estimation | ✅ Live | ## Q2 2026 | Feature | Status | | :------------------- | :---------------- | | TypeScript SDK | 🔜 In Development | | Serverless Functions | 🔜 In Development | | GPU Pods | 🔜 In Development | | RAG Service | 📋 Planned | ## Q3 2026 | Feature | Status | | :---------------- | :--------- | | Python SDK | 📋 Planned | | Multi-region (EU) | 📋 Planned | | Enterprise SLA | 📋 Planned | | Custom models | 📋 Planned | ## Long-term * **x402 Protocol:** HTTP-native payment protocol * **Agent Identity:** Portable agent credentials * **Agent Marketplace:** Discover and monetize agents * **Federated Compute:** Multi-provider infrastructure *** ## Feedback Have a feature request? We'd love to hear from you. Contact: [feedback@asgcompute.com](mailto:feedback@asgcompute.com) Roadmap is subject to change based on user feedback and priorities. # Examples Source: https://docs.asgcompute.com/sdk/examples Working examples with the ASG REST API # Examples Practical examples for common use cases using `fetch()`. These examples use the **JSON-RPC** endpoint (`/mcp`). For the simpler **REST** endpoint (`/v1/mcp/tools/call`), see the [Python SDK](/sdk/python). ## Basic Inference ```typescript theme={null} const ASG = 'https://agent.asgcompute.com/mcp'; const API_KEY = process.env.ASG_API_KEY!; // Simple completion (returns 402 with quote first) const response = await fetch(ASG, { method: 'POST', headers: { 'Content-Type': 'application/json', 'Authorization': `Bearer ${API_KEY}` }, body: JSON.stringify({ jsonrpc: '2.0', id: 1, method: 'tools/call', params: { name: 'inference_chat', arguments: { model: 'openai/gpt-4o-mini', messages: [ { role: 'system', content: 'You are a helpful assistant.' }, { role: 'user', content: 'What is the capital of France?' } ] } } }) }); const data = await response.json(); // If 402: data.payment_instructions has { pay_to, usdc_mint, network } // If 200: data.result.content = "The capital of France is Paris." ``` ## Multi-turn Conversation ```typescript theme={null} const messages: Array<{ role: string; content: string }> = []; async function chat(userMessage: string, paymentProof?: string) { messages.push({ role: 'user', content: userMessage }); const headers: Record = { 'Content-Type': 'application/json', 'Authorization': `Bearer ${API_KEY}` }; if (paymentProof) { headers['X-Payment'] = paymentProof; } const response = await fetch(ASG, { method: 'POST', headers, body: JSON.stringify({ jsonrpc: '2.0', id: 1, method: 'tools/call', params: { name: 'inference_chat', arguments: { model: 'anthropic/claude-sonnet-4', messages } } }) }); const data = await response.json(); if (response.status === 200) { messages.push({ role: 'assistant', content: data.result.content }); return data.result.content; } return data; // 402 quote } ``` ## Code Execution (Sandbox) ```typescript theme={null} const response = await fetch(ASG, { method: 'POST', headers: { 'Content-Type': 'application/json', 'Authorization': `Bearer ${API_KEY}`, 'X-Payment': paymentProof }, body: JSON.stringify({ jsonrpc: '2.0', id: 1, method: 'tools/call', params: { name: 'sandbox_execute', arguments: { language: 'python', code: ` import json data = {"users": 100, "active": 85} print(json.dumps(data, indent=2)) ` } } }) }); const result = await response.json(); console.log(result.result.stdout); ``` ## Batch Processing ```typescript theme={null} // Process items with concurrency control async function processBatch(items: string[], paymentProofs: string[]) { const results = []; const concurrency = 3; for (let i = 0; i < items.length; i += concurrency) { const batch = items.slice(i, i + concurrency); const proofs = paymentProofs.slice(i, i + concurrency); const promises = batch.map((item, j) => fetch(ASG, { method: 'POST', headers: { 'Content-Type': 'application/json', 'Authorization': `Bearer ${API_KEY}`, 'X-Payment': proofs[j] }, body: JSON.stringify({ jsonrpc: '2.0', id: i + j + 1, method: 'tools/call', params: { name: 'inference_chat', arguments: { model: 'openai/gpt-4o-mini', messages: [{ role: 'user', content: `Summarize: ${item}` }] } } }) }).then(r => r.json()) ); results.push(...await Promise.all(promises)); } return results; } ``` ## Budget Protection ```typescript theme={null} // Track spending within a budget let totalSpent = 0; const budget = 5_000_000; // $5 in microusd async function safeCall(name: string, args: Record) { // Step 1: Get quote (402 response) const quoteRes = await fetch(ASG, { method: 'POST', headers: { 'Content-Type': 'application/json', 'Authorization': `Bearer ${API_KEY}` }, body: JSON.stringify({ jsonrpc: '2.0', id: 1, method: 'tools/call', params: { name, arguments: args } }) }); const quote = await quoteRes.json(); const price = quote.quote.price_usdc_microusd; if (totalSpent + price > budget) { throw new Error(`Budget exceeded: spent ${totalSpent}, quote ${price}, limit ${budget}`); } // Step 2: Pay on Solana, then retry with proof // ... build and submit payment ... // Step 3: Track spending from receipt totalSpent += price; return quote; } ``` ## Error Recovery ```typescript theme={null} async function reliableCall(name: string, args: Record, maxRetries = 3) { for (let attempt = 0; attempt < maxRetries; attempt++) { try { const response = await fetch(ASG, { method: 'POST', headers: { 'Content-Type': 'application/json', 'Authorization': `Bearer ${API_KEY}` }, body: JSON.stringify({ jsonrpc: '2.0', id: 1, method: 'tools/call', params: { name, arguments: args } }) }); const data = await response.json(); if (data.error?.code === 'QUOTE_EXPIRED') { continue; // Retry to get fresh quote } if (data.error?.code === 'RATE_LIMITED') { await new Promise(r => setTimeout(r, 1000 * (attempt + 1))); continue; } return data; } catch (err) { if (attempt === maxRetries - 1) throw err; } } throw new Error('Max retries exceeded'); } ``` # Python Integration Source: https://docs.asgcompute.com/sdk/python Integrating ASG Agent Cloud with Python # Python Integration An official Python SDK is on the roadmap. For now, use the REST API directly with `requests`. The examples below show you how. These examples use the **REST** endpoint (`/v1/mcp/tools/call`), which is the recommended default. For the **JSON-RPC** endpoint (`/mcp`) used by MCP-native frameworks, see the [TypeScript SDK](/sdk/typescript). Both use the same API key authentication. ## Quick Start Install `requests` (if you haven't already) and set your API key: ```bash theme={null} pip install requests export ASG_API_KEY="your-api-key" ``` Verify connectivity with a free tool — no payment required: ```python theme={null} import os import requests ASG_ENDPOINT = "https://agent.asgcompute.com/v1/mcp/tools/call" API_KEY = os.environ["ASG_API_KEY"] HEADERS = { "Content-Type": "application/json", "Authorization": f"Bearer {API_KEY}", } # Free tool — no payment needed response = requests.post( ASG_ENDPOINT, headers=HEADERS, json={ "tool": "get_status", "arguments": {}, }, ) print(response.status_code) # 200 print(response.json()) # {"result": {"status": "operational", "version": "5.2.3"}} ``` ## Call a Tool Most tools are paid. The flow is: **call → receive 402 quote → pay on Solana → retry with proof**. ```python theme={null} import os import json import base64 from uuid import uuid4 import requests ASG_ENDPOINT = "https://agent.asgcompute.com/v1/mcp/tools/call" API_KEY = os.environ["ASG_API_KEY"] HEADERS = { "Content-Type": "application/json", "Authorization": f"Bearer {API_KEY}", } def call_tool(name: str, arguments: dict) -> dict: """Call an ASG tool. Returns result on 200, or quote on 402.""" response = requests.post( ASG_ENDPOINT, headers=HEADERS, json={"tool": name, "arguments": arguments}, ) if response.status_code == 402: quote = response.json() # quote["payment_instructions"] has pay_to, usdc_mint, network print(f"Payment required: {quote['quote']['price_display']}") return quote response.raise_for_status() return response.json() def call_tool_with_payment( name: str, arguments: dict, tx_signature: str, quote_id: str, ) -> dict: """Retry a tool call with Solana payment proof via X-Payment header.""" payment_proof = base64.urlsafe_b64encode( json.dumps({ "tx_signature": tx_signature, "quote_id": quote_id, }).encode() ).decode() headers = {**HEADERS, "X-Payment": payment_proof} response = requests.post( ASG_ENDPOINT, headers=headers, json={"tool": name, "arguments": arguments}, ) response.raise_for_status() return response.json() ``` ## Inference Chat Use the `inference_chat` tool for LLM completions: ```python theme={null} # Step 1: Get a quote quote = call_tool("inference_chat", { "model": "openai/gpt-4o-mini", "messages": [{"role": "user", "content": "What is the capital of France?"}], }) print(f"Price: {quote['quote']['price_display']}") # "Price: $0.0024" # Step 2: After paying on Solana, retry with proof result = call_tool_with_payment( "inference_chat", { "model": "openai/gpt-4o-mini", "messages": [{"role": "user", "content": "What is the capital of France?"}], }, tx_signature="5Uj3...", quote_id=quote["quote"]["id"], ) print(result["result"]["content"]) # [{"type": "text", "text": "The capital of France is Paris."}] ``` ## Code Execution (Sandbox) Run Python code in a secure sandbox: ```python theme={null} code = """ import math primes = [n for n in range(2, 50) if all(n % i for i in range(2, int(math.sqrt(n)) + 1))] print(primes) """ quote = call_tool("sandbox_execute", { "code": code, "language": "python", }) # Pay on Solana, then retry with proof: result = call_tool_with_payment( "sandbox_execute", {"code": code, "language": "python"}, tx_signature="4xK9...", quote_id=quote["quote"]["id"], ) print(result["result"]["content"]) # [{"type": "text", "text": "[2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47]"}] ``` ## Multi-turn Chat Maintain conversation history with a helper class: ```python theme={null} import os import json import base64 from uuid import uuid4 import requests class ASGChat: """Multi-turn chat session with message history.""" def __init__( self, model: str = "openai/gpt-4o-mini", system_prompt: str | None = None, ) -> None: self.model = model self.messages: list[dict] = [] self.endpoint = "https://agent.asgcompute.com/v1/mcp/tools/call" self.headers = { "Content-Type": "application/json", "Authorization": f"Bearer {os.environ['ASG_API_KEY']}", } if system_prompt: self.messages.append({"role": "system", "content": system_prompt}) def get_quote(self, user_message: str) -> dict: """Send a message and get a payment quote (402).""" self.messages.append({"role": "user", "content": user_message}) response = requests.post( self.endpoint, headers=self.headers, json={ "tool": "inference_chat", "arguments": { "model": self.model, "messages": self.messages, }, }, ) if response.status_code == 402: return response.json() response.raise_for_status() return response.json() def send_with_payment( self, tx_signature: str, quote_id: str, ) -> str: """Complete the call with payment proof and return assistant reply.""" payment_proof = base64.urlsafe_b64encode( json.dumps({ "tx_signature": tx_signature, "quote_id": quote_id, }).encode() ).decode() headers = {**self.headers, "X-Payment": payment_proof} response = requests.post( self.endpoint, headers=headers, json={ "tool": "inference_chat", "arguments": { "model": self.model, "messages": self.messages, }, }, ) response.raise_for_status() data = response.json() assistant_text = data["result"]["content"][0]["text"] self.messages.append({"role": "assistant", "content": assistant_text}) return assistant_text # Usage chat = ASGChat(system_prompt="You are a helpful coding assistant.") quote = chat.get_quote("How do I read a CSV in Python?") print(f"Price: {quote['quote']['price_display']}") # After paying on Solana: reply = chat.send_with_payment( tx_signature="3xR7...", quote_id=quote["quote"]["id"], ) print(reply) # Continue the conversation — history is preserved quote2 = chat.get_quote("Now show me how to filter rows.") ``` ## Budget Protection Track spending and enforce limits to prevent runaway costs: ```python theme={null} from dataclasses import dataclass, field @dataclass class BudgetTracker: """Track ASG spending with enforced limits (in microUSD).""" limit_microusd: int # e.g. 5_000_000 = $5.00 spent_microusd: int = 0 calls: list[dict] = field(default_factory=list) @property def remaining_microusd(self) -> int: return self.limit_microusd - self.spent_microusd @property def remaining_display(self) -> str: return f"${self.remaining_microusd / 1_000_000:.4f}" def check_quote(self, quote: dict) -> bool: """Return True if the quote is within budget.""" price = quote["quote"]["price_microusd"] return price <= self.remaining_microusd def record_spend(self, quote: dict, tx_signature: str) -> None: """Record a completed payment.""" price = quote["quote"]["price_microusd"] self.spent_microusd += price self.calls.append({ "tool": quote["quote"]["tool"], "price_microusd": price, "tx_signature": tx_signature, }) # Usage budget = BudgetTracker(limit_microusd=5_000_000) # $5.00 limit quote = call_tool("inference_chat", { "model": "openai/gpt-4o-mini", "messages": [{"role": "user", "content": "Hello!"}], }) if budget.check_quote(quote): # Safe to pay — proceed with Solana transfer result = call_tool_with_payment( "inference_chat", { "model": "openai/gpt-4o-mini", "messages": [{"role": "user", "content": "Hello!"}], }, tx_signature="2kP5...", quote_id=quote["quote"]["id"], ) budget.record_spend(quote, tx_signature="2kP5...") print(f"Remaining budget: {budget.remaining_display}") else: print( f"Over budget! Need {quote['quote']['price_display']}, " f"only {budget.remaining_display} left." ) ``` ## Async with httpx This section uses `httpx` for async HTTP. Install it with `pip install httpx`. The `requests` library (used above) does not support async. ```python theme={null} import os import asyncio import httpx ASG_ENDPOINT = "https://agent.asgcompute.com/v1/mcp/tools/call" HEADERS = { "Content-Type": "application/json", "Authorization": f"Bearer {os.environ['ASG_API_KEY']}", } async def call_tool_async( client: httpx.AsyncClient, name: str, arguments: dict, ) -> dict: """Async tool call using httpx.""" response = await client.post( ASG_ENDPOINT, headers=HEADERS, json={"tool": name, "arguments": arguments}, ) return response.json() async def batch_status_check(tools: list[str]) -> list[dict]: """Check multiple tools concurrently.""" async with httpx.AsyncClient(timeout=30.0) as client: tasks = [ call_tool_async(client, tool, {}) for tool in tools ] return await asyncio.gather(*tasks) # Run batch check results = asyncio.run(batch_status_check(["get_status", "echo"])) for r in results: print(r) ``` ## Error Handling Handle transient errors with exponential backoff: ```python theme={null} import time import requests def reliable_call( name: str, arguments: dict, max_retries: int = 3, ) -> dict: """Call a tool with automatic retry and exponential backoff.""" for attempt in range(max_retries): try: response = requests.post( ASG_ENDPOINT, headers=HEADERS, json={"tool": name, "arguments": arguments}, timeout=30, ) data = response.json() # Handle specific error codes if data.get("error", {}).get("code") == "QUOTE_EXPIRED": print("Quote expired, retrying with fresh quote...") continue if data.get("error", {}).get("code") == "RATE_LIMITED": wait = 2 ** attempt # Exponential backoff: 1s, 2s, 4s print(f"Rate limited, waiting {wait}s...") time.sleep(wait) continue if response.status_code == 401: raise ValueError("Invalid API key — check ASG_API_KEY") return data except requests.ConnectionError: if attempt == max_retries - 1: raise time.sleep(2 ** attempt) raise RuntimeError(f"Failed after {max_retries} retries") ``` ## MCP Integration Use the JSON-RPC endpoint directly for MCP-native agent integrations: ```python theme={null} import os import asyncio import httpx MCP_ENDPOINT = "https://agent.asgcompute.com/mcp" HEADERS = { "Content-Type": "application/json", "Authorization": f"Bearer {os.environ['ASG_API_KEY']}", } async def mcp_request( client: httpx.AsyncClient, method: str, params: dict | None = None, ) -> dict: """Send a JSON-RPC request to the MCP endpoint.""" response = await client.post( MCP_ENDPOINT, headers=HEADERS, json={ "jsonrpc": "2.0", "id": 1, "method": method, "params": params or {}, }, ) return response.json() async def main() -> None: async with httpx.AsyncClient(timeout=30.0) as client: # List available tools tools_response = await mcp_request(client, "tools/list") tools = tools_response["result"]["tools"] for tool in tools: print(f" {tool['name']}: {tool['description']}") # Call a free tool via JSON-RPC result = await mcp_request( client, "tools/call", {"name": "get_status", "arguments": {}}, ) print(result) asyncio.run(main()) ``` ## Next Steps Working examples for common use cases Full agent onboarding in under 2 minutes Complete API documentation Detailed Solana payment guide # TypeScript Integration Source: https://docs.asgcompute.com/sdk/typescript Integrating ASG Agent Cloud with TypeScript # TypeScript Integration An official TypeScript SDK is on the roadmap. For now, use the REST API directly with `fetch()`. The examples below show you how. **Which endpoint?** ASG exposes two protocols: * **REST** (`/v1/mcp/tools/call`) — recommended for quickstart and most integrations. See [Python SDK](/sdk/python) for REST examples. * **JSON-RPC** (`/mcp`) — for MCP-native agent frameworks. The examples on this page use JSON-RPC since TypeScript is the primary MCP SDK language. Both require the same `Authorization: Bearer ` header. ## Quick Start ```typescript theme={null} const ASG_ENDPOINT = 'https://agent.asgcompute.com/mcp'; const API_KEY = process.env.ASG_API_KEY!; // Step 1: Call a tool (will return 402 with quote) async function callTool(name: string, args: Record) { const response = await fetch(ASG_ENDPOINT, { method: 'POST', headers: { 'Content-Type': 'application/json', 'Authorization': `Bearer ${API_KEY}` }, body: JSON.stringify({ jsonrpc: '2.0', id: 1, method: 'tools/call', params: { name, arguments: args } }) }); if (response.status === 402) { const quote = await response.json(); // quote.payment_instructions has pay_to, usdc_mint, network // Build and submit Solana USDC transfer, then retry: return quote; } return response.json(); } // Step 2: Retry with payment proof async function callToolWithPayment( name: string, args: Record, paymentProof: string // base64url-encoded JSON ) { const response = await fetch(ASG_ENDPOINT, { method: 'POST', headers: { 'Content-Type': 'application/json', 'Authorization': `Bearer ${API_KEY}`, 'X-Payment': paymentProof }, body: JSON.stringify({ jsonrpc: '2.0', id: 1, method: 'tools/call', params: { name, arguments: args } }) }); return response.json(); } ``` ## List Available Tools ```typescript theme={null} async function listTools() { const response = await fetch(ASG_ENDPOINT, { method: 'POST', headers: { 'Content-Type': 'application/json', 'Authorization': `Bearer ${API_KEY}` }, body: JSON.stringify({ jsonrpc: '2.0', id: 1, method: 'tools/list' }) }); const data = await response.json(); return data.result.tools; // [{ name: 'inference_chat', description: '...' }, ...] } ``` ## Inference Example ```typescript theme={null} // Get a quote for inference const quote = await callTool('inference_chat', { model: 'openai/gpt-4o-mini', messages: [{ role: 'user', content: 'Hello!' }] }); console.log(`Price: ${quote.quote.price_display}`); // "Price: $0.0024" // After paying on Solana, retry with X-Payment header const result = await callToolWithPayment( 'inference_chat', { model: 'openai/gpt-4o-mini', messages: [{ role: 'user', content: 'Hello!' }] }, paymentProof ); console.log(result.result.content); ``` ## Error Handling ```typescript theme={null} async function reliableCall(name: string, args: Record, maxRetries = 3) { for (let attempt = 0; attempt < maxRetries; attempt++) { try { const response = await fetch(ASG_ENDPOINT, { method: 'POST', headers: { 'Content-Type': 'application/json', 'Authorization': `Bearer ${API_KEY}` }, body: JSON.stringify({ jsonrpc: '2.0', id: 1, method: 'tools/call', params: { name, arguments: args } }) }); const data = await response.json(); if (data.error?.code === 'QUOTE_EXPIRED') { continue; // Retry with fresh quote } if (data.error?.code === 'RATE_LIMITED') { await new Promise(r => setTimeout(r, 1000 * (attempt + 1))); continue; } return data; } catch (err) { if (attempt === maxRetries - 1) throw err; } } throw new Error('Max retries exceeded'); } ``` ## Payment Proof Format The `X-Payment` header contains a base64url-encoded JSON object: ```typescript theme={null} const paymentProof = btoa(JSON.stringify({ tx_signature: '5Uj3...', // Solana transaction signature quote_id: 'qt_xyz789' // Quote ID from 402 response })); ``` ## Next Steps More working examples Complete API documentation # Agent Authentication Contract Source: https://docs.asgcompute.com/security/agent-auth-contract ASG Agent Cloud v5.2.x API Key authentication specification # Agent Authentication Contract This document defines the authentication contract for programmatic (agent/bot) access to ASG Agent Cloud. ## Authentication Hierarchy ASG Gateway supports two authentication methods, evaluated in order: 1. **SIWS Session Cookie** (`asg_session`) — For console UI users 2. **Bearer Token API Key** — For agents and programmatic access ``` Authorization: Bearer asc_sk_... ``` ## API Key Format | Prefix | Environment | Example | | -------------- | ----------- | ----------------------- | | `asc_sk_live_` | Production | `asc_sk_live_abc123...` | | `asc_sk_test_` | Staging/Dev | `asc_sk_test_xyz789...` | Keys are 64-character random strings prefixed with environment indicator. ## Security Model ### Key Storage * **Plain-text key**: Shown ONCE at creation time — user must save it * **Server stores**: BCrypt hash only (cost=10) * **No recovery**: Lost keys cannot be retrieved; user must rotate ### Scopes | Scope | Description | | ------ | --------------------------------------------------- | | `read` | Query balance, history, usage stats (default) | | `fund` | Initiate deposits, manage billing (requires opt-in) | ### Rate Limits | Tier | RPM Limit | Default | | ---- | --------- | ------- | | Free | 60 | ✓ | | Plus | 300 | | | Pro | 1000 | | Limits are per-key, not per-wallet. 429 responses include `Retry-After` header. ## Endpoints (Billing Plane) ### Create Key ```http theme={null} POST /keys Content-Type: application/json Cookie: asg_session=... { "name": "My Agent Bot", "scopes": ["read"], "rate_limit_rpm": 60 } ``` **Response (201):** ```json theme={null} { "key_id": "key_abc123", "api_key": "asc_sk_live_...", // ⚠️ SHOW ONCE "name": "My Agent Bot", "scopes": ["read"], "rate_limit_rpm": 60, "created_at": "2026-02-03T12:00:00Z" } ``` ### List Keys ```http theme={null} GET /keys Cookie: asg_session=... ``` **Response:** ```json theme={null} { "keys": [ { "key_id": "key_abc123", "name": "My Agent Bot", "prefix": "asc_sk_live_abc...", // First 16 chars only "scopes": ["read"], "rate_limit_rpm": 60, "last_used_at": "2026-02-03T11:30:00Z", "created_at": "2026-02-03T10:00:00Z" } ] } ``` ### Revoke Key ```http theme={null} DELETE /keys/:key_id Cookie: asg_session=... ``` ### Rotate Key ```http theme={null} POST /keys/:key_id/rotate Cookie: asg_session=... ``` **Response:** New key object (same as Create) ### Validate Key (Internal) ```http theme={null} POST /keys/validate Content-Type: application/json { "api_key": "asc_sk_live_..." } ``` **Response:** ```json theme={null} { "valid": true, "key_id": "key_abc123", "owner_wallet": "ABC...xyz", "scopes": ["read"], "rate_limit_rpm": 60 } ``` ## Gateway Auth Middleware The gateway validates keys via billing-plane `/keys/validate` with 5-minute caching. ```typescript theme={null} // Request gets decorated with: interface AuthenticatedRequest extends Request { apiKeyId?: string; // e.g., "key_abc123" ownerWallet?: string; // Wallet that created the key scopes?: string[]; // ["read"] or ["read", "fund"] rateLimitRpm?: number; // Per-key rate limit } ``` ## Error Responses | Status | Code | Description | | ------ | -------------- | -------------------------- | | 401 | `UNAUTHORIZED` | Missing or invalid API key | | 403 | `FORBIDDEN` | Missing required scope | | 429 | `RATE_LIMITED` | Rate limit exceeded | ## Usage Example (Agent) ```typescript theme={null} const response = await fetch('https://agent.asgcompute.com/v1/account/balance', { headers: { 'Authorization': 'Bearer asc_sk_live_your_key_here', 'Content-Type': 'application/json' } }); if (response.status === 401) { // Re-authenticate or refresh key } const balance = await response.json(); ``` ## Related Documents * [Quickstart for Agents](/docs/guide/agent-quickstart) * [Rate Limiting](/docs/security/rate-limits) * [Error Codes](/docs/api/errors) # Authentication Source: https://docs.asgcompute.com/security/authentication API-key authentication for ASG Agent Cloud # Authentication ASG uses **API keys** for authentication. Create a key in the [Console](https://agent.asgcompute.com/console), set it as an environment variable, and include it as a Bearer token in every request. ## Quick Setup 1. **Create an API key** at [agent.asgcompute.com/console](https://agent.asgcompute.com/console) → API Keys → Create Key 2. **Set your environment variable:** ```bash theme={null} export ASG_API_KEY="sk-agent-..." ``` 3. **Include in requests:** ```bash theme={null} Authorization: Bearer $ASG_API_KEY ``` ## Verify Connectivity Test with a free tool — no payment required: ```bash curl theme={null} curl -s https://agent.asgcompute.com/v1/mcp/tools/call \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $ASG_API_KEY" \ -d '{"tool": "get_status", "arguments": {}}' ``` ```python Python theme={null} import os, requests response = requests.post( "https://agent.asgcompute.com/v1/mcp/tools/call", headers={ "Content-Type": "application/json", "Authorization": f"Bearer {os.environ['ASG_API_KEY']}", }, json={"tool": "get_status", "arguments": {}}, ) print(response.json()) ``` ```typescript TypeScript theme={null} const response = await fetch('https://agent.asgcompute.com/v1/mcp/tools/call', { method: 'POST', headers: { 'Content-Type': 'application/json', 'Authorization': `Bearer ${process.env.ASG_API_KEY}` }, body: JSON.stringify({ tool: 'get_status', arguments: {} }) }); console.log(await response.json()); ``` ## Key Security **Never share your API key.** Treat `sk-agent-*` keys like passwords. If compromised, revoke immediately in the Console and create a new key. | Practice | Recommendation | | :--------- | :------------------------------------------------------------- | | Storage | Environment variable or secrets manager — never in source code | | Rotation | Rotate keys periodically; revoke unused keys | | Scope | Each agent/integration should use its own key | | Monitoring | Check usage in the Console to detect anomalies | ## Auth vs. Payment ASG separates **authentication** (who you are) from **payment** (how you pay): | Concern | Mechanism | | :------- | :----------------------------------------------------------------- | | Identity | API key via `Authorization: Bearer ` | | Payment | Solana USDC via 402 quote → on-chain transfer → `X-Payment` header | Free tools (`get_status`, `echo`, `sandbox_cancel`) require only authentication — no payment step. ## MCP-Native Integration For MCP-compatible agent frameworks, use the JSON-RPC endpoint (`/mcp`) with the same Bearer header: ```bash theme={null} curl -s https://agent.asgcompute.com/mcp \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $ASG_API_KEY" \ -d '{ "jsonrpc": "2.0", "id": 1, "method": "tools/list" }' ``` ## Wallet Integration Your Solana wallet is used for **payments only** — not for authentication. Compatible wallets: * Phantom * Solflare * Backpack * CLI wallets (Solana CLI) # Data Handling Source: https://docs.asgcompute.com/security/data-handling How ASG handles your data # Data Handling Transparency about how we handle your data. ## Data Categories ### Request Data | Type | Stored | Retention | | :----------------- | :----- | :-------- | | Tool arguments | Logged | 30 days | | Payment signatures | Yes | Permanent | | IP addresses | Logged | 7 days | ### Execution Data | Type | Stored | Notes | | :---------------- | :----- | :------------------- | | Sandbox code | No | Ephemeral only | | Sandbox output | No | Returned, not stored | | GPU pod data | No | Your responsibility | | Inference prompts | Logged | For abuse prevention | | Inference outputs | No | Returned only | ### Billing Data | Type | Stored | Retention | | :--------------- | :----- | :--------------- | | Wallet addresses | Yes | Account lifetime | | Receipts | Yes | 90 days | | Payment amounts | Yes | Permanent | ## Encryption * **In Transit:** TLS 1.3 * **At Rest:** AES-256 ## Data Location Currently: US-West region only. ## Your Rights Under GDPR and CCPA, you can: * Request your data * Delete your account * Export your receipts Contact: [privacy@asgcompute.com](mailto:privacy@asgcompute.com) ## Third Parties We do not sell your data. Limited sharing for: * Compute providers (execution only) * Infrastructure (hosting) * Compliance (legal requirements) ## Logs Request logs are used for: * Debugging * Abuse prevention * Security monitoring Logs are automatically deleted after retention period. # Vulnerability Disclosure Source: https://docs.asgcompute.com/security/disclosure How to report security vulnerabilities # Vulnerability Disclosure We appreciate the security research community's efforts to improve our security. ## Reporting **Email:** [security@asgcompute.com](mailto:security@asgcompute.com) **Include:** * Detailed description * Steps to reproduce * Potential impact * Your contact info ## Response Timeline | Timeline | Action | | :----------- | :--------------------- | | **24 hours** | Acknowledgment | | **72 hours** | Initial assessment | | **7 days** | Status update | | **90 days** | Coordinated disclosure | ## Scope **In Scope:** * ASG Gateway * ASG Console * Payment systems * Authentication **Out of Scope:** * Third-party services * Social engineering * Physical security * DoS attacks ## Safe Harbor We will not pursue legal action against researchers who: * Report in good faith * Avoid privacy violations * Give reasonable response time * Don't exploit beyond PoC ## Recognition Contributors may be featured in our Hall of Fame and eligible for bounties. # Security Overview Source: https://docs.asgcompute.com/security/overview ASG security practices and architecture # Security Overview Security is foundational to ASG Agent Cloud. ## Core Principles ### 1. Non-Custodial We never hold your private keys. All transactions are signed client-side. ### 2. Isolated Execution All code runs in isolated environments: * Sandboxes have no network access (except allowlist) * GPU pods are isolated per-tenant * Serverless jobs run in ephemeral containers ### 3. Defense in Depth Multiple layers of security: * Network isolation * Rate limiting * Budget enforcement * Audit logging ## Data Handling | Data Type | Retention | Encryption | | :------------- | :------------ | :------------------- | | Request logs | 30 days | At rest + in transit | | Receipts | 90 days | At rest + in transit | | Code execution | 0 (ephemeral) | In transit only | ## Authentication Authentication is via API key: 1. Create an API key in the [Console](https://agent.asgcompute.com/console) 2. Include `Authorization: Bearer ` in every request 3. Your Solana wallet is used only for payments — not for auth No passwords, no sessions. See [Authentication](/security/authentication) for details. ## Infrastructure * **TLS 1.3** on all endpoints * **SOC2 Type II** compliance (in progress) * **Regular penetration testing** * **24/7 monitoring** ## Rate Limiting Built-in protection against abuse: * Per-key request limits * Concurrent execution limits * Budget caps per run ## Vulnerability Disclosure Found a vulnerability? Please report responsibly. Read our full security disclosure policy ## Compliance | Standard | Status | | :----------- | :---------- | | SOC2 Type II | In progress | | GDPR | Compliant | | CCPA | Compliant | ## Related API-key authentication How we handle your data # ASG GPU Source: https://docs.asgcompute.com/services/gpu Dedicated GPU pods for AI workloads — Coming Soon # ASG GPU **🔜 Coming Soon** — Dedicated GPU provisioning is on the roadmap. The tools described below are planned but not yet active. See [Tool Availability](/guide/tool-availability) for current status. Rent dedicated GPU instances on-demand with per-second billing via MCP tool calls. ## Planned Capabilities * **H100 80 GB, A100 80 GB, RTX 4090 24 GB** — Premium GPUs for every workload * **Per-second billing** — No hourly minimums, pay only for what you use * **Instant provisioning** — Target \<30 seconds from tool call to SSH * **SSH access** — Full root control of your pod * **Multi-GPU** — Scale to 8× GPU nodes for large training runs ## Planned Tools | Tool | Description | Status | | :-------------- | :------------------ | :------------- | | `gpu_provision` | Provision a GPU pod | 🔜 Coming Soon | | `gpu_heartbeat` | Extend a lease | 🔜 Coming Soon | | `gpu_terminate` | Terminate a pod | 🔜 Coming Soon | ## Available Today While GPU provisioning is coming soon, you can use these tools right now: * **[`inference_chat`](/services/inference)** — AI completions with 100+ models * **[`sandbox_execute`](/services/sandbox)** — Isolated code execution * **`optify_vram_estimate`** — Estimate VRAM requirements for models ## Pricing GPU pricing will be announced when the service launches. See [Pricing](/billing/pricing). **Interested in early access?** Contact us at [hello@asgcompute.com](mailto:hello@asgcompute.com) to join the GPU waitlist. # ASG Inference Source: https://docs.asgcompute.com/services/inference AI completions with 100+ models # ASG Inference Access state-of-the-art AI models with per-token pricing and instant access. ## Overview ASG Inference provides: * **100+ models** — GPT-5.2, Claude Sonnet 4, Gemini 2.5 Pro, DeepSeek R1 and more * **OpenAI-compatible** — Drop-in replacement * **Per-token billing** — Pay exactly for usage * **Automatic fallback** — Reliability across providers ## Quick Example ```bash curl theme={null} curl -X POST https://agent.asgcompute.com/mcp \ -H "Content-Type: application/json" \ -H "Authorization: Bearer YOUR_API_KEY" \ -d '{ "jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": { "name": "inference_chat", "arguments": { "model": "openai/gpt-4o-mini", "messages": [ {"role": "user", "content": "Explain quantum computing in one sentence."} ] } } }' ``` ```typescript fetch theme={null} const response = await fetch('https://agent.asgcompute.com/mcp', { method: 'POST', headers: { 'Content-Type': 'application/json', 'Authorization': 'Bearer YOUR_API_KEY', 'X-Payment': paymentProof // base64url-encoded payment proof }, body: JSON.stringify({ jsonrpc: '2.0', id: 1, method: 'tools/call', params: { name: 'inference_chat', arguments: { model: 'openai/gpt-4o-mini', messages: [ { role: 'user', content: 'Explain quantum computing in one sentence.' } ] } } }) }); ``` ## Available Models Pass the full model identifier in the `model` parameter: | Model | Best For | Cost | | :-------------------------- | :----------------------- | :----- | | `openai/gpt-4o-mini` | Quick responses, chat | \$ | | `openai/gpt-4.1` | General purpose | \$\$ | | `openai/gpt-5.2` | Complex reasoning | \$\$\$ | | `anthropic/claude-sonnet-4` | Coding, analysis | \$\$\$ | | `google/gemini-2.5-pro` | Multimodal, long context | \$\$ | | `deepseek/deepseek-r1` | Math, reasoning | \$\$ | Use the **Quote** response to see exact per-token pricing for any model before execution. ## Parameters | Parameter | Type | Required | Description | | :------------ | :------ | :------- | :--------------------------------- | | `model` | string | Yes | Model identifier (see table above) | | `messages` | array | Yes | Conversation messages | | `max_tokens` | number | No | Max output tokens (default: 1024) | | `temperature` | number | No | Randomness (0-2, default: 1) | | `stream` | boolean | No | Enable streaming (default: false) | ## Response ```json theme={null} { "result": { "content": "Quantum computing uses quantum bits...", "usage": { "prompt_tokens": 12, "completion_tokens": 45, "total_tokens": 57 }, "_meta": { "receipt_id": "rcpt_abc123", "debited_usdc_microusd": 2400 } } } ``` ## Streaming For real-time responses, set `stream: true` in arguments. Streaming responses use Server-Sent Events. ## Pricing See [Pricing](/billing/pricing) for current rates. **Cost Optimization:** Use lightweight models like `openai/gpt-4o-mini` for simple tasks and reserve frontier models for complex reasoning. # ASG Sandbox Source: https://docs.asgcompute.com/services/sandbox Isolated code execution environment # ASG Sandbox Execute untrusted code safely in isolated environments. ## Overview ASG Sandbox provides: * **Python & JavaScript** — Popular languages * **Full isolation** — Secure execution * **Package support** — pip/npm packages * **File access** — Read/write temporary files ## Quick Example ```bash REST (recommended) theme={null} curl -X POST https://agent.asgcompute.com/v1/mcp/tools/call \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $ASG_API_KEY" \ -d '{ "tool": "sandbox_execute", "arguments": { "language": "python", "code": "import math\nprint(math.sqrt(144))" } }' ``` ```bash JSON-RPC (MCP-native) theme={null} curl -X POST https://agent.asgcompute.com/mcp \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $ASG_API_KEY" \ -d '{ "jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": { "name": "sandbox_execute", "arguments": { "language": "python", "code": "import math\nprint(math.sqrt(144))" } } }' ``` ```typescript TypeScript theme={null} const result = await client.callTool('sandbox_execute', { language: 'python', code: ` import math print(math.sqrt(144)) ` }); console.log(result.stdout); // "12.0" ``` ## Parameters | Parameter | Type | Required | Description | | :----------------- | :------ | :------- | :-------------------------------------------------- | | `language` | string | Yes | `python` or `javascript` | | `code` | string | Yes | Code to execute | | `timeout_ms` | integer | No | Max execution time in milliseconds (default: 30000) | | `max_output_bytes` | integer | No | Maximum output size in bytes | | `packages` | array | No | Packages to install | ## Languages | Language | Version | Pre-installed | | :----------- | :------ | :------------------------------ | | `python` | 3.11 | numpy, pandas, requests, pillow | | `javascript` | Node 18 | axios, lodash, dayjs | ## Response ```json theme={null} { "result": { "stdout": "12.0\n", "stderr": "", "exit_code": 0, "duration_ms": 156, "_meta": { "receipt_id": "rcpt_sbox789", "debited_usdc_microusd": 2500 } } } ``` ## Installing Packages ```typescript theme={null} const result = await client.callTool('sandbox_execute', { language: 'python', packages: ['beautifulsoup4', 'lxml'], code: ` from bs4 import BeautifulSoup html = "

Hello

" soup = BeautifulSoup(html, 'lxml') print(soup.h1.text) ` }); ``` ## Security **Isolation:** All sandbox executions run in isolated environments with: * No network access (except allowlisted domains) * No persistent storage * Memory and CPU limits * Automatic termination on timeout ## Use Cases * **Code execution** — Run user-submitted code safely * **Data analysis** — Process data with Python libraries * **Prototyping** — Test code snippets quickly * **Agent tools** — Give agents code execution capability ## Pricing See [Pricing](/billing/pricing) for execution rates. # ASG Serverless Source: https://docs.asgcompute.com/services/serverless Serverless roadmap status and planned contract # ASG Serverless **🔧 Upgrading — temporarily unavailable.** `serverless_deploy`, `serverless_invoke`, and `serverless_cancel` are being upgraded and are not part of the active production tool set. See [Tool Availability](/guide/tool-availability) for current status and ETA. ## Current Status * Discovery visibility: available in catalog as `coming_soon` * Production execution: not enabled * Billing in production: no active serverless charges yet ## What Is Active Today Use these active tools in production: * `inference_chat` * `optify_vram_estimate` * `sandbox_execute` ## Planned Scope (Roadmap) Planned serverless capabilities: * Function deploy/invoke/cancel * Per-second billing with 402 payment flow * Run and receipt telemetry consistent with active tools ## Tracking Watch the capabilities endpoint for status changes: ```bash theme={null} curl -s https://agent.asgcompute.com/mcp/capabilities | jq '.tools[] | select(.name | startswith("serverless"))' ```