Skip to content

A minimalist starter for building generative 3D apps using OpenRouter, Next & Three

Notifications You must be signed in to change notification settings

YanniKouloumbis/openrouter-3d-starter

 
 

Repository files navigation

window.ai Generative 3D Starter

screenshot of the web demo

Generate 3D objects in the browser with window.ai and OpenAI's shap-e.

Try the Web Demo!

How it works

  1. Retrieve the window.ai object from the browser
const ai = useRef(null);
useEffect(() => {
    const init = async () => {
      try {
        const windowAI = await getWindowAI();
        ai.current = windowAI;
        ...
      } catch (error) {
        ...
      }
    };
    init();
}, []);
  1. Supply a prompt object and numInferenceSteps, recieve a data URI
const generate3DObject = async () => {
    const promptObject = { prompt: inputText };
    const output = await ai.current.BETA_generate3DObject(promptObject, {
      extension: "application/x-ply",
      numInferenceSteps: numInferenceSteps,
    });

    return output[0].uri;
};

See this demo repo for a more feature rich example (Neon + GCS integration for hosting models)

About

A minimalist starter for building generative 3D apps using OpenRouter, Next & Three

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 87.5%
  • JavaScript 8.3%
  • CSS 4.2%