Runtime API Examples
This page demonstrates usage of some of the runtime APIs provided by VitePress.
The main useData() API can be used to access site, theme, and page data for the current page. It works in both .md and .vue files:
md
<script setup>
import { useData } from 'vitepress'
const { theme, page, frontmatter } = useData()
</script>
## Results
### Theme Data
<pre>{{ theme }}</pre>
### Page Data
<pre>{{ page }}</pre>
### Page Frontmatter
<pre>{{ frontmatter }}</pre>Results
Theme Data
{
"nav": [
{
"text": "Home",
"link": "/en/"
},
{
"text": "User Guide",
"link": "/en/guide/register-account"
},
{
"text": "Tool Integration",
"link": "/en/tools/cursor"
},
{
"text": "Support & FAQ",
"link": "/en/support/pre-sales-after-sales"
}
],
"sidebar": {
"/en/quick-start/": [
{
"text": "Quick Start",
"items": [
{
"text": "Welcome",
"link": "/en/quick-start/welcome"
},
{
"text": "What Is a Relay",
"link": "/en/quick-start/what-is-relay"
}
]
},
{
"text": "User Guide",
"items": [
{
"text": "Register an Account",
"link": "/en/guide/register-account"
},
{
"text": "Create an API Key",
"link": "/en/guide/create-api-key"
},
{
"text": "Models and Pricing",
"link": "/en/guide/models-pricing"
},
{
"text": "Billing and Quota",
"link": "/en/guide/billing-quota"
}
]
}
],
"/en/guide/": [
{
"text": "Quick Start",
"items": [
{
"text": "Welcome",
"link": "/en/quick-start/welcome"
},
{
"text": "What Is a Relay",
"link": "/en/quick-start/what-is-relay"
}
]
},
{
"text": "User Guide",
"items": [
{
"text": "Register an Account",
"link": "/en/guide/register-account"
},
{
"text": "Create an API Key",
"link": "/en/guide/create-api-key"
},
{
"text": "Models and Pricing",
"link": "/en/guide/models-pricing"
},
{
"text": "Billing and Quota",
"link": "/en/guide/billing-quota"
}
]
}
],
"/en/tools/": [
{
"text": "AI IDE",
"items": [
{
"text": "Cursor",
"link": "/en/tools/cursor"
},
{
"text": "Trae",
"link": "/en/tools/trae"
},
{
"text": "Codex",
"link": "/en/tools/codex"
}
]
},
{
"text": "Coding Agent (Terminal)",
"items": [
{
"text": "Claude Code",
"link": "/en/tools/claude-code"
},
{
"text": "Codex CLI",
"link": "/en/tools/codex-cli"
},
{
"text": "CodeBuddy",
"link": "/en/tools/codebuddy"
}
]
},
{
"text": "AI Chat Client",
"items": [
{
"text": "Cherry Studio",
"link": "/en/tools/cherry-studio"
},
{
"text": "Chatbox",
"link": "/en/tools/chatbox"
},
{
"text": "Open WebUI",
"link": "/en/tools/open-webui"
}
]
},
{
"text": "Agent Framework / SDK",
"items": [
{
"text": "LangChain",
"link": "/en/tools/langchain"
}
]
},
{
"text": "Agent Ecosystem Tools",
"items": [
{
"text": "CC Switch",
"link": "/en/tools/cc-switch"
},
{
"text": "Hermes",
"link": "/en/tools/hermes"
},
{
"text": "Claude Code Hub (CCH)",
"link": "/en/tools/claude-code-hub"
}
]
},
{
"text": "Open Source AI Dev Tools",
"items": [
{
"text": "OpenClaw",
"link": "/en/tools/openclaw"
},
{
"text": "OpenCode",
"link": "/en/tools/opencode"
}
]
}
],
"/en/support/": [
{
"text": "Support & FAQ",
"items": [
{
"text": "Pre-sales and After-sales",
"link": "/en/support/pre-sales-after-sales"
},
{
"text": "FAQ",
"link": "/en/support/faq"
},
{
"text": "Troubleshooting",
"link": "/en/support/troubleshooting"
},
{
"text": "Legal Terms",
"link": "/en/support/legal-terms"
},
{
"text": "Privacy Policy",
"link": "/en/support/privacy-policy"
},
{
"text": "Contact and Groups",
"link": "/en/support/contact-groups"
}
]
}
]
},
"logo": "/logo.png",
"socialLinks": [
{
"icon": "github",
"link": "https://github.com/vuejs/vitepress"
}
]
}Page Data
{
"title": "Runtime API Examples",
"description": "",
"frontmatter": {
"outline": "deep"
},
"headers": [],
"relativePath": "en/api-examples.md",
"filePath": "en/api-examples.md"
}Page Frontmatter
{
"outline": "deep"
}More
Check out the documentation for the full list of runtime APIs.
