# Benchmarks

5 endpoints at `https://api.kosa8.com`, sent with `Authorization: Bearer $KOSA8_API_KEY`. Generated from the API's own [OpenAPI description](https://api.kosa8.com/openapi.json), which a test holds to the router.

## The ready-made benchmarks, with their source and revision[#]

GET`/v1/benchmarks`scope sandboxes:read

Responses

200401403

```
curl -s -X GET https://api.kosa8.com/v1/benchmarks \
  -H "Authorization: Bearer $KOSA8_API_KEY"
```

## One benchmark[#]

GET`/v1/benchmarks/{name}`scope sandboxes:read

Parameters

`name`requiredpath · string

Benchmark name, e.g. swe-bench-verified

Responses

200401403404

```
curl -s -X GET https://api.kosa8.com/v1/benchmarks/$NAME \
  -H "Authorization: Bearer $KOSA8_API_KEY"
```

## A benchmark's instances, in the dataset's order, with their environments' state[#]

GET`/v1/benchmarks/{name}/instances`scope sandboxes:read

Parameters

`name`requiredpath · string

Benchmark name, e.g. swe-bench-verified

`state`query · "ready" | "building" | "queued" | "failed" | "not_built"

Only instances whose environment is in this state

`limit`query · integer

—

`cursor`query · string

next_cursor of the page before

Responses

200400401403404

```
curl -s -X GET https://api.kosa8.com/v1/benchmarks/$NAME/instances \
  -H "Authorization: Bearer $KOSA8_API_KEY"
```

## One instance: the solver's input and its environment's state and ETA, never the hidden tests[#]

GET`/v1/benchmarks/{name}/instances/{id}`scope sandboxes:read

Parameters

`name`requiredpath · string

Benchmark name, e.g. swe-bench-verified

`id`requiredpath · string

Instance id, e.g. django__django-11099

Responses

200401403404

```
curl -s -X GET https://api.kosa8.com/v1/benchmarks/$NAME/instances/$SBX \
  -H "Authorization: Bearer $KOSA8_API_KEY"
```

## Build environments ahead of use (at most 100 a call)[#]

POST`/v1/benchmarks/{name}/prepare`scope sandboxes:write

A create of an instance whose environment is not ready answers 409 template_building with eta_s and Retry-After; this builds them first instead. Building is kosa8's cost.

Parameters

`name`requiredpath · string

Benchmark name, e.g. swe-bench-verified

JSON body

`instances`requiredarray of string | "all" | integer

Instance ids, "all", or n: a seeded sample of n

`seed`integer

Min 0.

Responses

202400401402403404

```
curl -s -X POST https://api.kosa8.com/v1/benchmarks/$NAME/prepare \
  -H "Authorization: Bearer $KOSA8_API_KEY" \
  -H 'Content-Type: application/json' -d @body.json
```

---
Source: https://docs.kosa8.com/api/benchmarks/
