# New API

> Resell Search1API web search, news, page reading, maps and more through your New API gateway with the Search1API plugin from the New API plugin marketplace.

Canonical URL: https://s1.dev/docs/integrations/newapi

[New API](https://github.com/QuantumNous/new-api) is an open-source AI gateway. The Search1API plugin, listed in the New API community plugin marketplace, adds Search1API's endpoints to the gateway: your users call them with a gateway token, and the gateway bills each request in your own prices.

> **info:** The plugin is for gateway administrators. It runs inside New API and forwards requests to
> Search1API with the channel's API key. Your users never see the key.

## Before you start

You need:

- a New API deployment with task plugins, signed in as the Root administrator; and
- a Search1API API key. Sign in at [app.s1.dev](https://app.s1.dev), open **API Keys**, and create one. New accounts include free credits to test with.

## Install the plugin

1. In New API, open **Task Plugins** (`/task-plugins`) and make sure the task plugin switch at the top is on.
2. Open **Marketplace**, choose the **Community** source, and search for **Search1API**.
3. Pick the latest version, read the changelog, and choose **Install and enable**.

If your gateway has no Community source, add this index URL as a marketplace source:

```text
https://www.newapi.ai/api/v1/community/index.json
```

The plugin's page in the web marketplace is [newapi.ai/en/plugins](https://www.newapi.ai/en/plugins?market=community&plugin=46171169).

## Add a channel

1. Create a channel of type **Task Plugin (61)** and bind the **Search1API** plugin.
2. Paste your Search1API API key as the channel key.
3. Leave the API address empty. The plugin fills in `https://api.search1api.com`.
4. Add the models you want to sell. Each endpoint is its own model, so you can price, group and grant them separately.

If your upstream is another New API gateway that also has the plugin, use a **New API (60)** channel instead, with that gateway's address and token, and add the Search1API plugin to the channel.

## Models and endpoints

Clients call the gateway with Search1API's own paths and JSON bodies, as described in the API reference, starting with [Search](https://s1.dev/docs/basic/search). Every path is also served under `/search1api`, for example `POST /search1api/search`.

| Endpoint | Model | What it does |
| --- | --- | --- |
| `POST /search` | `search1api-search` | Web search, optionally reading the top result pages |
| `POST /news` | `search1api-news` | News search |
| `POST /crawl` | `search1api-crawl` | Read a web page as clean text |
| `POST /ask` | `search1api-ask` | Search and answer a question with cited sources |
| `POST /maps` | `search1api-maps` | Google Maps places |
| `POST /sitemap` | `search1api-sitemap` | List the links of a site |
| `POST /trending` | `search1api-trending` | Trending topics on a platform |
| `POST /extract` | `search1api-extract` | Extract structured data from a page with a JSON schema |
| `POST /deepcrawl` | `search1api-deepcrawl` | Start a crawl of a whole site |

`/search`, `/news` and `/crawl` also accept a JSON array of up to 50 requests. A deep crawl returns a task id; poll `GET /deepcrawl/status/{task_id}` until `status` is `completed`.

## Set prices

Every model has one usage field, `credits`: the Search1API credits a request uses. Set a price per credit for each model in the gateway's model pricing, for example:

```text
tier("credits", u("credits") * 0.004)
```

This charges your users 0.004 USD per credit. Choose your own price.

A request uses the same credits it would use on Search1API directly:

| Endpoint | Credits |
| --- | --- |
| `/search`, `/news` | 1 per query, plus 1 for each result page read with `crawl_results` |
| `/crawl` | 1 per URL |
| `/ask` | 5 |
| `/maps` | 3 per page |
| `/extract` | 10 |
| `/deepcrawl` | 20 per started crawl; status checks are free |
| `/sitemap`, `/trending` | 1 |

See [Credits and limits](https://s1.dev/docs/essentials/credits-and-limits) for details. The gateway reserves the most a request can cost, then settles to the credits Search1API reports for it, so a result page that could not be read is not billed. Failed requests are not billed. Through an upstream New API gateway the charge is not reported back, so requests settle at the reserved amount.

## Call it

```bash
curl https://your-gateway.example.com/search \
  -H "Authorization: Bearer sk-your-gateway-token" \
  -H "Content-Type: application/json" \
  -d '{"query": "latest AI chip export rules", "max_results": 5, "crawl_results": 2}'
```

The response is Search1API's own response. Errors come back in Search1API's format.

### SDKs, CLI and MCP

The official [SDKs](https://s1.dev/docs/integrations/sdks) and the [MCP server](https://s1.dev/docs/integrations/mcp) work through the gateway: set their base URL to `https://your-gateway.example.com/search1api` and use a gateway token as the API key. For the local MCP server, set `SEARCH1API_API_URL`:

```bash
SEARCH1API_KEY="sk-your-gateway-token" \
SEARCH1API_API_URL="https://your-gateway.example.com/search1api" \
npx -y search1api-mcp
```

## Limits

- Request bodies must be JSON.
- Screenshots and the [compatibility endpoints](https://s1.dev/docs/compatibility/overview) are not served by the plugin.
- Requests are subject to the gateway's timeout. Large batches with many page reads can take more than a minute.