Skip to content

Varity AI Gateway

Varity Team Core Contributors Updated August 2026

The Varity AI Gateway is an OpenAI-compatible inference API. It speaks the same chat-completions wire format as the OpenAI API, so every OpenAI SDK, framework adapter, and agent runtime already knows how to talk to it. The integration is a one-line base-URL swap.

https://varity.app/v1

Set two variables and send a request. This is the whole integration.

Terminal window
curl https://varity.app/v1/chat/completions \
-H "Authorization: Bearer $VARITY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "glm-5-2",
"messages": [
{ "role": "user", "content": "Say hello in one sentence." }
]
}'

base_url / baseURL is the only line that differs from an OpenAI setup. Model ids come from the Varity catalog, not OpenAI’s. See Models for the full list.

GET /v1/models is public. Run it right now, with no credential, and you get a 200 plus the live catalog:

Terminal window
curl https://varity.app/v1/models
{
"object": "list",
"data": [
{
"id": "glm-5-2",
"display_name": "GLM 5.2",
"object": "model",
"owned_by": "varity",
"capabilities": {
"chat_completions": true,
"tool_calls": false,
"streaming": true,
"streaming_tool_calls": false
},
"context_window": 1000000,
"max_completion_tokens": 131072,
"privacy": "private",
"privacy_routes": ["private"],
"availability": { "status": "available" },
"customer_pricing": {
"status": "configured",
"currency": "usd",
"unit": "per_million_tokens",
"input": 1.47,
"output": 4.62,
"cached_input": 1.47
}
}
]
}

The gateway also exposes an unauthenticated health probe:

Terminal window
curl https://varity.app/health
{ "status": "healthy", "service": "varity-gateway", "version": "1.13.49" }

Inference requests require a Varity API key sent as a bearer credential:

Authorization: Bearer $VARITY_API_KEY

Create keys in the Developer Portal settings page. Key plaintext is shown once at creation and is never returned again. The same key format is used across the Varity public API.

Auth is enforced on /v1/chat/completions. A request with no Authorization header returns 401:

{
"error": {
"message": "A Bearer API key is required.",
"type": "authentication_error",
"code": "authentication_required",
"param": null,
"retryable": false,
"request_id": "516c24ef-ba5a-4e3d-8f32-0a609ae5d298"
}
}

A malformed or revoked key returns 401 with code: "invalid_api_key" and the message The API key is invalid or revoked.

Set stream: true for server-sent events, exactly as with OpenAI. Every model in the catalog reports "streaming": true.

Terminal window
curl https://varity.app/v1/chat/completions \
-H "Authorization: Bearer $VARITY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "glm-5-2",
"stream": true,
"messages": [
{ "role": "user", "content": "Count to five." }
]
}'

Streaming tool calls are a narrower capability than streaming text, and are only supported on some models. Check capabilities.streaming_tool_calls before you combine stream: true with tools. See Compatibility.

Errors use the OpenAI error envelope, with two Varity additions: retryable and request_id.

FieldMeaning
error.messageHuman-readable description
error.typeError class, for example authentication_error
error.codeStable machine code, for example invalid_api_key
error.paramOffending request field, or null
error.retryableWhether retrying the same request can succeed
error.request_idCorrelation id, also returned as the x-request-id response header

Quote request_id in any support request. It is present on both the response body and the x-request-id header on every response, including successful ones.

GET /v1/models returns standard rate-limit headers:

ratelimit-limit: 120
ratelimit-policy: 120;w=60
ratelimit-remaining: 119
ratelimit-reset: 60

That is 120 requests per 60-second window on the catalog endpoint. Read the ratelimit-remaining and ratelimit-reset headers rather than hardcoding a budget; the policy is served live and can change.

  • Models: the full live catalog with context windows, limits, and prices
  • Compatibility: exactly what the OpenAI surface includes and excludes
  • Public API Reference: the /api platform contract for deploys and operations