Skip to main content
The official SDKs give you web search and page fetch in Python, TypeScript and Go, with results already shaped for a prompt.

What you get

  • search returns ranked pages with their text extracted. fetch returns one page as markdown.
  • to_context() renders results as numbered [n] Title (url) sources a model can cite.
  • TOOLS holds OpenAI-format definitions for keenable_search and keenable_fetch. A helper runs whichever tool the model calls.
  • In Python, AsyncKeenable has the same methods as the sync client.
  • Every call works with no account and no key. An API key raises your rate limit.

Install

Install the package for your language:
The TypeScript SDK needs Node 18 or newer. The Go SDK needs Go 1.22 or newer. Neither has runtime dependencies. On macOS and many Linux distributions, system Python refuses a global pip install. Install the Python package into a virtual environment: run python3 -m venv .venv, then source .venv/bin/activate. If your Go project already has a go.mod, skip go mod init. This program runs one search without a key and prints the top 3 results as a citable block:
Save it in the directory where you installed the SDK and run it: You see one [n] Title (url) header per result, followed by the page text:
Example output · results vary
To raise your limit, create an API key and set KEENABLE_API_KEY. The code stays the same.

Configuration

Every SDK reads two environment variables: You can also pass settings to the constructor: The SDK sends the client source as the X-Keenable-Title header. It defaults to Keenable SDK. If you build an integration on top of an SDK, set it to your product’s name so Keenable attributes your traffic to your product.

Methods

Search filters follow the Search parameters, in each language’s naming style: published_after in Python, publishedAfter in TypeScript, PublishedAfter in Go. SDK 0.1.x has three gaps:
  • In Python and TypeScript, mode accepts only pro.
  • No SDK sends disable_cards.
  • fetch takes only a URL. For live, prompt and max_chars, call the HTTP API as shown on Fetch.

Errors

Every SDK raises typed errors that share one base class. See Errors for what each status code means and how to fix it. In 0.1.x, an HTTP 402 (out of credits) raises the generic API error. To catch it, check status_code == 402 in Python, statusCode === 402 in TypeScript, or StatusCode == 402 on an APIError in Go.

Source, packages and changelogs