Tutorials

Free, Unlimited Image Recognition API

On this page

Want to add image recognition to your app? With Puter.js, you can analyze images using AI models like GPT and Gemini — no API keys, no backend, and no setup required.

Puter pioneered the User-Pays model, where users cover their own image recognition costs. This means you can ship image recognition features without worrying about API keys or infrastructure.

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>

That's it - you're ready to start recognizing images.

Example 1: Basic Image Analysis

To analyze an image, pass an image URL as the second argument to puter.ai.chat(). Here's a complete working example:

<html>
<body>
    <script src="https://js.puter.com/v2/"></script>
    <script>
        puter.ai
            .chat(`What do you see?`, `https://assets.puter.site/doge.jpeg`, {
                model: "openai/gpt-5.4-nano",
            })
            .then(puter.print);
    </script>
</body>
</html>

This sends the image to OpenAI's GPT-5.4 Nano model, which will describe what it sees in the image.

Example 2: Using a Different Model

You can use different models for image recognition. Here's the same example using Google's Gemini 2.5 Flash:

<html>
<body>
    <script src="https://js.puter.com/v2/"></script>
    <script>
        puter.ai
            .chat(`What do you see?`, `https://assets.puter.site/doge.jpeg`, {
                model: "google/gemini-2.5-flash",
            })
            .then(puter.print);
    </script>
</body>
</html>

Example 3: Analyze Multiple Media

You can pass multiple inputs - both images and videos - as an array. The model will analyze all of them together:

<html>
<body>
    <script src="https://js.puter.com/v2/"></script>
    <script>
        puter.ai
            .chat("Describe these", [
                "https://assets.puter.site/doge.jpeg",
                "https://assets.puter.site/puppy.mp4",
            ], { model: "google/gemini-2.5-flash" })
            .then(puter.print);
    </script>
</body>
</html>

Conclusion

That's it! You now have free, unlimited access to image recognition capabilities using Puter.js. Analyze images, combine them with videos, and use different AI models - all without API keys or backend servers.

Free, Serverless AI and Cloud

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

Get Started Now

Read the Docs Try the Playground