curl -X POST https://www.token-nova.com/v1/chat/completions \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-4o",
"messages": [
{ "role": "system", "content": "You are an API documentation assistant." },
{ "role": "user", "content": "Generate a summary of the API description." }
],
"stream": false
}'
{
"id": "chatcmpl_abc123",
"object": "chat.completion",
"created": 1735689600,
"model": "gpt-4o",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "This API accepts unified conversation messages and generates a complete response in a single shot based on the model."
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 31,
"completion_tokens": 24,
"total_tokens": 55
}
}
{
"error": {
"message": "field model is required",
"type": "invalid_request_error",
"param": "",
"code": "invalid_request"
}
}
{
"error": {
"message": "Invalid API key provided",
"type": "invalid_request_error",
"param": "",
"code": "invalid_api_key"
}
}
{
"error": {
"message": "Insufficient user quota",
"type": "new_api_error",
"param": "",
"code": "insufficient_user_quota"
}
}
{
"error": {
"message": "The current request rate is too high. Please try again later.",
"type": "new_api_error",
"param": "",
"code": "too_many_requests"
}
}
{
"error": {
"message": "bad response body",
"type": "new_api_error",
"param": "",
"code": "bad_response_body"
}
}
OpenAI Format
General Chat Completions API (Default Non-Streaming)
Use the OpenAI Chat Completions-compatible format to initiate a conversation and return the full result in one response.
POST
https://www.token-nova.com
/
v1
/
chat
/
completions
curl -X POST https://www.token-nova.com/v1/chat/completions \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-4o",
"messages": [
{ "role": "system", "content": "You are an API documentation assistant." },
{ "role": "user", "content": "Generate a summary of the API description." }
],
"stream": false
}'
{
"id": "chatcmpl_abc123",
"object": "chat.completion",
"created": 1735689600,
"model": "gpt-4o",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "This API accepts unified conversation messages and generates a complete response in a single shot based on the model."
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 31,
"completion_tokens": 24,
"total_tokens": 55
}
}
{
"error": {
"message": "field model is required",
"type": "invalid_request_error",
"param": "",
"code": "invalid_request"
}
}
{
"error": {
"message": "Invalid API key provided",
"type": "invalid_request_error",
"param": "",
"code": "invalid_api_key"
}
}
{
"error": {
"message": "Insufficient user quota",
"type": "new_api_error",
"param": "",
"code": "insufficient_user_quota"
}
}
{
"error": {
"message": "The current request rate is too high. Please try again later.",
"type": "new_api_error",
"param": "",
"code": "too_many_requests"
}
}
{
"error": {
"message": "bad response body",
"type": "new_api_error",
"param": "",
"code": "bad_response_body"
}
}
General Chat Completions API (Default Non-Streaming)
Suitable for background tasks, structured output, short Q&A, and scenarios where real-time display of the generation process is not required. Whenstream is omitted or set to false, the API returns a complete chat.completion object in a single response.
Request Body
string
required
Model name. Can be queried via the model list.
array<object>
required
An array of conversation messages. Each message must contain at least
role and content.boolean
Non-streaming response when omitted or set to
false.object
Specifies the output format. Commonly used for JSON output or JSON Schema structured output.
array<object>
A list of function calling tools.
string | object
Controls the tool calling strategy.
number
Sampling temperature. The default value is determined by the upstream model.
number
Nucleus sampling parameter.
integer
Maximum number of generated tokens.
number
Random seed. When supported by the upstream model, this can improve reproducibility.
Request Example
curl -X POST https://www.token-nova.com/v1/chat/completions \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-4o",
"messages": [
{ "role": "system", "content": "You are an API documentation assistant." },
{ "role": "user", "content": "Generate a summary of the API description." }
],
"stream": false
}'
Structured Output
curl -X POST https://www.token-nova.com/v1/chat/completions \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-4o",
"messages": [
{ "role": "user", "content": "Extract the topic and tone from this sentence: This version was released on a very steady cadence." }
],
"response_format": {
"type": "json_schema",
"json_schema": {
"name": "analysis",
"schema": {
"type": "object",
"properties": {
"topic": { "type": "string" },
"tone": { "type": "string" }
},
"required": ["topic", "tone"]
}
}
}
}'
Response Example
{
"id": "chatcmpl_abc123",
"object": "chat.completion",
"created": 1735689600,
"model": "gpt-4o",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "This API accepts unified conversation messages and generates a complete response in a single shot based on the model."
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 31,
"completion_tokens": 24,
"total_tokens": 55
}
}
{
"error": {
"message": "field model is required",
"type": "invalid_request_error",
"param": "",
"code": "invalid_request"
}
}
{
"error": {
"message": "Invalid API key provided",
"type": "invalid_request_error",
"param": "",
"code": "invalid_api_key"
}
}
{
"error": {
"message": "Insufficient user quota",
"type": "new_api_error",
"param": "",
"code": "insufficient_user_quota"
}
}
{
"error": {
"message": "The current request rate is too high. Please try again later.",
"type": "new_api_error",
"param": "",
"code": "too_many_requests"
}
}
{
"error": {
"message": "bad response body",
"type": "new_api_error",
"param": "",
"code": "bad_response_body"
}
}
Response Fields
string | null
The text content generated by the model. May be
null when a tool call occurs.array<object>
The function tools requested by the model.
object
Token usage for this request.
