← Back to Blog

xg.glass: Develop an AI Glasses Applications in 10 Lines of Code and Easily Deploy onto Different Glasses

Jiayang Xu, Yufan Zhuang, Zijie Li, Jun Zhang, Zili Meng

GitHubhkust-spark/xg-glass-sdk

Why Did We Build xg.glass?

The growth of smart glasses depends on a healthy ecosystem and truly breakthrough applications.
However, while new smart-glasses manufacturers keep emerging, developers are facing two major challenges—both of which we have personally experienced:

1️⃣ Overly complex low-level interfaces
If I simply want to design an algorithm or build an application, I often get stuck dealing with Bluetooth, WiFi connections, and other low-level details that are hard to understand and even harder to debug.

2️⃣ Extremely high cross-platform migration cost
An app developed for Rokid usually needs to be almost completely redesigned and reimplemented to run on RayNeo.

xg.glass was created to solve these exact problems.
We want to turn our hard-earned experience into a shared foundation for the broader developer community.

We strongly believe that:

If the smart-glasses industry enters its next growth wave, it will be driven by truly iconic applications.
And those applications cannot be built without the power of the community.

xg.glass aims to lower the barrier for smart-glasses development and help the community discover the next breakout app.


What Does xg.glass Do?

At their core, smart glasses only require four fundamental interfaces:

  • 🎥 Video input (camera)
  • 🎙️ Audio input (microphone)
  • 🖥️ Video output (display)
  • 🔊 Audio output (speaker)

xg.glass exposes only these four interfaces to developers.
All other complexities are hidden inside our SDK.

This means:

  • You can build a glasses-based application as fast as possible
  • You don’t need to worry about Bluetooth, connectivity, or device-specific quirks
  • You don’t have to guess which hardware platform will have enough users

Under the hood, xg.glass already wraps SDKs from multiple smart-glasses vendors and device types.


A Simple Example

With just 10 lines of code, you can build a vision-based translation application.

📦 Source code:
https://github.com/hkust-spark/xg-glass-app

override suspend fun run(ctx: UniversalAppContext): Result<Unit> {
    val img = ctx.client.capturePhoto().getOrThrow()
    val b64 = Base64.getEncoder().encodeToString(img.jpegBytes)
    val req = chatCompletionRequest {
        model = ModelId("gpt-4o-mini")
        messages { user { content { text("Translate the text in this image to Chinese. Output only the result."); image("data:image/jpeg;base64,$b64") } } }
    }
    val text = openAI.chatCompletion(req).choices.firstOrNull()?.message?.content.orEmpty().ifBlank { "No text" }
    return ctx.client.display(text, DisplayOptions())
}

After installing xg.glass, simply run:

xg-glass run TranslationEntry.kt

This will generate an APK automatically.
Download the APK to your phone, and as long as the glasses are supported by xg.glass, the app will connect and run—regardless of the specific hardware model.


Which Glasses Are Currently Supported?

We currently support selected models from:

  • Rokid
  • RayNeo
  • Frame

We also support a simulator for development and testing that can run on your PC with a webcam.

More devices are coming soon. Please check the GitHub repository for the latest development progress.
We also warmly welcome community contributions to help us support more brands and devices.


What Does xg.glass Mean?

  • XG stands for neXt Generation (next-generation glasses)

If you’re interested in smart glasses, AI applications, or cross-platform development, we’d love for you to join us and help shape what comes next 🚀