Ship a Full-Stack App with One Prompt

Copy this prompt into your AI coding agent, or open it in one below.

Give this to your AI Create a to-do list app using Puter.js

Coding manually? see the guide

Tutorials

Free, Unlimited Meta Muse API

On this page

In this tutorial, you will learn how to add Meta's Muse models into your application for free using Puter.js. The Muse family from Meta Superintelligence Labs includes Muse Wonder, the Muse Spark line, and the smaller Muse Glimmer 30B, covering agentic work, coding, and multimodal tasks.

Puter.js uses the User-Pays model, where users of your application cover their own AI costs. This means you as a developer don't pay anything for your users' usage, making your app practically free to run. You can scale to unlimited users and pay nothing for the AI or server usage.

Getting Started

To use Puter.js, import our npm module in your project:

// npm install @heyputer/puter.js
import { puter } from '@heyputer/puter.js';

Or alternatively, add our script via CDN if you are working directly with HTML, simply add it to the <head> or <body> section of your code:

<script src="https://js.puter.com/v2/"></script>

Nothing else is required to start using Puter.js for free access to Meta's Muse models.

Example 1: Basic Text Generation with Muse Wonder

To generate text, use the puter.ai.chat() function with Muse Wonder, Meta's agent model for long, multi-step tasks:

puter.ai.chat(
    "Plan the steps to migrate a small web app from REST to GraphQL, and list the risks at each step.",
    { model: "meta/muse-wonder" }
).then(response => {
    puter.print(response);
});

Full code example:

<html>
<body>
    <script src="https://js.puter.com/v2/"></script>
    <script>
        puter.ai.chat(
            "Plan the steps to migrate a small web app from REST to GraphQL, and list the risks at each step.",
            { model: "meta/muse-wonder" }
        ).then(response => {
            puter.print(response);
        });
    </script>
</body>
</html>

Example 2: Streaming a Coding Task with Muse Spark 1.3

For longer responses such as generated code, use streaming to show the output as it arrives. This example uses Muse Spark 1.3:

<html>
<body>
    <div id="response"></div>
    <script src="https://js.puter.com/v2/"></script>
    <script>
        async function streamResponse() {
            const outputDiv = document.getElementById('response');

            const response = await puter.ai.chat(
                "Write a JavaScript function that debounces another function, then explain how it works line by line.",
                { model: 'meta/muse-spark-1.3', stream: true }
            );

            for await (const part of response) {
                if (part?.text) {
                    outputDiv.innerHTML += part.text;
                }
            }
        }

        streamResponse();
    </script>
</body>
</html>

Example 3: Image Analysis with Muse Glimmer 30B

Muse models accept images as input. Pass an image URL to puter.ai.chat() along with your prompt. This example uses Muse Glimmer 30B:

<html>
<body>
    <script src="https://js.puter.com/v2/"></script>
    <script>
        puter.ai.chat(
            "What do you see in this image?",
            "https://assets.puter.site/doge.jpeg",
            { model: "meta/muse-glimmer-30b" }
        ).then(response => {
            puter.print(response);
        });
    </script>
</body>
</html>

Example 4: Compare Muse Spark Versions

All Muse Spark versions share the same API, so you can switch between them by changing the model parameter. This example sends the same prompt to Muse Spark 1.2 and Muse Spark 1.1:

<html>
<body>
    <script src="https://js.puter.com/v2/"></script>
    <script>
        const prompt = "Explain the difference between a process and a thread.";

        puter.ai.chat(prompt, { model: "meta/muse-spark-1.2" })
            .then(response => {
                puter.print("<h2>Muse Spark 1.2</h2>");
                puter.print(response);
            });

        puter.ai.chat(prompt, { model: "meta/muse-spark-1.1" })
            .then(response => {
                puter.print("<h2>Muse Spark 1.1</h2>");
                puter.print(response);
            });
    </script>
</body>
</html>

Available Models

The following Meta Muse models are supported by Puter.js:

meta/muse-wonder
meta/muse-spark-1.3
meta/muse-glimmer-30b
meta/muse-spark-1.2
meta/muse-spark-1.1

Replace the model name in the puter.ai.chat() function to use a different model.

Conclusion

You now have free access to Meta's Muse models using Puter.js. This allows you to use Muse Wonder, Muse Spark, and Muse Glimmer for text generation, coding, and image understanding without needing API keys or backend infrastructure.

Ship a Full-Stack App with One Prompt

Give this to your AI Build an AI chat app using Puter.js

Coding manually? see the guide