NewAPI-Compatible Endpoints
Compatible model discovery, audio, balance, and request-log APIs for migrating NewAPI clients.
Inference Space's primary APIs use OpenAI- and Anthropic-compatible protocols. If your system already integrates with NewAPI, you can continue using the endpoints below for model discovery, audio, balance, quota, and request-log checks.
Authentication continues to use an Inference Space gk_ API Key. The model, balance, and log APIs are read-only.
Authentication
The recommended format is Authorization: Bearer <API Key>:
Authorization: Bearer gk_xxxxxxxxxxxxxxAnthropic-style x-api-key is also supported:
x-api-key: gk_xxxxxxxxxxxxxxBalance and log APIs require a Key with the ai:* scope. Model discovery supports ai:*, ai:llm, ai:image, or ai:video; speech recognition requires ai:asr, and speech synthesis requires ai:tts. Authentication failures return an error in English:
{
"success": false,
"message": "API Key is invalid or disabled",
"error": {
"code": "invalid_api_key",
"message": "API Key is invalid or disabled"
}
}Model Discovery
List the models accessible to the current API Key:
curl "https://ai.inf.space/v1/models" \
-H "Authorization: Bearer $TOS_API_KEY"The response follows the OpenAI list shape and includes only models accessible to the current Key:
{
"object": "list",
"data": [
{
"id": "gpt-4o-mini",
"object": "model",
"created": 0,
"owned_by": "wujie"
},
{
"id": "gpt-image-2",
"object": "model",
"created": 0,
"owned_by": "wujie-image"
}
]
}An ai:llm Key can discover text models, an ai:image Key can discover image models, and an ai:video Key can discover video models. Models outside the Key's scope are omitted.
Look up a single model:
curl "https://ai.inf.space/v1/models/gpt-image-2" \
-H "Authorization: Bearer $TOS_API_KEY"If the model does not exist or is inaccessible to the current Key, the API returns 404:
{
"success": false,
"message": "The model does not exist or the current API Key is not authorized to access it",
"error": {
"code": "model_not_found",
"message": "The model does not exist or the current API Key is not authorized to access it"
}
}Gemini SDKs and native clients can retrieve the model list in Gemini format:
curl "https://ai.inf.space/v1beta/models" \
-H "Authorization: Bearer $TOS_API_KEY"Example response:
{
"models": [
{
"name": "models/gemini-3-pro-image",
"displayName": "gemini-3-pro-image",
"version": "001",
"supportedGenerationMethods": [
"generateContent",
"streamGenerateContent"
]
}
]
}The common NewAPI OpenAI-shaped alias is also supported:
curl "https://ai.inf.space/v1beta/openai/models" \
-H "Authorization: Bearer $TOS_API_KEY"For security, a query API Key such as /v1beta/models?key=... is not accepted as an authentication source. Use the Authorization or x-api-key request header.
OpenAI Audio Aliases
Common NewAPI and OpenAI audio paths can use the data-plane Base directly:
| Method | Path | Scope |
|---|---|---|
POST | /v1/audio/transcriptions | ai:asr |
POST | /v1/audio/translations | ai:asr |
POST | /v1/audio/speech | ai:tts |
translations currently uses the same speech-recognition pipeline and does not perform additional translation. Speech synthesis supports the OpenAI fields input and response_format, as well as the native Inference Space fields text and format. See Speech Recognition and Speech Synthesis.
Quota Lookup
Look up the wallet balance and cumulative spend for the organization that owns the current API Key. The balance API reads only that organization's data and requires a gk_ API Key with the ai:* scope.
curl "https://ai.inf.space/api/usage/token/" \
-H "Authorization: Bearer $TOS_API_KEY"Example response:
{
"code": true,
"message": "ok",
"data": {
"object": "token_usage",
"name": "Production service",
"total_granted": 191.34,
"total_used": 67.89,
"total_available": 123.45,
"unlimited_quota": false,
"model_limits": {},
"model_limits_enabled": false,
"expires_at": 0
}
}Field descriptions:
| Field | Description |
|---|---|
total_available | Current organization wallet balance, in the billing currency |
total_used | Cumulative spend for the current organization, in the billing currency |
total_granted | total_available + total_used, for compatibility with the NewAPI quota bucket |
unlimited_quota | Always false |
model_limits | Currently not returned as a NewAPI model allowlist; always an empty object |
total_available is the available balance, not an independent limit for the API Key. API Keys in the same organization see the same organization wallet; the API Key determines call permissions and request-log ownership.
OpenAI Dashboard Balance Aliases
Compatible with the Dashboard Billing queries used by older clients:
| Method | Path |
|---|---|
GET | /dashboard/billing/subscription |
GET | /v1/dashboard/billing/subscription |
GET | /dashboard/billing/usage |
GET | /v1/dashboard/billing/usage |
Example:
curl "https://ai.inf.space/v1/dashboard/billing/subscription" \
-H "Authorization: Bearer $TOS_API_KEY"subscription returns:
{
"object": "billing_subscription",
"has_payment_method": true,
"soft_limit_usd": 123.45,
"hard_limit_usd": 500,
"system_hard_limit_usd": 500,
"access_until": 0
}The *_usd field names are retained for compatibility with older clients; Inference Space returns display amounts in the current organization's billing currency.
usage returns:
{
"object": "list",
"total_usage": 6789
}total_usage follows the legacy OpenAI Dashboard semantics and returns cumulative spend for the current organization in the smallest unit of the billing currency. For CNY billing, the value is in fen.
Request Log Lookup
Look up request logs belonging to the API Key in the current request header. A gk_ API Key with the ai:* scope is required:
curl "https://ai.inf.space/api/log/token?page_size=20&start_timestamp=1783076400&end_timestamp=1783681200" \
-H "Authorization: Bearer $TOS_API_KEY"The example retrieves the latest 20 records in a time range. Time parameters use Unix seconds. Without a time range, the API queries the 24 hours before the request time. A response with data: [] means that no request records for the Key were written to telemetry storage in that range; it does not mean that the API is unavailable.
Supported query parameters:
| Parameter | Description |
|---|---|
p / page | Page number, starting at 1 |
page_size / limit | Items per page, up to 200 |
start_timestamp | Start time in Unix seconds |
end_timestamp | End time in Unix seconds |
Example response:
{
"success": true,
"message": "",
"data": [
{
"id": "call_...",
"created_at": 1783581600,
"type": "llm",
"model_name": "gpt-4o-mini",
"token_name": "Production service",
"token_id": "key_...",
"quota": 0.12,
"prompt_tokens": 7,
"completion_tokens": 5,
"use_time": 42,
"is_stream": false,
"channel_name": "wujie",
"request_id": "req_...",
"content": ""
}
]
}Common fields:
| Field | Description |
|---|---|
created_at | Request completion time in Unix seconds |
model_name | Model ID used for the request |
prompt_tokens / completion_tokens | Input and output token counts |
quota | Actual net charge for the request in the current organization's billing currency; not remaining quota or a token count |
use_time | Request duration in milliseconds |
is_stream | Whether a streaming response was used |
channel_name | Provider or channel that processed the request |
request_id | Request identifier for correlating troubleshooting logs |
content | Displayable error information when the request ultimately fails; usually an empty string on success |
Failed Requests
Requests that ultimately return 4xx or 5xx appear in the time-range log list alongside successful requests, and content contains displayable error information. If an upstream retry or failover eventually succeeds, the log is aggregated by the final result and content does not expose an intermediate failure as the final error.
This compatibility API supports only pagination and time-range queries. It does not currently support filtering by failure status, HTTP status code, or model, and the response does not include separate status or http_code fields. Use the console request-log page when you need precise failure filtering.
/api/log/token always uses the API Key from the request header. A key parameter in the URL is ignored and cannot be used to query another Key.
Request logs depend on gateway telemetry storage. If telemetry is temporarily unavailable, the API returns log_store_unavailable; retry later.
Unsupported Items
The following NewAPI endpoints are not currently guaranteed to be compatible. Integrate them using the native Inference Space documentation instead:
| NewAPI capability | Status |
|---|---|
/v1/embeddings | Not currently handled |
/v1/moderations | Not currently available |
/v1/responses compact features | Pending confirmation of native Responses semantics |
/v1/images/variations | Not currently available |
| Proprietary Kling / Jimeng / Midjourney / Suno task routes | Not currently available |