pg-buy

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

ProxyGate — Buy API Access

ProxyGate — 购买API访问权限

Buyer workflow: deposit USDC, discover APIs, proxy requests, stream responses, rate sellers.
买家流程:存入USDC、发现API、发起代理请求、流式响应、给卖家评分。

Process

操作流程

1. Check balance

1. 查看余额

bash
proxygate balance
Shows: total balance, pending settlement, available, cooldown status. If 0 or insufficient, deposit first.
bash
proxygate balance
显示:总余额、待结算金额、可用余额、冷却状态。如果余额为0或不足,请先存入资金。

2. Deposit USDC

2. 存入USDC

bash
proxygate deposit -a 5000000      # 5 USDC (amounts in lamports: 1 USDC = 1,000,000)
proxygate deposit -a 1000000      # 1 USDC
Vault auto-initializes on first deposit. User needs USDC in their Solana wallet. Use
--rpc <url>
for custom RPC.
bash
proxygate deposit -a 5000000      # 5 USDC(金额单位为lamports:1 USDC = 1,000,000)
proxygate deposit -a 1000000      # 1 USDC
首次存入时会自动初始化金库。用户的Solana钱包中需要有USDC。使用
--rpc <url>
指定自定义RPC。

3. Discover APIs

3. 发现API

bash
undefined
bash
undefined

Browse all APIs with rich filtering

带丰富筛选功能浏览所有API

proxygate apis # all listings proxygate apis -s openai # filter by service proxygate apis -c ai-models # filter by category proxygate apis -q "code review" # semantic search proxygate apis --verified # verified sellers only proxygate apis --sort price_asc # sort: price_asc, price_desc, popular, newest proxygate apis -l 50 # limit results
proxygate apis # 所有列表 proxygate apis -s openai # 按服务筛选 proxygate apis -c ai-models # 按分类筛选 proxygate apis -q "code review" # 语义搜索 proxygate apis --verified # 仅查看已认证卖家 proxygate apis --sort price_asc # 排序方式:price_asc, price_desc, popular, newest proxygate apis -l 50 # 限制结果数量

Aggregated views

聚合视图

proxygate pricing # pricing table (service, type, price, sellers, RPM) proxygate pricing -s anthropic --json # machine-readable proxygate services # service stats (cheapest, avg latency, rating) proxygate categories # browse categories
proxygate pricing # 定价表(服务、类型、价格、卖家、RPM) proxygate pricing -s anthropic --json # 机器可读格式 proxygate services # 服务统计(最低价、平均延迟、评分) proxygate categories # 浏览分类

Listing details & docs

列表详情与文档

proxygate listings docs <listing-id> # view API documentation

Note the `listing-id` from output — needed for proxy requests.
proxygate listings docs <listing-id> # 查看API文档

注意输出中的`listing-id`——发起代理请求时需要用到。

4. Proxy a request

4. 发起代理请求

bash
undefined
bash
undefined

POST request (default when -d is given)

POST请求(指定-d参数时默认使用POST)

proxygate proxy <listing-id> /v1/chat/completions
-d '{"model":"gpt-4","messages":[{"role":"user","content":"Hello"}]}'
proxygate proxy <listing-id> /v1/chat/completions
-d '{"model":"gpt-4","messages":[{"role":"user","content":"Hello"}]}'

GET request

GET请求

proxygate proxy <listing-id> /v1/models -X GET
proxygate proxy <listing-id> /v1/models -X GET

Stream SSE responses

流式SSE响应

proxygate proxy <listing-id> /v1/chat/completions --stream
-d '{"model":"gpt-4","messages":[{"role":"user","content":"Hello"}],"stream":true}'
proxygate proxy <listing-id> /v1/chat/completions --stream
-d '{"model":"gpt-4","messages":[{"role":"user","content":"Hello"}],"stream":true}'

With shield scanning (content moderation)

开启防护扫描(内容审核)

proxygate proxy <listing-id> /path --shield monitor # log threats proxygate proxy <listing-id> /path --shield strict # block threats proxygate proxy <listing-id> /path --shield off # disable
undefined
proxygate proxy <listing-id> /path --shield monitor # 记录威胁 proxygate proxy <listing-id> /path --shield strict # 拦截威胁 proxygate proxy <listing-id> /path --shield off # 关闭防护
undefined

5. Rate a seller

5. 给卖家评分

After a proxy request, rate the seller using the request ID from the response receipt:
bash
proxygate rate --request-id <id> --up      # positive rating
proxygate rate --request-id <id> --down    # negative rating
发起代理请求后,使用响应回执中的请求ID给卖家评分:
bash
proxygate rate --request-id <id> --up      # 正面评分
proxygate rate --request-id <id> --down    # 负面评分

