Lana API
创建 Lana 消息
向 Solana AI 智能体 Lana 提问,并以事件流或单个 JSON 响应的形式获取答案。
POST
/
v1
/
lana
/
messages
curl --request POST \
--url https://beta.helius-rpc.com/v1/lana/messages \
--header 'Content-Type: application/json' \
--header 'X-Api-Key: <api-key>' \
--data '
{
"model": "lana-thinking",
"messages": [
{
"role": "user",
"content": "SOL 当前的价格是多少?"
}
],
"extensions": {
"read_only": true
}
}
'
{
"id": "msg_3f9c...",
"type": "message",
"role": "assistant",
"model": "lana-thinking",
"content": [
{
"type": "tool_use",
"id": "toolu_01...",
"name": "...",
"input": {
"mint": "So11111111111111111111111111111111111111112"
}
},
{
"type": "tool_result",
"tool_use_id": "toolu_01...",
"content": "{\"price\":..."
},
{
"type": "text",
"text": "SOL 的交易价格为……"
}
],
"stop_reason": "end_turn",
"usage": {
"input_tokens": 90800,
"output_tokens": 96,
"tool_calls": 1,
"prompt_tokens": 45600,
"context_window": 200000
}
}{
"type": "error",
"error": {
"type": "invalid_request_error",
"message": "max_tokens:max_tokens 必须小于或等于 8192"
}
}<string><string>{
"type": "error",
"error": {
"type": "invalid_request_error",
"message": "<string>"
}
}{
"type": "error",
"error": {
"type": "invalid_request_error",
"message": "<string>"
}
}{
"type": "error",
"error": {
"type": "invalid_request_error",
"message": "<string>"
}
}{
"type": "error",
"error": {
"type": "invalid_request_error",
"message": "<string>"
}
}{
"type": "error",
"error": {
"type": "invalid_request_error",
"message": "<string>"
}
}{
"type": "error",
"error": {
"type": "invalid_request_error",
"message": "<string>"
}
}使用
lana-thinking 时,每个请求消耗 10,000 积分;使用 lana-fast 时,每个请求消耗 2,000 积分。
需要付费套餐。免费套餐的请求会返回 403 Forbidden。
有关快速入门、流式事件和错误处理,请参阅 Lana API 指南。
请求参数
lana-thinking 用于多步骤分析,每轮最多可执行 20 个查询步骤;它可以流式传输推理过程。lana-fast 用于快速查询和单一事实,每轮最多可执行 4 个查询步骤。lana-thinkinglana-fast
Lana 在一个模型步骤中最多可以生成的输出 token 数量。包含查询的轮次需要执行多个步骤,因此该轮次的
output_tokens 总数可能更高。低于 2,048 时,lana-thinking 不会进行推理。允许 Lana 读取某个地址历史记录中最多 10,000 笔交易(统计数量和总额时最多 50,000 笔),每轮最多扫描 3 次。仅支持主网。如果不启用,Lana 每次查询最多读取 100 笔交易。价格仍为相同的固定价格。
请求体
application/json
响应
对话轮次已运行。使用 "stream": false 时,返回一个 JSON 对象。检查 stop_reason:即使某个轮次在生成内容后失败,仍会返回 200,其中 stop_reason: "error",
并包含一个 error 对象。
使用 "stream": true 时,返回服务器发送事件流。每个事件包含一行
event: <type> 和一行 data: <json>,之后是一个空行。流
以 message_start 开始,并始终以 message_end 或 error 结束。可能会添加新的事件
类型和字段;请忽略无法识别的内容。
非流式响应。回答由按顺序连接的 text 块组成。
此页面对您有帮助吗?
⌘I
curl --request POST \
--url https://beta.helius-rpc.com/v1/lana/messages \
--header 'Content-Type: application/json' \
--header 'X-Api-Key: <api-key>' \
--data '
{
"model": "lana-thinking",
"messages": [
{
"role": "user",
"content": "SOL 当前的价格是多少?"
}
],
"extensions": {
"read_only": true
}
}
'
{
"id": "msg_3f9c...",
"type": "message",
"role": "assistant",
"model": "lana-thinking",
"content": [
{
"type": "tool_use",
"id": "toolu_01...",
"name": "...",
"input": {
"mint": "So11111111111111111111111111111111111111112"
}
},
{
"type": "tool_result",
"tool_use_id": "toolu_01...",
"content": "{\"price\":..."
},
{
"type": "text",
"text": "SOL 的交易价格为……"
}
],
"stop_reason": "end_turn",
"usage": {
"input_tokens": 90800,
"output_tokens": 96,
"tool_calls": 1,
"prompt_tokens": 45600,
"context_window": 200000
}
}{
"type": "error",
"error": {
"type": "invalid_request_error",
"message": "max_tokens:max_tokens 必须小于或等于 8192"
}
}<string><string>{
"type": "error",
"error": {
"type": "invalid_request_error",
"message": "<string>"
}
}{
"type": "error",
"error": {
"type": "invalid_request_error",
"message": "<string>"
}
}{
"type": "error",
"error": {
"type": "invalid_request_error",
"message": "<string>"
}
}{
"type": "error",
"error": {
"type": "invalid_request_error",
"message": "<string>"
}
}{
"type": "error",
"error": {
"type": "invalid_request_error",
"message": "<string>"
}
}{
"type": "error",
"error": {
"type": "invalid_request_error",
"message": "<string>"
}
}