Skip to content

[Feature Request]: Nano (XNO) payment wrapper for Cohere embedding API #814

Description

@dhyabi2

Describe the problem

Cohere's Embed 4 API costs $0.12/M tokens for text embeddings — a metered, per-token API that AI agents call at high frequency. For autonomous agents that need per-operation payment authority, paying for each embedding request in USD or USDC means per-transaction fees that make micropayments uneconomical. A sub-cent embedding request is uneconomical after a gas fee or card processing fee.

Describe the proposed solution

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

Concretely:

  1. A NanoPaymentClient wrapper around cohere.Client 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. Drop-in: client = NanoPaymentClient(api_key=...) instead of client = Client(api_key=...).

  2. For Cohere: accept Nano as a billing currency for the embeddings API. Agents that already hold XNO can pay for embedding usage without converting to USD, avoiding fee erosion that makes sub-cent micropayments uneconomical today.

Alternatives considered

  • USDC on Base via x402: each transaction carries gas; for sub-cent embeddings the gas exceeds the payment.
  • Credit card billing: aggregated monthly — works for humans, not for autonomous agents needing per-operation payment authority.
  • Do nothing: agents embed until the bill comes due — no per-operation payment authority.

Importance

  • would make my life easier — high-frequency embedding workloads where each request should be paid for in real time by the agent itself.

Additional context

  • feeless402 (MIT) provides fee-free x402 micropayments in Nano — github.com/michardnicolas/feeless402.
  • A working Nano x402 adapter for the OpenAI Agents SDK exists — github.com/dhyabi2/openai-agents-nano-x402.
  • Nano: fee-free, <1s settlement, 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