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.
Endpoints
Section titled “Endpoints”| 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.
Setting the SDK base URL
Section titled “Setting the SDK base URL”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/... |
Authentication: where the API key goes
Section titled “Authentication: where the API key goes”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: bothBearer sk-abc...andBearer abc...work. - Leaving out
Bearerand putting the key straight intoAuthorizationalso works. - Using
x-api-keyorx-goog-api-keyon a path that doesn’t accept it (for examplex-api-keyon/v1/chat/completions) counts as sending no key and returns 401. - Don’t append
-<number>to the key (such assk-abc...-1). For regular users this returns 403 with the Chinese message 「普通用户不支持指定渠道」 (“regular users cannot choose a channel”).
Request ID
Section titled “Request ID”Every response carries the header X-Oneapi-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.
Error format
Section titled “Error format”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).
{ "error": { "message": "field messages is required (request id: 2026...)", "type": "new_api_error", "param": "", "code": "invalid_request" }}Anthropic shape: used by /v1/messages for errors raised after authentication and model selection.
{ "error": { "type": "new_api_error", "message": "用户额度不足, 剩余额度: $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-Afterheader when there is one. - The
Accept-Languageheader picks the language of error messages. WithAccept-Language: zh-CN, an invalid key gives 「无效的令牌」; without it,Invalid token. Some messages currently exist in Chinese only, such as insufficient balance (「用户额度不足」) and IP not allowed.
For what each error means and how to fix it, see Errors and troubleshooting.
Other limits
Section titled “Other limits”- 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.
Unsupported endpoints
Section titled “Unsupported endpoints”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.