# Mixture of Experts

Specialist sources behind one endpoint. You name the experts a search should ask.

MillionShort is not one index with a few filters on it. It is 13 sources, and each one is a specialist: its own index and its own ranking, built for one kind of material. News is ranked like news, papers like papers, statutes like statutes. We call the set a **Mixture of Experts**.

What makes it one product is everything around the experts:

- **One endpoint.** `POST /v1/search`, whatever you search.
- **One key and one price.** Every source costs the same: 1 credit per source searched.
- **One answer shape.** A result from any source has the same fields, so your code reads a paper, a post and a web page the same way.
- **One call can ask several.** Name up to five sources and get one ranked list back.

## The experts

| Slug | What it contains | Heavy |
|---|---|---|
| `web` | The general web: Billions+ pages on our own independent index. | Yes |
| `news` | News articles, refreshed through the day. |  |
| `smallweb` | Personal sites, blogs and small independent publishers. | Yes |
| `discussions` | Forum threads and community conversations in one search. | Yes |
| `hn` | Technology links and the comment threads around them. | Yes |
| `social` | Recent public posts from open social networks. | Yes |
| `communities` | Public chat communities, by name, topic and size. |  |
| `podcasts` | Podcast shows and episodes. |  |
| `academic` | Scholarly papers and preprints. |  |
| `medical` | Biomedical and clinical literature. |  |
| `law` | Statutes, regulations and court opinions (United States). |  |
| `finance` | Public-company filings and disclosures. |  |
| `contracts` | Government contract opportunities and awards. |  |

Each source has a page of its own with what it is good for, what its results carry and queries to try: [the sources](https://millionshort.com/docs/search/sources).

## Choosing who to ask

You choose the experts with `sources`. Leave it out and the search asks `web`.

| The question is about | Ask |
|---|---|
| Anything, and you do not know where the answer lives | `web` |
| Something that just happened | `news`, with `social` for first reactions |
| First-hand experience and independent writing | `smallweb`, or `web` with `remove_top_sites` |
| What people think of something | `discussions`; `hn` for technology |
| Where a community gathers | `communities` |
| Research | `academic`; `medical` for clinical and biomedical questions |
| What the law says (United States) | `law` |
| What a public company disclosed | `finance` |
| Who the government buys from | `contracts` |
| Something to listen to | `podcasts` |

An agent that does not know the sources can ask for the list: `GET /v1/sources` returns each slug with a one-line description, and costs nothing. Over MCP that is the `list_sources` tool.

## One call, several experts

```bash
curl https://api.millionshort.com/v1/search \
  -H "Authorization: Bearer $MILLIONSHORT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "query": "transformer interpretability",
    "sources": ["web", "academic", "hn"],
    "num_results": 15
  }'
```

```python
import os

from millionshort import MillionShort

client = MillionShort(api_key=os.environ["MILLIONSHORT_API_KEY"])

r = client.search(
    "transformer interpretability",
    sources=["web", "academic", "hn"],
    num_results=15,
)
for hit in r.results:
    print(hit["position"], hit["source"], hit["title"])
print(r.usage.credits, "credits")
```

```ts
import { MillionShort } from 'millionshort';

const client = new MillionShort({ apiKey: process.env.MILLIONSHORT_API_KEY });

const r = await client.search('transformer interpretability', {
  sources: ['web', 'academic', 'hn'],
  numResults: 15,
});
for (const hit of r.results) {
  console.log(hit.position, hit.source, hit.title);
}
console.log(r.usage?.credits, 'credits');
```

The same call as a tool of the MCP server:

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "search",
    "arguments": {
      "query": "transformer interpretability",
      "sources": [
        "web",
        "academic",
        "hn"
      ],
      "num_results": 15
    }
  }
}
```

What comes back:

- **One list.** The sources' results are merged by rank into one list, so the best of each source comes first. Duplicates are removed.
- **`source` on every result** says which expert it came from.
- **`num_results` is for the whole call.** Fifteen results from three sources is fifteen results, not forty-five.
- **A source that does not answer does not fail the call.** The others' results are returned, the missing one is named in a `source_unavailable` warning, and it is not charged.

This call costs 3 credits for the three sources, plus 0.5 for the five results beyond the first ten: 3.5 credits.

## What is the same and what differs

The same for every source: the request fields, the result fields, the envelope, the errors and the price.

What differs is which fields a source can fill in:

- **Dates.** `news`, `hn`, `social`, `podcasts`, `academic`, `medical` and `finance` results carry a `published_date`. `web` results never do. The date filters work on these and on `law`, `communities` and `contracts`; not on `web`, `smallweb` or `discussions`. [Freshness](https://millionshort.com/docs/search/freshness) explains why.
- **Page type and topic.** Filled in on `web`, `news`, `smallweb` and `academic`, and partly elsewhere. The `page_types` and `topics` **filters**, and their exclude, boost and bury forms, act on `web` and `news` results. Any other source in the call is named in a `filter_not_applied` warning.
- **Date, language and country filters.** Each is applied by the sources that can apply it. A source that cannot is named in a `filter_not_applied` warning, so a filter is never ignored silently. The [Search reference](https://millionshort.com/docs/search/parameters#dates-language-and-country) has the table, and `GET /v1/sources` returns it as data.
- **Page text.** `include_content` adds the text of the page as we hold it to `web` and `news` results.
- **Popularity.** Meaningful where a result is a page on a site: `web`, `news`, `smallweb`. A thread or a community has no site rank of its own and usually shows `unknown`.
- **`extra`.** The fields only one kind of material has: a paper's authors and citation count, a filing's form, a thread's score, a contract's agency and amount. Each source page lists its keys.

## Limits

- Up to five sources per call.
- `web`, `smallweb`, `discussions`, `social`, `hn` are the **heavy** sources. Each plan has a per-minute limit for searches that include them, lower than its limit for requests as a whole. [Credits and limits](https://millionshort.com/docs/credits-and-limits) has the table.
- Without a key (the playground and the MCP server's no-key mode), a search asks one source.
