openfin-setup
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseOpenFinance Setup
OpenFinance 设置
Agents only need one thing to use the OpenFinance backend: a valid API key.
Wallet creation and delegation happen out-of-band on openfinance.tech — by
the time an agent is involved, the user already has (or needs) a key.
Agent使用OpenFinance后端仅需一个条件:有效的API密钥。
钱包创建与授权需在openfinance.tech平台外完成——当Agent介入时,用户已拥有(或需要获取)密钥。
Step 1 — Locate the API key
步骤1 — 查找API密钥
Check, in order:
- Env var (preferred).
OPENFINANCE_API_KEY - Any project-level config the agent already has loaded (, secrets manager, MCP config, etc.).
.env - The current conversation — the user may have pasted it.
A valid key looks like followed by an opaque token.
open_按以下顺序检查:
- 环境变量(优先选择)。
OPENFINANCE_API_KEY - Agent已加载的任何项目级配置(、密钥管理器、MCP配置等)。
.env - 当前对话记录——用户可能已粘贴密钥。
有效的密钥格式为开头,后跟一串不透明的令牌。
open_Step 2 — If no key, ask
步骤2 — 若无密钥,询问用户
If none of the above turns up a key, ask the user once:
I need an OpenFinance API key () to call the backend. If you already have one, paste it here. If not, generate one at openfinance.tech and paste it back.open_…
Do not invent, guess, or proceed without one. Do not echo the key back
in chat once received — store it for the session and use it in headers.
若以上途径均未找到密钥,仅询问用户一次:
我需要一个OpenFinance API密钥(格式为)才能调用后端服务。如果您已拥有密钥,请在此处粘贴;如果没有,请前往openfinance.tech生成并粘贴回来。open_…
请勿自行编造、猜测密钥,或在无密钥的情况下继续操作。收到密钥后,请勿在聊天中回显——请在会话中存储密钥,并在请求头中使用。
Step 3 — Verify
步骤3 — 验证密钥
One call confirms the key works and the wallets are provisioned:
http
GET /agent/wallets
x-api-key: open_…Expected:
json
{ "ethereum": "0x…", "solana": "…" }- Either field may be if that chain isn't provisioned for the user on openfinance.tech. Read-only and same-chain EVM flows still work; only Solana-origin Relay executes need the Solana wallet.
null - → key is wrong or malformed; ask again or send the user back to openfinance.tech.
401 Invalid API key - → the user signed up but hasn't completed setup on openfinance.tech. Send them there.
412 Server is not authorized for this user
通过一次调用即可确认密钥有效且钱包已配置:
http
GET /agent/wallets
x-api-key: open_…预期返回:
json
{ "ethereum": "0x…", "solana": "…" }- 若用户未在openfinance.tech平台配置对应链,则任一字段可能为。只读操作和同链EVM流程仍可正常运行;仅Solana源的Relay执行需要Solana钱包。
null - 返回→ 密钥错误或格式不正确;请再次询问用户,或引导其前往openfinance.tech重新获取。
401 Invalid API key - 返回→ 用户已注册但未在openfinance.tech完成设置;请引导其前往该平台完成设置。
412 Server is not authorized for this user
Auth header on every call
每次调用均需携带认证头
All routes (except public Polymarket reads) take:
/agent/*http
x-api-key: open_…Authorization: Bearer open_…所有/agent/*路由(公开的Polymarket读取接口除外)均需携带:
http
x-api-key: open_…若框架偏好Bearer认证,同样有效。
Authorization: Bearer open_…Common failures
常见故障排查
| Symptom | Cause | Fix |
|---|---|---|
| Key not sent, malformed, or revoked | Confirm |
| User signed up but didn't finish setup | Send user to openfinance.tech to complete setup |
| Solana wallet not enabled for the user | User enables Solana wallet on openfinance.tech |
| 症状 | 原因 | 解决方法 |
|---|---|---|
| 未发送密钥、密钥格式错误或已被撤销 | 确认密钥以 |
| 用户已注册但未完成设置 | 引导用户前往openfinance.tech完成设置 |
| 用户未启用Solana钱包 | 用户需在openfinance.tech平台启用Solana钱包 |
What NOT to do
禁止操作
- Don't ship the raw API key into LLM context or logs. Pass it through headers only.
- Don't regenerate the key per call. It's long-lived — cache for the session.
- Don't try to onboard the user yourself (wallet delegation, Privy flows, etc.). That happens on openfinance.tech, not via the agent.
- 请勿将原始API密钥传入LLM上下文或日志中。仅通过请求头传递。
- 请勿每次调用都重新生成密钥。密钥为长期有效——请在会话中缓存。
- 请勿尝试自行引导用户完成注册流程(钱包授权、Privy流程等)。这些操作需在openfinance.tech平台完成,而非通过Agent。