Tutorials

Free, Unlimited Inflection AI API

On this page

This tutorial will show you how to use Puter.js to access Inflection AI's models—from emotionally intelligent conversations to structured output generation, without any API keys or usage restrictions.

Puter is the pioneer of the "User-Pays" model, which allows developers to incorporate AI capabilities into their applications while each user will 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

To use Puter.js, import our NPM library 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 Inflection AI models and capabilities.

Example 1: Basic Chat with Inflection 3 Pi

To generate text using Inflection 3 Pi, use the puter.ai.chat() function:

puter.ai.chat("Tell me a fun trivia fact about space.", { model: "inflection/inflection-3-pi" })
    .then(response => {
        puter.print(response);
    });

Full code example:

<html>
<body>
    <script src="https://js.puter.com/v2/"></script>
    <script>
        puter.ai.chat("Tell me a fun trivia fact about space.", { model: "inflection/inflection-3-pi" })
            .then(response => {
                puter.print(response);
            });
    </script>
</body>
</html>

Example 2: Streaming Responses

For longer responses, use streaming with Inflection 3 Pi to get results in real-time:

<html>
<body>
    <script src="https://js.puter.com/v2/"></script>
    <script>
        async function streamResponse() {
            const response = await puter.ai.chat(
                "Write a short essay about the future of artificial intelligence.",
                { model: "inflection/inflection-3-pi", stream: true }
            );

            for await (const part of response) {
                puter.print(part?.text);
            }
        }

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

Example 3: Structured Output Generation

For structured output like JSON, use Inflection 3 Productivity which is optimized for precise instruction-following and structured data generation:

<html>
<body>
    <script src="https://js.puter.com/v2/"></script>
    <script>
        puter.ai.chat(
            `Generate a JSON object for a user profile with the following fields: name, email, age, and hobbies (as an array). Use realistic sample data.`,
            { model: "inflection/inflection-3-productivity" }
        ).then(response => {
            puter.print(response);
        });
    </script>
</body>
</html>

List of supported models

The following Inflection AI models are supported by Puter.js:

inflection/inflection-3-pi
inflection/inflection-3-productivity

Conclusion

Using Puter.js, you can access Inflection AI model capabilities without needing an API key or a backend. And thanks to the User-Pays model, your users cover their own AI usage, not you as the developer. This means you can build powerful applications without worrying about AI usage costs.

You can find all AI features supported by Puter.js in the documentation.

Free, Serverless AI and Cloud

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

Get Started Now

Read the Docs Try the Playground