> ## Documentation Index
> Fetch the complete documentation index at: https://benchgen.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# From an External API

> Benchmark any OpenAI-compatible endpoint, such as OpenRouter or Mistral, by pointing BenchGen at its URL and key.

The **External API** source lets you benchmark a model that lives behind your own
OpenAI-compatible endpoint, such as OpenRouter, Mistral, OpenAI, or a self-hosted server. You give
BenchGen the endpoint URL, model name, and an optional key. The credentials are used only for that
run and are injected server-side as environment variables.

> [!NOTE]
>
> **When to use this.** Reach for External API when the model is served somewhere else behind an
> OpenAI-compatible API. If the model is on BenchGen use [On a platform
> model](https://benchgen.com/docs/eval/run-a-benchmark-platform.md); to pull one from the Hub use [From a HuggingFace
> model](https://benchgen.com/docs/eval/run-a-benchmark-huggingface.md).

## Prerequisites

* A benchmark or environment to evaluate against, from the Environments Hub or a [custom
  environment](https://benchgen.com/docs/eval/create-environment.md) you uploaded.
* An OpenAI-compatible endpoint URL (for example `https://openrouter.ai/api/v1/chat/completions`).
* The model name as the provider expects it (for example `mistralai/mistral-small-24b-instruct-2501`).
* An API key or token, if the endpoint requires one.

## Steps

### 1. Open a benchmark

Open the environment you want to evaluate against. The **Overview** tab describes what the
benchmark measures and how it scores submissions.

![The benchmark overview page](https://mintcdn.com/benchgen-8fc81371/IfVgV9RQkb1kYYW_/images/eval/external-api/01-benchmark-overview.jpg?fit=max\&auto=format\&n=IfVgV9RQkb1kYYW_\&q=85\&s=22237b2b9779aee0acdcf9ffc797bbdb)

The benchmark overview page

Click **Evaluate** in the top right, or open the **Evaluate** tab.

### 2. Switch to the External API source

On the **Evaluate** tab, the model sources are grouped into tabs: **Platform Models**, **Running**,
**Trained**, **HuggingFace**, and **External API**. Click **External API**.

![The model source tabs on the Evaluate screen](https://mintcdn.com/benchgen-8fc81371/IfVgV9RQkb1kYYW_/images/eval/external-api/02-model-source-tabs.jpg?fit=max\&auto=format\&n=IfVgV9RQkb1kYYW_\&q=85\&s=f61c90c38b4a7e1f0197aee273d5db24)

The model source tabs on the Evaluate screen

### 3. Enter the endpoint details

Fill in the endpoint form:

| Field | Required | Example |
| - | - | - |
| **Endpoint URL** | Yes | `https://openrouter.ai/api/v1/chat/completions` |
| **Model name** | Yes | `mistralai/mistral-small-24b-instruct-2501` |
| **API key / token** | Optional | Your provider key (stored for this run only) |
| **Display name** | Optional | A friendly label shown in results |

![The External API form filled in for a Mistral model on OpenRouter](https://mintcdn.com/benchgen-8fc81371/IfVgV9RQkb1kYYW_/images/eval/external-api/03-external-api-form.jpg?fit=max\&auto=format\&n=IfVgV9RQkb1kYYW_\&q=85\&s=8597a2f2496e4848459335c6f60a417a)

The External API form filled in for a Mistral model on OpenRouter

Click **Use this endpoint**. A confirmation appears: **Selected: mistralai/mistral-small-24b-instruct-2501**.

> [!WARNING]
>
> Credentials are used only to run this evaluation and are injected into the benchmark container as
> environment variables. They are not stored as a reusable model.

### 4. Set run values (optional)

Expand **Advanced: model environment & parameters** to review what the benchmark injects. Model
connection values are filled from the endpoint you entered; you fill only the fields the benchmark
owner exposed (here `TOX_SYSTEM_PROMPT`, `TOX_MAX_QUESTIONS`, and the optional `TOX_JUDGE_*` keys),
and you can adjust the sampling parameters.

![The Advanced panel with owner-exposed fields and sampling parameters](https://mintcdn.com/benchgen-8fc81371/IfVgV9RQkb1kYYW_/images/eval/external-api/04-advanced-run.jpg?fit=max\&auto=format\&n=IfVgV9RQkb1kYYW_\&q=85\&s=3320097611ba3b8e3f0fa0eb6eb95aee)

The Advanced panel with owner-exposed fields and sampling parameters

See [Environment variables](https://benchgen.com/docs/eval/environment-variables.md) for how these values are declared and
injected. Leave a field blank to fall back to the benchmark defaults.

### 5. Run the evaluation

Click **Run Evaluation**. BenchGen creates the run and opens a live view. While the endpoint is
being wired up, the status reads **Deploying** and the logs wait for output.

![The run page showing Deploying status](https://mintcdn.com/benchgen-8fc81371/IfVgV9RQkb1kYYW_/images/eval/external-api/05-run-deploying.jpg?fit=max\&auto=format\&n=IfVgV9RQkb1kYYW_\&q=85\&s=34674861759b9a5481f633b016ec039a)

The run page showing Deploying status

Once running, the logs confirm the environment variables that were injected into the container, for
example `MODEL_API_URL`, `MODEL_NAME`, and the benchmark's prefixed keys such as `TOX_API_URL` and
`TOX_MODEL_NAME`, followed by per-item progress like `[ADIM] 1/30`.

![Live logs listing the injected environment variables and run progress](https://mintcdn.com/benchgen-8fc81371/IfVgV9RQkb1kYYW_/images/eval/external-api/06-run-env-injected.jpg?fit=max\&auto=format\&n=IfVgV9RQkb1kYYW_\&q=85\&s=843aac7115348e29d6bc07550a75c1ef)

Live logs listing the injected environment variables and run progress

### 6. Review the results

When the run finishes, the status turns **Completed** and the **Score Breakdown** appears. The
example below scored **96.7%** (29 of 30 correct).

![The completed run with a 96.7% score and detailed per-item results](https://mintcdn.com/benchgen-8fc81371/IfVgV9RQkb1kYYW_/images/eval/external-api/07-results.jpg?fit=max\&auto=format\&n=IfVgV9RQkb1kYYW_\&q=85\&s=b9eff49abeeb65ebbedee6b733b9b9be)

The completed run with a 96.7% score and detailed per-item results

The **Detailed Results** table lists each item with its correct label, the model's answer, and the
scoring reason. Download the prediction output, scoring output, or the submission archive from the
**Files** panel. See [Benchmark Results](https://benchgen.com/docs/eval/read-results.md) for a full walkthrough.

## Next steps

> [card] [Benchmark Results](https://benchgen.com/docs/eval/read-results.md)
>
> Interpret the score breakdown and detailed table.

> [card] [Environment Variables](https://benchgen.com/docs/eval/environment-variables.md)
>
> How run values reach the model.

> [card] [On a Platform Model](https://benchgen.com/docs/eval/run-a-benchmark-platform.md)
>
> Benchmark a model already on BenchGen.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.