For the complete documentation index, see llms.txt. This page is also available as Markdown.

API 参考文档(API 密钥)

Minara Agent API 端点的技术规范。

开发者 API

与 Minara 对话式 AI 交互的核心端点。

Developer Chat

post

Developer chat endpoint supporting streaming, non-streaming, and asynchronous (background) response modes, with optional requestId-based idempotency.

授权
Authorizationstring必填

Format: Authorization: Bearer <YOUR_API_KEY>

请求体
modestring · enum必填

Required. Model mode: 'fast' for quick responses, 'expert' for in-depth analysis.

可能的值:
streamboolean可选

Optional. Set to true for streaming (SSE), false (default) for standard JSON response. Cannot be combined with background.

Default: false
backgroundboolean可选

Optional. Set to true to run a non-streaming request asynchronously and poll the result later. Requires stream: false.

Default: false
requestIdstring · 最小值: 1 · 最大值: 128可选

Optional. Client-generated idempotency key, unique within the API key. 1-128 chars matching ^[A-Za-z0-9._:-]+$.

Pattern: ^[A-Za-z0-9._:-]+$
chatIdstring可选

Optional. Existing chat to continue. A new chat is created if omitted.

响应
200

Successful response (stream/background not set, or a completed idempotent replay).

idstring可选

Server-assigned request id. Present when a requestId was supplied.

requestIdstring可选

Your idempotency key, echoed when one was provided.

chatIdstring可选

Unique conversation ID.

messageIdstring可选

Unique message ID for this response.

contentstring可选

The AI-generated response content.

usageobject可选

Usage statistics for the request.

post/v1/developer/chat

Get Chat Request Status

get

Retrieve the status and result of any requestId-backed request (sync, stream, or background) by either the server-assigned id or your requestId. Records are retained for 24 hours after reaching a terminal state.

授权
Authorizationstring必填

Format: Authorization: Bearer <YOUR_API_KEY>

路径参数
idstring必填

The server-assigned id (e.g. bg_abc123) or your requestId. Must use the same API key that created the job.

响应
200

Request status and result (if completed).

application/json
idstring可选

Server-assigned request id.

requestIdstring可选

Your idempotency key, if one was provided.

chatIdstring可选

Chat the request belongs to.

statusstring · enum可选

Current lifecycle status of the request.

可能的值:
executionModestring · enum可选

How the request is being executed.

可能的值:
createdAtstring · date-time可选
startedAtstring · date-time可选
completedAtstring · date-time可选
expiresAtstring · date-time可选

When the record is removed (24h after reaching a terminal state).

get/v1/developer/chat/requests/{id}

Intent to Swap Transaction

post

Convert natural language trading intent into an executable swap transaction payload. Compatible with OKX DEX by default.

授权
Authorizationstring必填

Format: Authorization: Bearer <YOUR_API_KEY>

请求体
intentstring必填

Required. Natural language swap intent (e.g., 'swap 0.1 ETH to USDC').

walletAddressstring必填

Required. User wallet address (0x...).

chainstring可选

Optional. Chain name (e.g., 'base', 'ethereum', 'bsc', 'arbitrum', 'optimism').

响应
200

Swap transaction generated

application/json
post/v1/developer/intent-to-swap-tx

Perpetual Trading Suggestion

post

Get AI-powered perpetual trading suggestions with long/short recommendations, entry price, stop loss, take profit levels, and confidence score based on comprehensive market analysis.

授权
Authorizationstring必填

Format: Authorization: Bearer <YOUR_API_KEY>

请求体
symbolstring必填

Required. Trading symbol (e.g., 'BTC', 'ETH', 'SOL').

stylestring · enum可选

Optional. Trading style: 'scalping', 'day-trading', or 'swing-trading'. Default: 'scalping'.

Default: scalping可能的值:
marginUSDnumber可选

Optional. Margin in USD. Default: 1000.

Default: 1000
leveragenumber · 最小值: 1 · 最大值: 40可选

Optional. Leverage multiplier (max: 40). Default: 10.

Default: 10
strategystring可选

Optional. Strategy type. Default: 'max-profit'. More strategies coming soon.

Default: max-profit
响应
200

Perpetual trading suggestion

application/json
entryPricenumber可选

Recommended entry price.

sidestring · enum可选

Trading side recommendation.

可能的值:
stopLossPricenumber可选

Recommended stop loss price.

takeProfitPricenumber可选

Recommended take profit price.

confidencenumber · 最大值: 100可选

Confidence score (0-100).

reasonsstring[]可选

Analysis reasons based on technical indicators.

risksstring[]可选

Risk factors to consider.

post/v1/developer/perp-trading-suggestion

Prediction Market Analysis

post

AI-powered prediction market analysis. Analyze prediction market events and get probability estimates for each outcome with detailed reasoning.

授权
Authorizationstring必填

Format: Authorization: Bearer <YOUR_API_KEY>

请求体
linkstring必填

Required. Prediction market page link (e.g., Polymarket event URL).

modestring · enum必填

Required. Chat mode: 'fast' or 'expert'.

可能的值:
only_resultboolean可选

Optional. Only return prediction probabilities without reasoning. Default: false.

Default: false
customPromptstring可选

Optional. Custom instructions to guide the analysis. Use this to specify focus areas, risk preferences, or analysis style.

响应
200

Prediction market analysis

application/json
reasoningstring可选

AI reasoning and analysis (empty if only_result=true).

post/v1/developer/prediction-market-ask

后台聊天与幂等性

聊天 上述端点通过两个可选字段支持异步执行和幂等重试: 后台requestId。请求/响应结构已在上方的 OpenAPI 块中记录;本节涵盖架构无法表达的行为规则。

后台执行

设置 background: true (仅在与 stream: false)以便请求立即被接受(202 Accepted)并异步处理。轮询状态端点(GET /v1/developer/chat/requests/{id}),使用返回的 id (或你的 requestId),直到其到达终态。将 background: truestream: true 会返回 400 Bad Request.

幂等性 requestId

requestId 是客户端生成的密钥,且在 单个 API 密钥内唯一,可让你安全地重试请求,而不会生成(并因此产生计费的)重复结果。它适用于同步、流式和后台模式。

  • 相同密钥,相同负载 → 复用现有任务。你会返回其当前状态/结果,而不是重新生成。如果它仍在运行,你会收到 202 Accepted;如果它已完成,你会收到 200 OK 及其结果。

  • 相同密钥,不同负载409 Conflict (“requestId 已与不同请求一起使用”).

  • 重复使用已过期的密钥409 Conflict (“requestId 已过期,无法重复使用”).

对于携带 requestId的流式请求,响应包含一个 X-Request-Id 头,即使客户端断开连接,生成也会继续,之后可通过状态端点获取最终结果。

聊天请求状态说明

状态端点(GET /v1/developer/chat/requests/{id})接受服务器分配的 id (例如 bg_abc123)或你的 requestId,并且必须使用创建该任务的同一个 API 密钥。

  • 记录保留 24 小时 ,在到达终态(expiresAt)后保留,然后删除。

  • 不存在或已过期的请求查询会返回 404 Not Found.

  • 中断或超时的任务会明确失败(它们 不会 自动重试)。失败 代码 是以下之一: processing_error, processing_interrupted, processing_timeout。提交新请求以重试。

最后更新于

这有帮助吗?