OpenAI, Gemini, Llama, Mistral & more
Define ScreenshotDEV as a function/tool for any LLM that supports function calling. Works with OpenAI, Google Gemini, Meta Llama, Mistral, and any model with tool use support. One simple HTTP call — no SDK needed.
Install, configure, and start capturing.
Define a screenshot function/tool in your LLM's format. The schema is simple — just a URL and optional parameters.
{
"name": "screenshot",
"description": "Capture a screenshot of a website",
"parameters": {
"type": "object",
"properties": {
"url": {
"type": "string",
"description": "The URL to capture"
},
"full_page": {
"type": "boolean",
"description": "Capture the full page"
},
"dark_mode": {
"type": "boolean",
"description": "Render in dark mode"
}
},
"required": ["url"]
}
}When the model calls the tool, make a GET request to the ScreenshotDEV API and return the JSON response.
async function screenshot({ url, ...opts }) {
const params = new URLSearchParams({
url,
access_key: process.env.SSDEV_KEY,
format: "webp",
...opts
});
const res = await fetch(
`https://api.screenshotdev.com/v1/screenshot?${params}`
);
return res.json();
}Add the tool to your model's tool list. When the model decides a screenshot is needed, it will call your function.
// OpenAI example
const response = await openai.chat.completions.create({
model: "gpt-4o",
messages: [...],
tools: [{
type: "function",
function: screenshotTool
}]
});When the model returns a tool call, execute the function and feed the result back for the model to reason about.
// When model calls the tool:
const toolCall = response.choices[0].message.tool_calls[0];
const args = JSON.parse(toolCall.function.arguments);
const result = await screenshot(args);
// Feed result back to the model
messages.push({
role: "tool",
tool_call_id: toolCall.id,
content: JSON.stringify(result)
});import OpenAI from "openai";
const openai = new OpenAI();
// 1. Define the tool
const tools = [{
type: "function",
function: {
name: "screenshot",
description: "Capture a website screenshot",
parameters: {
type: "object",
properties: {
url: { type: "string" },
full_page: { type: "boolean" },
dark_mode: { type: "boolean" },
block_ads: { type: "boolean" }
},
required: ["url"]
}
}
}];
// 2. Implement it
async function screenshot({ url, ...opts }) {
const params = new URLSearchParams({
url,
access_key: process.env.SSDEV_KEY,
format: "webp",
...Object.fromEntries(
Object.entries(opts).map(([k, v]) => [k, String(v)])
)
});
const res = await fetch(
`https://api.screenshotdev.com/v1/screenshot?${params}`
);
return res.json();
}
// 3. Let the model use it
const response = await openai.chat.completions.create({
model: "gpt-4o",
messages: [
{ role: "user", content: "Screenshot acme.com/pricing" }
],
tools
});
// → Model returns:
// tool_calls: [{ function: {
// name: "screenshot",
// arguments: '{"url":"https://acme.com/pricing"}'
// }}]Pro tip: Add a 'usage' tool as well so the model can check remaining quota before making requests. This prevents rate limit errors in autonomous workflows.
No credit card required
Give your agent the ability to visually browse the web. Capture pages and let the model analyze layouts, content, and design.
Build a chatbot that screenshots your app on demand, compares against expected layouts, and reports issues.
When a support ticket mentions a page, the AI captures a screenshot to understand what the customer sees.
AI captures competitor pages, analyzes their messaging, and generates comparison content or blog posts.
100 free API calls per month. No credit card. No complex setup.