跳到主要内容

Mirabase 知识底座

Memory for agents. And more.

同一 API 接入文件库、知识库与长期记忆
写入即留版本、建索引;上下文按 Token 预算组装,附引用

一个 API Key,统一管理上下文

以提示词或代码接入文件库、知识库与长期记忆

  1. 获取 API Key

    免费开始
  2. 将提示词交给 Agent

Base URLhttps://api.mirabase.dev

命令行环境
请求示例
curl -X PUT "https://api.mirabase.dev/v2/spaces/default/files?path=/notes/hello.md" \
  -H "Authorization: Bearer $MIRABASE_API_KEY" \
  -H "Content-Type: text/markdown" \
  --data-binary "Mirabase keeps files, knowledge and memory in one place."
请求示例
import { Mirabase } from "@mirabase/sdk/developer";

const mirabase = new Mirabase(); // MIRABASE_API_KEY

const written = await mirabase.files.write(
  "/notes/hello.md",
  "Mirabase keeps files, knowledge and memory in one place.",
  { contentType: "text/markdown" },
);
请求示例
from mirabase import Mirabase

mb = Mirabase()  # MIRABASE_API_KEY

written = mb.files.write(
    "/notes/hello.md",
    "Mirabase keeps files, knowledge and memory in one place.",
    content_type="text/markdown",
)
响应结构示例
{
  "entry": {
    "id": "<id>",
    "space_id": "<space_id>",
    "title": "Launch notes",
    "latest_version_id": "<latest_version_id>",
    "metadata": {},
    "created_at": "2026-11-06T00:00:00Z",
    "updated_at": "2026-11-06T00:00:00Z",
    "file": {
      "path": "/notes/hello.md",
      "size": 1,
      "media_type": "<media_type>",
      "etag": "<etag>"
    },
    "knowledge": {
      "state": "readable"
    },
    "memory": {
      "scope": "project",
      "kind": "<kind>",
      "pinned": false,
      "exclude": false
    },
    "memory_exclude": false,
    "access": {
      "role": "owner",
      "capabilities": [
        "knowledge:read"
      ]
    }
  },
  "version_id": "<version_id>",
  "version_created": false
}
命令行环境

需先写入文件

请求示例
curl -X POST https://api.mirabase.dev/v2/retrieval/search \
  -H "Authorization: Bearer $MIRABASE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"query": "where do files and memory live"}'

需先写入文件

请求示例
import { Mirabase } from "@mirabase/sdk/developer";

const mirabase = new Mirabase(); // MIRABASE_API_KEY

const hits = await mirabase.search("where do files and memory live");

需先写入文件

请求示例
from mirabase import Mirabase

mb = Mirabase()  # MIRABASE_API_KEY

hits = mb.search("where do files and memory live")
响应结构示例
{
  "data": [
    {
      "entry_id": "ent_01JD2M8Z4K",
      "version_id": "ver_01JD2M8Z4M",
      "space_id": "col_01JD2M7QK3",
      "title": "plan.md",
      "text": "The launch of version 2.4 moved to Friday 21 November.",
      "score": 0.82,
      "citation_id": "c1",
      "source_type": "file",
      "path": "/notes/plan.md",
      "modified_at": "2026-11-17T08:02:00Z"
    }
  ],
  "trace_id": "trc_01JD2M7R",
  "partial": false
}
命令行环境
请求示例
curl -X POST "https://api.mirabase.dev/v2/spaces/default/ingest" \
  -H "Authorization: Bearer $MIRABASE_API_KEY" \
  -H "Idempotency-Key: chat-42-batch-1" \
  -H "Content-Type: application/json" \
  -d '{"kind": "conversation", "session_id": "chat-42", "messages": [
    {"role": "user", "content": "Let us ship on Thursdays from now on.", "timestamp": 1762416000000},
    {"role": "assistant", "content": "Noted: releases on Thursdays."}
  ]}'
请求示例
import { Mirabase } from "@mirabase/sdk/developer";

const mirabase = new Mirabase(); // MIRABASE_API_KEY

const receipt = await mirabase.conversations.add(
  [
    { role: "user", content: "Let us ship on Thursdays from now on.", timestamp: 1762416000000 },
    { role: "assistant", content: "Noted: releases on Thursdays." },
  ],
  { sessionId: "chat-42", idempotencyKey: "chat-42-batch-1" },
);
请求示例
from mirabase import Mirabase

mb = Mirabase()  # MIRABASE_API_KEY

receipt = mb.conversations.add(
    [
        {"role": "user", "content": "Let us ship on Thursdays from now on.", "timestamp": 1762416000000},
        {"role": "assistant", "content": "Noted: releases on Thursdays."},
    ],
    session_id="chat-42",
    idempotency_key="chat-42-batch-1",
)
响应结构示例
{
  "entry_id": "ent_01JD2M9B2D",
  "version_id": "ver_01JD2M9B2E",
  "job_id": "job_01JD2M9B2F",
  "knowledge": {
    "state": "readable"
  },
  "memory_status": "confirmed",
  "memory": {
    "state": "pending"
  },
  "secrets_redacted": 0
}
命令行环境

需先写入文件

请求示例
curl -X POST https://api.mirabase.dev/v2/retrieval/context \
  -H "Authorization: Bearer $MIRABASE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"task": "Fix the failing upload test", "purpose": "coding", "tier": "standard", "budget_tokens": 4000}'

需先写入文件

请求示例
import { Mirabase } from "@mirabase/sdk/developer";

const mirabase = new Mirabase(); // MIRABASE_API_KEY

const pack = await mirabase.context("Fix the failing upload test", {
  purpose: "coding",
  tier: "standard",
  budget_tokens: 4000,
});

需先写入文件

请求示例
from mirabase import Mirabase

mb = Mirabase()  # MIRABASE_API_KEY

pack = mb.context(
    "Fix the failing upload test",
    purpose="coding",
    tier="standard",
    budget_tokens=4000,
)
响应结构示例
{
  "pack_id": "<pack_id>",
  "items": [
    {
      "entry_id": "<entry_id>",
      "version_id": "<version_id>",
      "title": "Launch notes",
      "text": "The launch moved to March 14.",
      "citation_id": "<citation_id>",
      "source": "memory"
    }
  ],
  "route": {
    "purpose": "task",
    "tier": "fast",
    "rules_fired": [
      "<rules_fired>"
    ],
    "sources": [
      {
        "source": "memory",
        "budget": 1,
        "used": 1,
        "picked": 1,
        "omitted": 1,
        "why": "<why>"
      }
    ],
    "unused_tokens": 1
  },
  "tokens_used": 1,
  "budget_tokens": 1,
  "tokenizer": "cl100k_base",
  "omitted": {
    "count": 1,
    "max_score": 1
  },
  "scope_used": {
    "space_ids": [
      "<space_ids>"
    ]
  },
  "partial": false
}

安全、可靠与快速

  • 安全

    静态加密,仅限 HTTPS,租户按行隔离

    每个 Agent 独立限权 Key;操作全程审计

  • 可靠性

    不可变版本、快照、废纸篓可恢复

    幂等写入;备份保留 7 天

  • 速度

    线上中位耗时:检索约 0.64 秒,组装约 1.2 秒

    流式回答;按 Token 预算组装

Mirabase Cloud