6. Check usage

6. 查看使用情况

bash
proxygate usage                                   # recent request history
proxygate usage -s openai -l 50                   # filtered by service
proxygate usage --from 2026-03-01 --to 2026-03-14 # date range
proxygate usage --json                            # machine-readable

proxygate settlements -r buyer                    # cost breakdown
proxygate settlements -s openai --from 2026-03-01 # filtered
bash
proxygate usage                                   # 近期请求历史
proxygate usage -s openai -l 50                   # 按服务筛选
proxygate usage --from 2026-03-01 --to 2026-03-14 # 按日期范围筛选
proxygate usage --json                            # 机器可读格式

proxygate settlements -r buyer                    # 费用明细
proxygate settlements -s openai --from 2026-03-01 # 筛选结果

7. Withdraw (optional)

7. 提现(可选)

Convert credits back to USDC:
bash
proxygate withdraw -a 2000000     # withdraw 2 USDC
proxygate withdraw                # withdraw all available
Recovery (if CLI crashes mid-withdrawal):
bash
proxygate withdraw-confirm --tx <tx_signature>
将信用额度转换回USDC:
bash
proxygate withdraw -a 2000000     # 提现2 USDC
proxygate withdraw                # 提现所有可用余额
恢复操作(若CLI在提现过程中崩溃):
bash
proxygate withdraw-confirm --tx <tx_signature>

SDK (Programmatic)

SDK(程序化调用)

For agent-to-agent use without CLI:
typescript
import { ProxyGateClient, parseSSE } from '@proxygate/sdk';

const client = await ProxyGateClient.create({
  keypairPath: '~/.proxygate/keypair.json',
});

// Check balance
const { balance, available } = await client.balance();

// Browse APIs
const apis = await client.apis({ service: 'openai', verified: true });
const categories = await client.categories();
const services = await client.services();

// View listing docs
const docs = await client.docs('listing-id');

// Proxy a request
const res = await client.proxy('listing-id', '/v1/chat/completions', {
  model: 'gpt-4',
  messages: [{ role: 'user', content: 'Hello' }],
});

// Stream with SSE
const res = await client.proxy('listing-id', '/v1/chat/completions',
  { model: 'gpt-4', messages: [...], stream: true },
  { stream: true }
);
for await (const event of parseSSE(res)) {
  process.stdout.write(event.data);
}

// Shield scanning
const res = await client.proxy('listing-id', '/path', body, { shield: 'strict' });

// Rate a seller
await client.rate({ request_id: 'req-id', is_positive: true });

// Usage & settlements
const usage = await client.usage({ service: 'openai', limit: 50 });
const settlements = await client.settlements({ role: 'buyer' });
适用于无需CLI的Agent-to-Agent场景:
typescript
import { ProxyGateClient, parseSSE } from '@proxygate/sdk';

const client = await ProxyGateClient.create({
  keypairPath: '~/.proxygate/keypair.json',
});

// 查看余额
const { balance, available } = await client.balance();

// 浏览API
const apis = await client.apis({ service: 'openai', verified: true });
const categories = await client.categories();
const services = await client.services();

// 查看列表文档
const docs = await client.docs('listing-id');

// 发起代理请求
const res = await client.proxy('listing-id', '/v1/chat/completions', {
  model: 'gpt-4',
  messages: [{ role: 'user', content: 'Hello' }],
});

// SSE流式响应
const res = await client.proxy('listing-id', '/v1/chat/completions',
  { model: 'gpt-4', messages: [...], stream: true },
  { stream: true }
);
for await (const event of parseSSE(res)) {
  process.stdout.write(event.data);
}

// 防护扫描
const res = await client.proxy('listing-id', '/path', body, { shield: 'strict' });

// 给卖家评分
await client.rate({ request_id: 'req-id', is_positive: true });

// 使用情况与结算
const usage = await client.usage({ service: 'openai', limit: 50 });
const settlements = await client.settlements({ role: 'buyer' });

Success criteria

成功标准

  • Balance checked and sufficient for request
  • Listing ID identified from apis/pricing output
  • Proxy request returns upstream API response
  • Usage reflects the completed request
  • 已检查余额且余额足够发起请求
  • 已从apis/pricing输出中获取listing ID
  • 代理请求返回上游API响应
  • 使用记录中已体现完成的请求

Related skills

相关技能

NeedSkill
First-time setup
pg-setup
Buy API accessThis skill
Sell API capacity
pg-sell
Job marketplace
pg-jobs
Check status
pg-status
Update CLI/SDK
pg-update
需求技能
首次设置
pg-setup
购买API访问权限本技能
售卖API容量
pg-sell
工作市场
pg-jobs
查看状态
pg-status
更新CLI/SDK
pg-update