Skip to content

API

API overview

The protocols NoviaHub supports, request URLs, authentication, request IDs, error format and unsupported endpoints.

NoviaHub is compatible with three API protocols: OpenAI, Anthropic and Google Gemini. You can use the official SDKs from all three: point them at NoviaHub and use the API key you created on NoviaHub.

Protocol Endpoint Method and path
OpenAI Chat Completions POST /v1/chat/completions
OpenAI Responses POST /v1/responses
OpenAI Image generation POST /v1/images/generations
OpenAI List models GET /v1/models
Anthropic Messages POST /v1/messages
Anthropic List models GET /v1/models
Gemini generateContent / streamGenerateContent POST /v1beta/models/{model}:generateContent
Gemini List models GET /v1beta/models

The full URL is https://noviahub.com plus the path, for example https://noviahub.com/v1/chat/completions.

Which endpoints a model supports is shown by its endpoint labels on the Models & Pricing page. See Protocol conversion.

Each SDK appends its own path to the base URL, so the three are written differently:

SDK Base URL Note
Official OpenAI SDKs (Python, Node.js, …) https://noviahub.com/v1 Include /v1
Official Anthropic SDKs https://noviahub.com Do not include /v1; the SDK adds /v1/messages
Google Gen AI SDKs https://noviahub.com Do not include /v1beta; the SDK adds /v1beta/models/...

Every request must carry your API key. NoviaHub accepts the following, but each form only works on certain paths:

Form Where it works
Header Authorization: Bearer <key> Every endpoint (recommended)
Header x-api-key: <key> Only paths containing /v1/messages or /v1/models
Header x-goog-api-key: <key> Only paths starting with /v1/models, /v1beta/models or /v1beta/openai/models
Query parameter ?key=<key> Same as above: only paths starting with /v1/models, /v1beta/models or /v1beta/openai/models

Details we tested:

  • The sk- prefix is optional: both Bearer sk-abc... and Bearer abc... work.
  • Leaving out Bearer and putting the key straight into Authorization also works.
  • Using x-api-key or x-goog-api-key on a path that doesn’t accept it (for example x-api-key on /v1/chat/completions) counts as sending no key and returns 401.
  • Don’t append -<number> to the key (such as sk-abc...-1). For regular users this returns 403 Regular users cannot specify a channel.

Every response carries the header X-Novia-Request-Id with the ID of the request. Error messages also end with (request id: ...). When you report a problem, please include this ID so we can trace it. It is also shown as Request ID when you open an entry in Usage Logs in the console.

Errors come with a non-200 HTTP status and a JSON body in one of two shapes.

OpenAI shape: used for every error from the OpenAI and Gemini endpoints, and for errors raised by any endpoint during authentication, model selection and rate limiting (including /v1/messages).

Example: missing messages field (measured on a test instance)
{
"error": {
"message": "field messages is required (request id: 2026...)",
"type": "novia_error",
"param": "",
"code": "invalid_request"
}
}

Anthropic shape: used by /v1/messages for errors raised after authentication and model selection.

Example: calling /v1/messages with no balance left (measured on a test instance)
{
"error": {
"type": "novia_error",
"message": "Insufficient user quota, remaining quota: $0.000000 (request id: 2026...)"
},
"type": "error"
}
  • If the error comes from the upstream model service, NoviaHub passes through its HTTP status and error body, and also its Retry-After header when there is one.
  • The Accept-Language header picks the language of error messages: English, Simplified Chinese, Traditional Chinese, French, Russian, Japanese or Vietnamese, and English without it. With Accept-Language: zh-CN, an invalid key gives 「无效的令牌」; without it, Invalid token. The interface language saved in your account doesn’t affect API errors.

For what each error means and how to fix it, see Errors and troubleshooting.

  • Request body size: the gateway caps the size of a request body. The built-in default is 128 MB; larger bodies get 413.
  • Streaming idle timeout: during a streamed response, if the upstream sends no data for a while, the gateway ends the stream. The built-in default is 300 seconds.

Both numbers are built-in defaults that the platform may change; the actual response is what counts.

NoviaHub does not currently offer the endpoints below; calls return an error right away (measured on a test instance):

Endpoint What it returns
POST /v1/messages/count_tokens (Anthropic token counting) 404, Invalid URL (POST /v1/messages/count_tokens)
POST /v1beta/models/{model}:countTokens (Gemini token counting) 404, Invalid URL (...)
/v1/files, /v1/fine-tunes, /v1/images/variations 400, Model name not specified, model name cannot be empty
Any other unlisted /v1/... path 404, Invalid URL (METHOD path)

NoviaHub also has no embedding, rerank, speech or video models yet. Calls to those endpoints return 503 because no channel is available.