Foundry: prepaid AI compute in USDF

Prepaid AI compute in USDF: models, quotes and chat with a receipt; pay per call (x402) or by key

Should I use this

Quality & Safety

A
Description quality
97%
Schema completeness
88%
Naming quality
84%
Poisoning risk
100%
Permission match
100%
Protocol compliance
100%

Findings (1)

  • LOWTool 'list_models' description lacks action verbin list_models

Based on automated analysis of tool definitions and protocol compliance.

Context Cost

~3,021Tokens (tool definitions)
~1.6 KBTypical response size
Significant attention impact (2.36% of 128k context)

This is the approximate number of tokens consumed each time the server's tools are loaded into a model's context. Higher counts reduce the attention available for other tasks.

Install

One-Click Install

Add this to your `claude_desktop_config.json` file:

{
  "mcpServers": {
    "gateway": {
      "url": "https://api.usdf.fi/mcp"
    }
  }
}

Remote endpoints

https://api.usdf.fi/mcpstreamable-http

What it can do

Tool inventory

Tools (10)

🟢 Read-only🟡 Write🔴 Delete⚪ Unknown
🟢list_models

Models the gateway serves with their prices (USD per 1M tokens, the same figure in USDF), context window, output limits and whether a route is available right now. No key needed.

Input Schema

{
  "type": "object",
  "properties": {}
}
🟢quote(model, prompt, messages, max_tokens, provider)

The hold the chat tool places before running a request, in USDF and USD (output capped at 4096 tokens). It is an estimate, not a ceiling: a completed request is billed the provider's reported usage, normally less. Pass prompt or messages. No key needed; a request for attested hardware (a :private model id or provider.private), and any request from a Private-tier key, is quoted on its attested routes, at the model's price.

Input Schema

{
  "type": "object",
  "properties": {
    "model": {
      "type": "string",
      "maxLength": 200,
      "description": "Model id from list_models"
    },
    "prompt": {
      "description": "Prompt text, sent as one user message",
      "type": "string",
      "maxLength": 262144
    },
    "messages": {
      "maxItems": 256,
      "type": "array",
      "items": {},
      "description": "Chat messages in the OpenAI format: objects with a role (system, user, assistant or tool) and content (text, or an array of content parts)"
    },
    "max_tokens": {
      "description": "Output token budget, a positive integer; defaults to the model's default_max_output, capped at max_output",
      "type": "number"
    },
    "provider": {
      "description": "Routing asks as on the REST API, for example {\"private\": true} for attested hardware this gateway verified, at the model's price",
      "type": "object",
      "propertyNames": {
        "type": "string"
      },
      "additionalProperties": {}
    }
  },
  "required": [
    "model"
  ],
  "$schema": "http://json-schema.org/draft-07/schema#"
}
🟢list_tools(q, cursor)

Tools callable through POST /v1/tools/{id} on the same balance and key as chat, with their price (USDF base units: 1 unit = $0.000001; cost plus 5% at most) and each tool's input schema, ordered by title: every tool listed can be called now. q narrows the list to tools whose id, title or description has it; a page holds at most 200, the next named by page.next. No key needed.

Input Schema

{
  "type": "object",
  "properties": {
    "q": {
      "description": "Words a tool's id, title or description has",
      "type": "string",
      "maxLength": 100
    },
    "cursor": {
      "description": "page.next of the page before",
      "type": "string",
      "maxLength": 10
    }
  },
  "$schema": "http://json-schema.org/draft-07/schema#"
}
🟢quote_tool(tool, input)

The hold a call to a tool takes for this input before it runs (its worst case), in USDF base units and USD, with the tool's price. Checks the input as the call would; runs nothing and holds nothing. No key needed.

Input Schema

{
  "type": "object",
  "properties": {
    "tool": {
      "type": "string",
      "maxLength": 80,
      "description": "Tool id from list_tools"
    },
    "input": {
      "description": "The input the call would send, as in the tool's input schema",
      "type": "object",
      "propertyNames": {
        "type": "string"
      },
      "additionalProperties": {}
    }
  },
  "required": [
    "tool"
  ],
  "$schema": "http://json-schema.org/draft-07/schema#"
}
🟢x402_pay(url, method, headers, body, max_price, ...)

