Skip to content

[Feature Request]: Nano (XNO) payment wrapper for embedding API usage #3958

Description

@dhyabi2

Describe the problem

OpenAI's embedding API (text-embedding-3-small at $0.02/M tokens, text-embedding-3-large at $0.13/M tokens) is the most widely used embedding service in AI agent pipelines. Agents that call the embeddings endpoint at high frequency accumulate micropayments — but paying for them requires USD or USDC, which means per-transaction fees that make sub-cent micropayments uneconomical.

For autonomous agents that need per-operation payment authority (each embedding request paid for by the agent itself), the absence of a fee-free micropayment rail means agents either bypass payment entirely or pay more in fees than the request is worth.

Describe the proposed solution

Add a Nano (XNO) payment wrapper for the OpenAI Python SDK that allows agents to pay for embedding API usage in fee-free, instant XNO via the x402 protocol.

Concretely:

  1. A NanoPaymentClient wrapper around openai.OpenAI that intercepts embedding requests, derives a per-request Nano payment via x402 (using the existing feeless402 library — github.com/michardnicolas/feeless402), and submits the payment alongside the API call. The wrapper would be a drop-in replacement: client = NanoPaymentClient(api_key=...) instead of client = OpenAI(api_key=...).

  2. Usage tracking: the wrapper reports tokens used per request, enabling agents to track their embedding spend in Nano. At $0.02/M tokens (text-embedding-3-small), a 100K-token batch costs ~$0.002 — a micropayment that is economic in Nano but uneconomical in USDC after gas.

  3. For OpenAI: accept Nano as a billing currency for the embeddings API. Agents that already hold XNO (e.g. via the OpenAI Agents SDK's Nano x402 payer — github.com/dhyabi2/openai-agents-nano-x402) can pay for embedding usage without converting to USD, avoiding fee erosion.

Alternatives considered

  • USDC on Base via x402: the existing agent-payments rail, but each transaction carries a gas fee. For sub-cent embedding micropayments, the gas fee exceeds the payment value.
  • Credit card billing: aggregated monthly, which works for humans but not for autonomous agents that need per-operation payment authority.
  • Do nothing: agents embed for free until the bill comes due, which works for low-volume use but doesn't give agents payment authority.

Importance

  • would make my life easier — for high-frequency embedding workloads where each request should be paid for in real time by the agent itself, the absence of a fee-free micropayment rail forces a choice between unmonetized usage or uneconomical per-transaction fees.

Additional context

  • The existing feeless402 library (MIT license) provides fee-free x402 micropayments in Nano — github.com/michardnicolas/feeless402.
  • A working Nano x402 adapter for the OpenAI Agents SDK already exists — github.com/dhyabi2/openai-agents-nano-x402 — proving the pattern works for OpenAI's agent ecosystem.
  • Nano settles in under 1 second (>99.9% in <1s), has no per-transaction fee, and is self-custodied (no issuer, no freeze).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions