API Manual

TK-NovaLink provides a complete OpenAI-compatible API. This document lists all available endpoints, parameters, and response formats.

API Endpoints

APIPathMethod
Chat Completions/v1/chat/completionsPOST
Text Completions/v1/completionsPOST
Embeddings/v1/embeddingsPOST
Image Generation/v1/images/generationsPOST
Audio Transcription/v1/audio/transcriptionsPOST
List Models/v1/modelsGET

Authentication

All API requests require a Bearer Token in the HTTP Header:

http
Authorization: Bearer sk-xxxxxxxxxxxxxxxxxxxxxxxx

Chat Completion Parameters

The chat completion endpoint supports the following parameters:

ParameterTypeRequiredDescription
modelstringYesModel name, e.g. gpt-4o
messagesarrayYesArray of chat messages
temperaturenumberNoSampling temperature, 0-2, default 1
max_tokensintegerNoMax tokens to generate
streambooleanNoWhether to stream the response, default false
top_pnumberNoNucleus sampling parameter, 0-1

Request Example

json
{
  "model": "gpt-4o",
  "messages": [
    {"role": "system", "content": "You are a helpful assistant."},
    {"role": "user", "content": "Hello!"}
  ],
  "max_tokens": 1024,
  "temperature": 0.7,
  "stream": false
}

Response Example

json
{
  "id": "chatcmpl-xxx",
  "object": "chat.completion",
  "created": 1700000000,
  "model": "gpt-4o",
  "choices": [{
    "index": 0,
    "message": {
      "role": "assistant",
      "content": "Hello! How can I help you today?"
    },
    "finish_reason": "stop"
  }],
  "usage": {
    "prompt_tokens": 15,
    "completion_tokens": 8,
    "total_tokens": 23
  }
}

Error Codes

When a request fails, the API returns an error code and message:

Error CodeHTTP StatusDescription
invalid_api_key401Invalid API key
insufficient_quota429Insufficient quota
model_not_found404Model not found
invalid_request_error400Invalid request parameters
server_error500Internal server error
rate_limit_exceeded429Rate limit exceeded

Rate Limits

TK-NovaLink enforces rate limits to ensure service quality.

Rate limits (RPM/TPM) vary by model, token group, route, and account settings. Exceeding the limit returns HTTP 429; we recommend retrying with exponential backoff.

Next

Pricing & Billing

Continue Reading