Calls a URL that asks for an x402 payment and pays it for you: the gateway pays the seller in USDC from its own float on Base or Solana and charges this key in USDF cost plus 5% at most, no minimum (the seller's amount and a fee of at most 5% of it; never free credit), within the key's and its agent's limits. Needs Authorization: Bearer sk_.... Returns the seller's answer with the payment and its receipt; a payment is charged only once the chain shows it, and one that never settles costs nothing. quote: true answers what it would cost and pays nothing. Third-party tools to call this way are listed under marketplace in list_tools (GET /v1/tools?source=marketplace).

Input Schema

{
  "type": "object",
  "properties": {
    "url": {
      "type": "string",
      "maxLength": 2048,
      "description": "The seller's URL (https)"
    },
    "method": {
      "description": "Default GET, or POST when a body is given",
      "type": "string",
      "enum": [
        "GET",
        "POST",
        "PUT",
        "PATCH",
        "DELETE"
      ]
    },
    "headers": {
      "description": "Headers for the seller (the payment headers are the gateway's)",
      "type": "object",
      "propertyNames": {
        "type": "string"
      },
      "additionalProperties": {
        "type": "string"
      }
    },
    "body": {
      "description": "The request body: text, or JSON sent as application/json",
      "anyOf": [
        {
          "type": "string",
          "maxLength": 131072
        },
        {
          "type": "object",
          "propertyNames": {
            "type": "string"
          },
          "additionalProperties": {}
        },
        {
          "type": "array",
          "items": {}
        }
      ]
    },
    "max_price": {
      "description": "The most to pay in USDF, the fee included (\"0.05\")",
      "type": "string",
      "maxLength": 20
    },
    "network": {
      "description": "Pay on this network only",
      "type": "string",
      "enum": [
        "base",
        "solana"
      ]
    },
    "quote": {
      "description": "Answer the price and pay nothing",
      "type": "boolean"
    }
  },
  "required": [
    "url"
  ],
  "$schema": "http://json-schema.org/draft-07/schema#"
}
🟢agents_market_search(q, tag, max_price, sort, limit, ...)

Agents, APIs and tools priced per call, in one market, every listing in the same shape: its id (svc_...), name, description, tags, site and logo, how it is called (GET or POST), what one call costs in USDF from this key's balance, input and output examples, and the data policy. Ordered by popularity (default), price or newest. No key needed to search; agents_market_call calls one.

Input Schema

{
  "type": "object",
  "properties": {
    "q": {
      "description": "Words to find in the name, description, tags or host",
      "type": "string",
      "maxLength": 200
    },
    "tag": {
      "description": "Only listings with this tag",
      "type": "string",
      "maxLength": 40
    },
    "max_price": {
      "description": "The most a call may cost in USDF (\"0.01\")",
      "type": "string",
      "maxLength": 20
    },
    "sort": {
      "description": "popular (default), price (cheapest first) or new",
      "type": "string",
      "enum": [
        "popular",
        "price",
        "new"
      ]
    },
    "limit": {
      "type": "integer",
      "minimum": 1,
      "maximum": 100
    },
    "offset": {
      "type": "integer",
      "minimum": 0,
      "maximum": 10000
    }
  },
  "$schema": "http://json-schema.org/draft-07/schema#"
}
⚪agents_market_call(id, input, max_price)

Calls a listing of the agents market by its id (svc_..., from agents_market_search), paid from this key's USDF balance (never free credit) within the key's and its agent's limits and at most max_price: what one call costs and nothing on top; a call its seller does not answer 2xx costs nothing, or no more than what its seller kept of it. Every listing is called the same way, and answers 503 market_calls_unarmed while calls to the market are not switched on. Needs Authorization: Bearer sk_.... Returns the seller's answer and the receipt. The input goes to the seller, whose own policy governs what it keeps.

Input Schema

{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "maxLength": 40,
      "description": "The listing's id (svc_...), from agents_market_search"
    },
    "input": {
      "description": "What the call sends: JSON for a POST listing, an object of plain values (its query) for a GET one",
      "anyOf": [
        {
          "type": "object",
          "propertyNames": {
            "type": "string"
          },
          "additionalProperties": {}
        },
        {
          "type": "array",
          "items": {}
        },
        {
          "type": "string",
          "maxLength": 131072
        },
        {
          "type": "number"
        },
        {
          "type": "boolean"
        }
      ]
    },
    "max_price": {
      "type": "string",
      "maxLength": 20,
      "description": "The most this call may cost in USDF (\"0.05\"): required, as a seller may change its price; the listing's price is in agents_market_search"
    }
  },
  "required": [
    "id",
    "max_price"
  ],
  "$schema": "http://json-schema.org/draft-07/schema#"
}
🟡chat(model, messages, max_tokens, temperature, payment)

