Tutorials

Free, Unlimited Amazon Nova API

This tutorial will show you how to use Puter.js to access Amazon Nova's powerful AI models for free, without any API keys or usage restrictions. Using Puter.js, you can leverage models like Nova Premier, Nova Pro, Nova Lite, and Nova Micro.

Puter is the pioneer of the "User-Pays" model, which allows developers to incorporate AI capabilities into their applications while users cover their own usage costs. This model enables developers to access advanced AI capabilities for free, without any API keys or server-side setup.

Getting Started

Puter.js works without any API keys or sign-ups. To start using Puter.js, include the following script tag in your HTML file, either in the <head> or <body> section:

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

You're now ready to use Puter.js for free access to Amazon Nova capabilities. No API keys or sign-ups are required.

Example 1Basic Chat with Nova Lite

Here's a simple example showing how to generate text using Amazon Nova Lite:

<html>
<body>
    <script src="https://js.puter.com/v2/"></script>
    <script>
        puter.ai.chat("Explain the concept of machine learning in simple terms", {
            model: 'amazon/nova-lite-v1'
        }).then(response => {
            puter.print(response);
        });
    </script>
</body>
</html>

Using the puter.ai.chat() function, you can generate text using Amazon Nova Lite, which provides a great balance of speed and capability for general conversational tasks.

Example 2Complex Reasoning with Nova Premier

Amazon Nova Premier is the most capable model in the Nova family, designed for complex reasoning and sophisticated problem-solving:

<html>
<body>
    <script src="https://js.puter.com/v2/"></script>
    <script>
        puter.ai.chat(
            "Analyze the potential long-term economic impacts of widespread AI adoption in manufacturing industries. Consider both benefits and challenges.",
            {
                model: 'amazon/nova-premier-v1'
            }
        ).then(response => {
            puter.print(response);
        });
    </script>
</body>
</html>

Example 3Ultra-Low Latency with Nova Micro

For applications requiring the fastest possible response times with text-only input, Nova Micro is the perfect choice:

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

            // Nova Micro with streaming for ultra-low latency
            const response = await puter.ai.chat(
                "What is the capital of France?",
                {
                    model: 'amazon/nova-micro-v1',
                    stream: true
                }
            );

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

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

Example 4Image Analysis with Nova Pro

Amazon Nova Pro supports multimodal capabilities, including image analysis. Here's how to analyze an image:

<html>
<body>
    <script src="https://js.puter.com/v2/"></script>
    <img src="https://assets.puter.site/doge.jpeg" id="image">
    <script>
        puter.ai.chat(
            "Describe what you see in this image in detail",
            "https://assets.puter.site/doge.jpeg",
            { model: 'amazon/nova-pro-v1' }
        ).then(response => {
            puter.print(response);
        });
    </script>
</body>
</html>

Example 5Streaming Responses

For longer responses, use streaming to get results in real-time:

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

            // Nova Premier with streaming
            outputDiv.innerHTML += '<h2>Nova Premier Response:</h2>';
            const premierResponse = await puter.ai.chat(
                "Explain the theory of relativity and its implications for space travel",
                {
                    model: 'amazon/nova-premier-v1',
                    stream: true
                }
            );

            for await (const part of premierResponse) {
                if (part?.text) {
                    outputDiv.innerHTML += part.text.replaceAll('\n', '<br>');
                }
            }
        }

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

Example 6Comparing Models

Here's how to compare responses from different Nova models:

<html>
<body>
    <script src="https://js.puter.com/v2/"></script>
    <script>
    (async () => {
        const question = 'What are the key principles of sustainable architecture?';

        // Nova Micro - fastest
        const micro_resp = await puter.ai.chat(
            question,
            {model: 'amazon/nova-micro-v1', stream: true}
        );
        puter.print('<h2>Nova Micro Response:</h2>');
        for await (const part of micro_resp) {
            if (part?.text) {
                puter.print(part.text.replaceAll('\n', '<br>'));
            }
        }

        // Nova Lite - balanced
        const lite_resp = await puter.ai.chat(
            question,
            {model: 'amazon/nova-lite-v1', stream: true}
        );
        puter.print('<h2>Nova Lite Response:</h2>');
        for await (const part of lite_resp) {
            if (part?.text) {
                puter.print(part.text.replaceAll('\n', '<br>'));
            }
        }

        // Nova Premier - most capable
        const premier_resp = await puter.ai.chat(
            question,
            {model: 'amazon/nova-premier-v1', stream: true}
        );
        puter.print('<h2>Nova Premier Response:</h2>');
        for await (const part of premier_resp) {
            if (part?.text) {
                puter.print(part.text.replaceAll('\n', '<br>'));
            }
        }
    })();
    </script>
</body>
</html>

List of Supported Amazon Nova Models

The following Amazon Nova models are supported by Puter.js:

amazon/nova-premier-v1
amazon/nova-pro-v1
amazon/nova-lite-v1
amazon/nova-micro-v1

That's it! You now have free access to Amazon Nova's powerful language models using Puter.js. This allows you to add sophisticated AI capabilities to your web applications without worrying about API keys or usage limits.

Related

Free, Serverless AI and Cloud

Start creating powerful web applications with Puter.js in seconds!

Get Started Now

Read the Docs Try the Playground