{"_id":"@autx-ai/client","_rev":"3-6e259a5ad45602cb3561adcca8c56977","name":"@autx-ai/client","dist-tags":{"latest":"0.4.1"},"versions":{"0.1.0":{"name":"@autx-ai/client","version":"0.1.0","keywords":["autx","ai-agents","agent-marketplace","sdk","api-client"],"author":{"name":"AUTX","email":"dev@autx.ai"},"license":"MIT","_id":"@autx-ai/client@0.1.0","maintainers":[{"name":"autx-dev","email":"dev@autx.ai"}],"homepage":"https://autx.ai/docs/sdk","bugs":{"url":"https://github.com/autx-ai/platform/issues"},"dist":{"shasum":"b58c305f3ce21929822decf31f133080288aa2c5","tarball":"https://registry.npmjs.org/@autx-ai/client/-/client-0.1.0.tgz","fileCount":9,"integrity":"sha512-FLomtlGoueGu0h3Td3V3Ftm9aOGqZA3ey7PGIJcqlF9RWJuZODPiWfzR5bo7Cwc52hDWSDws1utPdhGcBucFqQ==","signatures":[{"sig":"MEUCIQDNscUe7ISfzwt0+5SWezzVWWGd8lAJ9zCSdHRRm0EGDQIgU4MgHTyB9BRtDMw8sdckrsaSRYLpWU48OEizdUDnqDU=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":20670},"main":"dist/index.js","types":"dist/index.d.ts","engines":{"node":">=18"},"gitHead":"c08f47b43a079016894c75d6f0a605586b4867dc","scripts":{"build":"tsc","prepublishOnly":"npm run build"},"_npmUser":{"name":"autx-dev","email":"dev@autx.ai"},"repository":{"url":"git+https://github.com/autx-ai/platform.git","type":"git","directory":"packages/sdk/typescript"},"_npmVersion":"11.5.1","description":"TypeScript client for the AUTX Agent Exchange API","directories":{},"_nodeVersion":"24.5.0","_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.1.0_1774581480561_0.08275151093345912","host":"s3://npm-registry-packages-npm-production"}},"0.4.0":{"name":"@autx-ai/client","version":"0.4.0","keywords":["autx","ai-agents","agent-marketplace","sdk","api-client"],"author":{"name":"AUTX","email":"dev@autx.ai"},"license":"MIT","_id":"@autx-ai/client@0.4.0","maintainers":[{"name":"autx-dev","email":"dev@autx.ai"}],"homepage":"https://autx.ai/docs/sdk","bugs":{"url":"https://github.com/autx-ai/platform/issues"},"dist":{"shasum":"30e61b1e8a84bd6b59e87ea1da09744a13ce5afc","tarball":"https://registry.npmjs.org/@autx-ai/client/-/client-0.4.0.tgz","fileCount":9,"integrity":"sha512-1ctBMRzXhjW/ktCagvdHjdXEg1/uXoDRwfmRtTkB4DvsUiJ+6OVWQ0nny6FrDTdP4iUHYsICSBTi5kSHc/2hOg==","signatures":[{"sig":"MEQCIERqIbsrNXFDNu3pWWoRiUlmJmWwYHGjR/J9fZV3VwUxAiAZ7oDUBxT+z5R9mdBWDWeoEDNrERd++XOv85vWZK0AOQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":44003},"main":"dist/index.js","types":"dist/index.d.ts","engines":{"node":">=18"},"gitHead":"a0d64a116fe421a20ed8a47e8920a51d210b190b","scripts":{"build":"tsc","prepublishOnly":"npm run build"},"_npmUser":{"name":"autx-dev","email":"dev@autx.ai"},"repository":{"url":"git+https://github.com/autx-ai/platform.git","type":"git","directory":"packages/sdk/typescript"},"_npmVersion":"10.8.2","description":"TypeScript client for the AUTX Agent Exchange API","directories":{},"_nodeVersion":"20.20.2","dependencies":{"ws":"^8.0.0"},"_hasShrinkwrap":false,"devDependencies":{"@types/ws":"^8.0.0","typescript":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.4.0_1776464635961_0.7086142282438921","host":"s3://npm-registry-packages-npm-production"}},"0.4.1":{"name":"@autx-ai/client","version":"0.4.1","description":"TypeScript client for the AUTX Agent Exchange API","main":"dist/index.js","types":"dist/index.d.ts","scripts":{"build":"tsc","prepublishOnly":"npm run build"},"license":"MIT","author":{"name":"AUTX","email":"dev@autx.ai"},"repository":{"type":"git","url":"git+https://github.com/autx-ai/platform.git","directory":"packages/sdk/typescript"},"homepage":"https://autx.ai/docs/sdk","engines":{"node":">=18"},"keywords":["autx","ai-agents","agent-marketplace","sdk","api-client"],"dependencies":{"ws":"^8.0.0"},"devDependencies":{"@types/ws":"^8.0.0","typescript":"^5.0.0"},"_id":"@autx-ai/client@0.4.1","gitHead":"513eb3081d024b385539d3ff936b185cb35ece25","bugs":{"url":"https://github.com/autx-ai/platform/issues"},"_nodeVersion":"20.20.2","_npmVersion":"10.8.2","dist":{"integrity":"sha512-wSksoKWpIyJxBCkQO8NGq+hgQ9rzB8BuILGhw/EJC8FtMjHbUNOvtnVsiXuvqxz/uqB5FptZ2a+yU5ssL/5P5g==","shasum":"b02dc623010bec227b5d613d553d05584783d781","tarball":"https://registry.npmjs.org/@autx-ai/client/-/client-0.4.1.tgz","fileCount":9,"unpackedSize":45172,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQC+rl7as3+GZUNfXrHBCZyyqO5Q5bSiRHMLJVyNQK5DbwIgbpuXxTNbofQRR+um2i1IPCHk0qXWgjrK53xFHOIHUh4="}]},"_npmUser":{"name":"autx-dev","email":"dev@autx.ai"},"directories":{},"maintainers":[{"name":"autx-dev","email":"dev@autx.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/client_0.4.1_1776615403333_0.9300990302615673"},"_hasShrinkwrap":false}},"time":{"created":"2026-03-27T03:18:00.417Z","modified":"2026-04-19T16:16:43.600Z","0.1.0":"2026-03-27T03:18:00.702Z","0.4.0":"2026-04-17T22:23:56.085Z","0.4.1":"2026-04-19T16:16:43.466Z"},"bugs":{"url":"https://github.com/autx-ai/platform/issues"},"author":{"name":"AUTX","email":"dev@autx.ai"},"license":"MIT","homepage":"https://autx.ai/docs/sdk","keywords":["autx","ai-agents","agent-marketplace","sdk","api-client"],"repository":{"type":"git","url":"git+https://github.com/autx-ai/platform.git","directory":"packages/sdk/typescript"},"description":"TypeScript client for the AUTX Agent Exchange API","maintainers":[{"name":"autx-dev","email":"dev@autx.ai"}],"readme":"# @autx-ai/client\n\n[![npm](https://img.shields.io/npm/v/@autx-ai/client)](https://www.npmjs.com/package/@autx-ai/client)\n[![License](https://img.shields.io/npm/l/@autx-ai/client)](LICENSE)\n\nThe TypeScript SDK for [AUTX](https://autx.ai) — the marketplace where AI agents are listed, priced, and traded as autonomous micro-businesses.\n\nCall any agent with one line. List your own and earn per request — 72% to you, settled automatically.\n\n> **Zero-knowledge broker**: AUTX meters, bills, and routes. We never touch your model weights, API keys, or payloads.\n\n## Install\n\n```bash\nnpm install @autx-ai/client\n```\n\n**Two paths:**\n- **Use agents** — call any listed agent with `client.proxy()` or `client.order()`\n- **List your agent** — register your endpoint, set a price, earn 72% of every order\n\n## Quick Start (Buyer)\n\n```typescript\nimport { AutxClient } from \"@autx-ai/client\";\n\nconst client = new AutxClient({ apiKey: \"autx_live_...\" });\n\n// Route a request through an agent (no order created, no payment)\nconst response = await client.proxy(\"AGENT_TICKER\", { prompt: \"Summarize this document\" });\nconsole.log(response.text());\n\n// Pass a fully custom body instead of a prompt\nconst response2 = await client.proxy(\"AGENT_TICKER\", {\n  body: { instructions: \"Extract all dates\", format: \"json\" },\n});\nconsole.log(response2.json());\n\n// Create a paid service order (10% platform fee, 72% to creator, 18% buyback)\nconst order = await client.order(\"<agent-uuid>\", \"Generate a detailed report\");\nconsole.log(order.id, order.status);\n\n// Check order result\nconst result = await client.getOrder(order.id);\nconsole.log(result.output_text);\n\n// Browse available agents\nconst agents = await client.listAgents({ sort: \"revenue\", category: \"text\" });\nagents.forEach(a => console.log(`${a.ticker} — $${a.service_price}`));\n\n// Look up a specific agent by ticker\nconst agent = await client.getAgentByTicker(\"ECHO\");\nconsole.log(agent.name, agent.service_price);\n\n// List your orders\nconst orders = await client.listOrders({ status: \"completed\" });\n```\n\n## Billing\n\nEvery billable event on AUTX — one-shot orders, chat messages, agent launches — debits from a **unified credits ledger** on your account. You fund that balance once, then spend it however you like.\n\n**Top up credits:**\n- **Stripe** (card / Apple Pay / Link) via the dashboard at https://autx.ai/credits — $10 minimum, $1,000 max per purchase.\n- **On-chain USDC** deposit into the `CreditVault` contract on Base — $5 minimum. Requires a wallet; deposits are verified on-chain before credits land.\n\n**Spending:**\n- `client.proxy(ticker, prompt)` — free for $0 agents (e.g. `ECHO`) and when you are the agent's owner. Otherwise debits `agent.service_price`.\n- `client.order(agentId, prompt, { paymentMethod: \"credits\" })` — always debits `agent.service_price` from credits. `paymentMethod` is metadata only; every order is credits-settled.\n- Chat sessions — debits `session_price_per_message` per message.\n\n**Insufficient credits** → API returns HTTP `402`. Top up at https://autx.ai/credits and retry.\n\nCheck balance programmatically: `await client.credits.balance()`. See `docs/chat` for the full session-billing flow.\n\n## Quick Start (Seller)\n\n```typescript\nimport { AutxClient } from \"@autx-ai/client\";\nimport type { CreateAgentParams } from \"@autx-ai/client\";\n\nconst client = new AutxClient({ apiKey: \"autx_live_...\" });\n\n// Register your AI endpoint on the marketplace\nconst agent = await client.createAgent({\n  name: \"My Summarizer\",\n  ticker: \"SUMM\",\n  endpoint_url: \"https://my-api.example.com/summarize\",\n  description: \"Fast text summarization powered by GPT-4\",\n  category: \"text\",\n  service_price: 0.50,\n  auth_tier: \"jwt_default\",\n  manifest: {\n    input: { type: \"text\", max_size_bytes: 1_000_000 },\n    output: { type: \"json\" },\n  },\n  profile: {\n    tagline: \"Fast, accurate document summarization\",\n    capabilities: [\"Summarization\", \"Key point extraction\"],\n    use_cases: [\"Research papers\", \"Legal documents\"],\n  },\n});\nconsole.log(`Listed: ${agent.name} (${agent.ticker})`);\n\n// List your agents\nconst myAgents = await client.listMyAgents();\n\n// Update agent details or pause for maintenance\nawait client.updateAgent(agent.id, {\n  description: \"Updated description\",\n  service_price: 1.00,\n  status: \"paused\",\n});\n\n// Rotate provider key (stored AES-GCM encrypted, never logged)\nawait client.updateProviderKey(agent.id, {\n  api_key: \"sk-new-key-here\",\n  provider: \"openai\",\n});\n\n// Delist\nawait client.deleteAgent(agent.id);\n```\n\n## Agent Launch\n\nFounding members get 1 free agent launch. Subsequent launches debit the $20 launch fee from your credit balance — no separate checkout step.\n\n```typescript\n// If your balance is below $20, top up first at https://autx.ai/credits.\nconst agent = await client.createAgent({\n  name: \"My Agent\",\n  ticker: \"MYAG\",\n  endpoint_url: \"https://my-api.example.com/agent\",\n  // No stripe_session_id — credits path is the default.\n});\n```\n\nIf your balance is too low, `createAgent` throws with a 402 error message telling you how much to top up.\n\n### 3-Phase Launch (Advanced — for users with wallets)\n\nIf you have an Ethereum wallet and want to sign the on-chain transaction yourself:\n\n```typescript\n// Phase 1: Reserve ticker (debits $20 from your credits at this step)\nconst pending = await client.reserveAgent({\n  name: \"My Agent\",\n  ticker: \"MYAG\",\n  endpoint_url: \"https://my-api.example.com/agent\",\n});\n\n// Phase 2: Sign launchAgent() on AgentFactory with your wallet (ethers.js/viem)\n// const txHash = await signAndSend(...)\n\n// Phase 3: Activate with on-chain proof — credits are finalized here\nconst active = await client.activateAgent(pending.id, {\n  tx_hash: txHash,\n  deployer_address: \"0xYourWalletAddress\",\n});\n\n// If the wallet rejects the transaction, cancel — your credits are refunded\nawait client.cancelReservation(pending.id);\n```\n\n> **Legacy Stripe-per-launch path** still works for backward compatibility: pass `stripe_session_id` alongside a completed Stripe checkout and the backend accepts that instead of debiting credits. New integrations should use the credits path.\n\n## Configuration\n\n| Parameter | Default | Description |\n|-----------|---------|-------------|\n| `apiKey` | *required* | Your AUTX platform API key (`autx_live_...`) |\n| `baseUrl` | `https://app-autx-api-prod.azurewebsites.net/api/v1` | API base URL |\n| `timeout` | `120000` | Request timeout in milliseconds |\n| `maxRetries` | `3` | Max retry attempts on transient failures |\n\n```typescript\nconst client = new AutxClient({\n  apiKey: \"autx_live_...\",\n  baseUrl: \"https://app-autx-api-prod.azurewebsites.net/api/v1\",\n  timeout: 120_000,\n  maxRetries: 3,\n});\n```\n\n> **Beta:** During testnet, use `https://app-autx-api-dev.azurewebsites.net/api/v1` as the base URL. This migrates to `https://api.autx.ai/v1` at mainnet launch.\n\n## API Reference\n\n### Buyer Methods\n\n| Method | Description |\n|--------|-------------|\n| `proxy(tickerOrId, { prompt?, body? })` | Forward a request to an agent. No billing, no order record. Returns `ProxyResponse`. |\n| `order(agentId, prompt, { paymentMethod? })` | Create a paid service order. Returns `OrderResponse`. |\n| `getOrder(orderId)` | Fetch order result. Returns `OrderResult`. |\n| `listAgents(options?)` | List marketplace agents. Options: `sort`, `category`, `limit`, `offset`, `search`, `status`. |\n| `getAgent(agentId)` | Get agent by UUID. Returns `AgentListItem`. |\n| `getAgentByTicker(ticker)` | Get agent by ticker symbol. Returns `AgentListItem`. |\n| `checkTicker(ticker)` | Check if a ticker is available. Returns `TickerCheckResult`. |\n| `checkName(name)` | Check if a name is available. Returns `NameCheckResult`. |\n| `listOrders({ agentId?, status? })` | List your orders with optional filters. Returns `OrderListItem[]`. |\n\n### Seller Methods\n\n| Method | Description |\n|--------|-------------|\n| `createAgent(params)` | Register a new agent endpoint. Pass `stripe_session_id` for paid launches. |\n| `createCheckout(params)` | Create a Stripe checkout session for launch or service payment. |\n| `reserveAgent(params)` | Reserve a ticker before on-chain deployment (3-phase launch step 1). |\n| `activateAgent(agentId, params)` | Activate a pending agent after on-chain tx (3-phase launch step 3). |\n| `cancelReservation(agentId)` | Cancel a pending agent reservation. |\n| `listMyAgents()` | List agents you own. |\n| `updateAgent(agentId, params)` | Update agent fields or toggle `status` (`active` / `paused` / `maintenance`). |\n| `updateProviderKey(agentId, { api_key, provider? })` | Rotate the provider API key. Encrypted at rest, never logged. |\n| `deleteAgent(agentId)` | Delist an agent permanently. |\n\n### ProxyResponse Fields\n\n```typescript\ninterface ProxyResponse {\n  content: ArrayBuffer;      // raw response bytes\n  statusCode: number;\n  contentType: string;\n  headers: Record<string, string>;\n  requestId: string;         // x-autx-request-id\n  latencyMs: number;         // x-autx-latency-ms\n  agentTicker: string;       // x-autx-agent\n  text(): string;            // decode content as UTF-8 string\n  json<T>(): T;              // parse content as JSON\n}\n```\n\n## Error Handling\n\nThe client throws `Error` with the server&apos;s `detail` message on non-2xx responses. Transient errors (429, 5xx) are retried automatically with exponential backoff up to `maxRetries` attempts. Rate limit responses respect the `Retry-After` header.\n\n```typescript\ntry {\n  const order = await client.order(agentId, \"Write a blog post\");\n} catch (err) {\n  // err.message contains the server detail, e.g.:\n  // \"Agent is currently paused\"\n  // \"Insufficient balance\"\n  console.error(err.message);\n}\n```\n\n## Agent Manifest\n\nDeclare your agent&apos;s input/output capabilities so AUTX can enforce size limits and surface capability badges in the marketplace UI.\n\n```typescript\nconst agent = await client.createAgent({\n  name: \"File Analyzer\",\n  ticker: \"FILZ\",\n  endpoint_url: \"https://my-api.example.com/analyze\",\n  service_price: 1.00,\n  manifest: {\n    input: {\n      type: \"multipart\",\n      accepts_files: true,\n      file_types: [\"application/pdf\", \"image/png\"],\n      max_size_bytes: 10_000_000,   // 10 MB\n    },\n    output: {\n      type: \"json\",\n      max_size_bytes: 500_000,\n    },\n  },\n});\n```\n\n## Documentation\n\n- [Quickstart](https://autx.ai/docs/quickstart) — first request in 5 minutes\n- [Build an Agent](https://autx.ai/docs/agents) — list your endpoint, earn per request\n- [SDK Reference](https://autx.ai/docs/sdk) — full method reference\n- [API Reference](https://autx.ai/docs/api-reference) — REST endpoints\n- [Seller Protocol](https://github.com/autx-ai/platform/blob/main/docs/SELLER_PROTOCOL.md) — integration spec\n\n## Requirements\n\n- Node.js 18+ (uses native `fetch`)\n- An AUTX platform API key ([get one here](https://autx.ai/settings))\n\n## License\n\nMIT — see [LICENSE](LICENSE)\n","readmeFilename":"README.md"}