A Pexafy search is one web request, so it works from any language or tool. The libraries and guides below save you the setup. The same key works everywhere: create one if you don’t have it yet.
You want to…Go to
Search photos from a Python script or appPython
Search photos from JavaScript or Node.jsJavaScript
Give photo search to a LangChain or LangGraph agentLangChain
Give photo search to a Vercel AI SDK agentVercel AI SDK
Use another agent frameworkAgent frameworks
Automate without code, in n8n, Make or ZapierNo-code
Ask for photos in ChatGPT, Claude, Cursor or VS CodeAI assistants

Python

Install the library (Python 3.9 or later):
pip install pexafy
Save this as search.py, put your key in place of YOUR_API_KEY, and run python search.py:
from pexafy import Client

client = Client("YOUR_API_KEY")

for photo in client.search("a quiet street in the rain", per_page=5):
    print(photo.urls.regular)
It prints a link to each photo found. On macOS and Linux, type pip3 and python3 instead of pip and python. Rather keep the key out of your code? Write Client() and set the PEXAFY_API_KEY environment variable instead. The library also searches by image, pages through results for you, and comes with an async client and a pexafy command. Everything is in its README on GitHub · PyPI.

JavaScript

No package needed: with Node.js 18 or later, fetch is built in. Save this as search.mjs, put your key in place of YOUR_API_KEY, and run node search.mjs:
const API_KEY = "YOUR_API_KEY";

const url = new URL("https://api.pexafy.com/api/v1/search/photos");
url.searchParams.set("q", "a quiet street in the rain");

const response = await fetch(url, {
  headers: { "x-api-key": API_KEY },
});
if (!response.ok) throw new Error("HTTP " + response.status);

const { data } = await response.json();
for (const photo of data) console.log(photo.urls.regular);
Run it on your computer or your server, never in a web page, where anyone could read your key. Building an AI agent in JavaScript or TypeScript? Use LangChain.js, the Vercel AI SDK or one of the agent frameworks.

LangChain

langchain-pexafy gives LangChain and LangGraph agents three tools: search photos, find similar photos and get one photo, each with its licence and credit line.
pip install -U langchain-pexafy
npm install langchain-pexafy @langchain/core
Set the PEXAFY_API_KEY environment variable, then hand the tools to your agent:
from langchain_pexafy import PexafyToolkit

tools = PexafyToolkit().get_tools()
import { PexafyToolkit } from "langchain-pexafy";

const tools = new PexafyToolkit().getTools();
A complete agent, in Python and TypeScript: LangChain & LangGraph.

Vercel AI SDK

pexafy-ai-sdk gives AI SDK agents three tools to find free-to-use photos, each with its licence and credit line.
npm install pexafy-ai-sdk ai zod
Set the PEXAFY_API_KEY environment variable, then hand the tools to your model:
import { pexafyTools } from "pexafy-ai-sdk";

const tools = pexafyTools();
A complete example: Vercel AI SDK.

Agent frameworks

Most agent frameworks can use an MCP server, the standard way to plug tools into an AI agent. Point yours at https://mcp.pexafy.com/mcp and send your key as Authorization: Bearer YOUR_KEY: the agent gets Pexafy’s search tools. Any Pexafy key works. One page per framework, with code you can copy:

OpenAI Agents SDK

Python and TypeScript

Claude Agent SDK

Python and TypeScript

Google ADK

Python and TypeScript

Mastra

TypeScript

CrewAI

Python

LlamaIndex

Python

Pydantic AI

Python

Strands Agents

Python

Agno

Python

Microsoft Agent Framework

Python
Your framework isn’t listed? If it can connect to a remote MCP server (Streamable HTTP), the same address and header work. What the tools do: What your assistant can do.

No-code

There is no Pexafy app to install in n8n, Make or Zapier: one web request does the job. Add an HTTP step to your workflow with these settings:
Method:  GET
URL:     https://api.pexafy.com/api/v1/search/photos
Query:   q = a cosy café on a rainy evening
Header:  x-api-key = YOUR_API_KEY
ToolStep to add
n8nAn HTTP Request node. Turn on Send Query Parameters for q, and Send Headers for x-api-key.
MakeThe HTTP app, Make a request module. Add x-api-key under Headers, q under Query String, and set Parse response to Yes.
ZapierWebhooks by Zapier, with the GET event. Add q under Query String Params, and x-api-key under Headers.
The answer is the same as in the Quickstart: the photos are in data, and the link to each one is in urls.regular.

Prefer to ask in a chat?

ChatGPT, Claude, Cursor or VS Code can search Pexafy for you, with no code and, for most of them, no key.