Runs a chat completion through the metered gateway and returns the text with its receipt (tokens, price, cost, balance, settlement). Needs Authorization: Bearer sk_... and spends from that key's balance; a hold for the maximum cost is placed first. Not streamed. Output is capped at 4096 tokens. A call without a progress token answers within 55 s of arriving. With a progress token, progress is sent every 15 s and the call may run 10 minutes, so the client must reset its timeout on progress (resetTimeoutOnProgress: true in the TypeScript SDK) or wait that long. At its deadline, or when the client's connection closes, a call is cut: the text produced so far is returned with finish_reason "length" and billed on the provider's usage report where the provider gives one, otherwise on an estimate never above max_tokens; for a model whose reasoning is not streamed, at the held output budget. Cancellation messages are not supported: a call the client stops waiting for without disconnecting runs to completion or its deadline and is billed. With no key, the call is paid with x402 in USDF (Permit2) or USDG (EIP-3009), as POST /x402/v1/chat/completions: without a payment it returns isError with the payment requirements (x402Version, resource, accepts) as structuredContent; sign one accept and call again with the payment in _meta["x402/payment"], the payment argument or the PAYMENT-SIGNATURE header. The quote is the call's maximum cost at the published price (prompt at one token per byte, output at max_tokens, capped as above, no minimum), paid up front; the call is charged what it uses at that price and the rest is refunded in the asset paid, the gateway paying the gas. A paid call runs to its end or its deadline whether or not the client waits and returns the receipt and _meta["x402/payment-response"]; at the deadline the text so far is returned with finish_reason "length" and a note, charged what it used and the rest refunded. A call no provider accepted before its deadline, or whose provider failed or ended with nothing, is refunded in full in the asset paid; so is one cut by the deadline after the provider accepted it, with nothing produced. A call with less than 20 s left before its deadline is refused before the payment is settled (deadline_too_close), nothing charged. MPP clients pay the same quote: the payment-required result also carries _meta["org.paymentauth/payment-required"] with evm charge challenges (USDG by EIP-3009 authorization, USDF by Permit2); call again with the credential in _meta["org.paymentauth/credential"], and the paid result carries _meta["org.paymentauth/receipt"].

Input Schema

{
  "type": "object",
  "properties": {
    "model": {
      "type": "string",
      "maxLength": 200,
      "description": "Model id from list_models"
    },
    "messages": {
      "maxItems": 256,
      "type": "array",
      "items": {},
      "description": "Chat messages in the OpenAI format: objects with a role (system, user, assistant or tool) and content (text, or an array of content parts)"
    },
    "max_tokens": {
      "description": "Output token budget, a positive integer; defaults to the model's default_max_output, capped at max_output",
      "type": "number"
    },
    "temperature": {
      "description": "Sampling temperature, 0 to 2",
      "type": "number"
    },
    "payment": {
      "description": "With no key: the x402 payment for this call's quote, as the PAYMENT-SIGNATURE value (base64 JSON) or the payload object; _meta[\"x402/payment\"] and the PAYMENT-SIGNATURE header are read too",
      "anyOf": [
        {
          "type": "string",
          "maxLength": 16384
        },
        {
          "type": "object",
          "propertyNames": {
            "type": "string"
          },
          "additionalProperties": {}
        }
      ]
    }
  },
  "required": [
    "model",
    "messages"
  ],
  "$schema": "http://json-schema.org/draft-07/schema#"
}
🟢balance(address)

The calling key's available balance, the account's balance and held amount, and the key's budget left, in USDF (Authorization: Bearer sk_...). With `address` instead, no key: that wallet's USDF and USDG on the chain now and its USDF allowance to Permit2, which x402 pays from.

Input Schema

{
  "type": "object",
  "properties": {
    "address": {
      "description": "A wallet address (0x...): its USDF and USDG on the chain, with no key",
      "type": "string",
      "maxLength": 64
    }
  },
  "$schema": "http://json-schema.org/draft-07/schema#"
}
🟢receipt(request_id)

The receipt for a request made with the calling key: usage, price sheet version, cost, and once settled the batch, its transaction and the rows behind the onchain digest (Authorization: Bearer sk_...). With no key, the public receipt of any request id, x402 ones included: its line in the usage log as fields, the payment, the settlement and the proof's URL (GET /x402/v1/receipts/{id}).

Input Schema

{
  "type": "object",
  "properties": {
    "request_id": {
      "type": "string",
      "maxLength": 128,
      "description": "The id returned with the completion (also the x-request-id header)"
    }
  },
  "required": [
    "request_id"
  ],
  "$schema": "http://json-schema.org/draft-07/schema#"
}

Community

Rate this Server

Evidence

Recent observations

verifiedversion not recorded10 tools