# API reference

Use a Void API key with the OpenAI-compatible gateway. Choose a model ID from the catalog and check whether that model supports the endpoint and features you need.

## Base URL and authentication

Public gateway base URL: https://void-api.tech/v1. Send requests over HTTPS. The /v1 routes are forwarded to the LLM gateway; account management routes live under /api/.

Create a key in your account and send it as Authorization: Bearer <your-api-key>. Keep the key private; do not embed it in browser code or commit it to a repository. The account access token used by /api/ is not the same as a gateway API key.

- [Create or manage API keys](https://void-api.tech/account/api-keys)
- [Connect a client](https://void-api.tech/connection)

## List models

GET /v1/models lists models visible to your gateway key. Use the id from the returned data array as the model value in inference requests. The public model catalog and prices are also available on the Models page; availability and capabilities may vary by model.

### GET /v1/models

```shell
curl "https://void-api.tech/v1/models" \
  -H "Authorization: Bearer $VOID_API_KEY"
```

- [Model catalog and prices](https://void-api.tech/models)
- [Public model catalog (JSON)](https://void-api.tech/api/models/catalog)

GET /api/models/catalog requires no authentication or JavaScript. It returns a JSON array: name is the model ID for inference, group is the display group, and all *_price_per_million_tokens fields are USD per million tokens, covering input, output, cache reads and cache writes. Prices are decimal strings. Fetch this endpoint for current prices; do not rely on remembered values. This public catalog does not replace the authenticated GET /v1/models endpoint.

### GET /api/models/catalog

```shell
curl -fsS "https://void-api.tech/api/models/catalog"
```

## Chat completions

POST /v1/chat/completions accepts an OpenAI-style JSON body with a model ID and messages. The non-streaming result is a chat completion JSON response; read the assistant output from choices when present. Fields and supported message content depend on the selected model and provider.

### Non-streaming request

```shell
curl "https://void-api.tech/v1/chat/completions" \
  -H "Authorization: Bearer $VOID_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"<model-id>","messages":[{"role":"user","content":"Hello!"}]}'
```

To stream, add "stream": true to the JSON request. The gateway returns server-sent events (SSE) with incremental chunks rather than one complete JSON response. Process events as they arrive and handle the end-of-stream marker. Streaming usage fields are not guaranteed for every model or request.

### Streaming request

```shell
curl -N "https://void-api.tech/v1/chat/completions" \
  -H "Authorization: Bearer $VOID_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"<model-id>","messages":[{"role":"user","content":"Hello!"}],"stream":true}'
```

## Responses API

POST /v1/responses is routed to the LLM gateway. Use an OpenAI-style responses request with model and input only when the selected model supports this API. Some configured model connections use chat mode and others use responses mode; do not assume every model works with both endpoints. For supported models, set "stream": true to receive responses events over SSE instead of a single JSON response. These events have a different format from chat completion chunks.

### Responses request (for supported models)

```shell
curl "https://void-api.tech/v1/responses" \
  -H "Authorization: Bearer $VOID_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"<responses-capable-model-id>","input":"Hello!"}'
```

## Errors and compatibility

Check HTTP status before parsing a successful response. Authentication or permission failures, invalid requests, unavailable models, insufficient budget, rate limits and upstream errors can fail a call. Gateway error bodies and status codes may differ from account /api/ errors; do not depend on one error shape for all routes. For SSE, failures may occur after the connection opens, so handle interrupted streams too.

OpenAI-compatible does not mean identical behavior for every model or provider. Parameters, tools, multimodal content, streaming events and token usage depend on the selected model and underlying provider. Start with the minimal example and verify additional features on your target model.

## Billing and account

See the public model catalog for displayed token prices. Manage your balance and review usage in your account. Pricing and availability can change; consult the current catalog before sending requests.

- [Model pricing](https://void-api.tech/models)
- [Balance](https://void-api.tech/account/balance)
- [Usage](https://void-api.tech/account/usage)
- [Payment and refund terms](https://void-api.tech/payment-terms)
