curl -X POST "https://t.ato2.nodesms.com/v1/chat/completions" \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-4",
"messages": [
{
"role": "system",
"content": "string"
}
]
}'
import openai
client = openai.OpenAI(
api_key="sk-xxxxxx",
base_url="https://t.ato2.nodesms.com/v1"
)
response = client.chat.completions.create(
model="gpt-4",
messages=[{"role": "system", "content": "string"}]
)
print(response.choices[0].message.content)
{
"id": "string",
"object": "chat.completion",
"created": 0,
"model": "string",
"choices": [
{
"index": 0,
"message": {
"role": "system",
"content": "string",
"name": "string",
"tool_calls": [
{
"id": "string",
"type": "function",
"function": {
"name": "string",
"arguments": "string"
}
}
],
"tool_call_id": "string",
"reasoning_content": "string"
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 0,
"completion_tokens": 0,
"total_tokens": 0,
"prompt_tokens_details": {
"cached_tokens": 0,
"text_tokens": 0,
"audio_tokens": 0,
"image_tokens": 0
},
"completion_tokens_details": {
"text_tokens": 0,
"audio_tokens": 0,
"reasoning_tokens": 0
}
},
"system_fingerprint": "string"
}
{
"error": {
"message": "string",
"type": "string",
"param": "string",
"code": "string"
}
}
{
"error": {
"message": "string",
"type": "string",
"param": "string",
"code": "string"
}
}
Chat Completions Format
Create a model response based on conversation history. Supports streaming and non-streaming responses. Compatible with the OpenAI Chat Completions API.
POST
/
v1
/
chat
/
completions
curl -X POST "https://t.ato2.nodesms.com/v1/chat/completions" \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-4",
"messages": [
{
"role": "system",
"content": "string"
}
]
}'
import openai
client = openai.OpenAI(
api_key="sk-xxxxxx",
base_url="https://t.ato2.nodesms.com/v1"
)
response = client.chat.completions.create(
model="gpt-4",
messages=[{"role": "system", "content": "string"}]
)
print(response.choices[0].message.content)
{
"id": "string",
"object": "chat.completion",
"created": 0,
"model": "string",
"choices": [
{
"index": 0,
"message": {
"role": "system",
"content": "string",
"name": "string",
"tool_calls": [
{
"id": "string",
"type": "function",
"function": {
"name": "string",
"arguments": "string"
}
}
],
"tool_call_id": "string",
"reasoning_content": "string"
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 0,
"completion_tokens": 0,
"total_tokens": 0,
"prompt_tokens_details": {
"cached_tokens": 0,
"text_tokens": 0,
"audio_tokens": 0,
"image_tokens": 0
},
"completion_tokens_details": {
"text_tokens": 0,
"audio_tokens": 0,
"reasoning_tokens": 0
}
},
"system_fingerprint": "string"
}
{
"error": {
"message": "string",
"type": "string",
"param": "string",
"code": "string"
}
}
{
"error": {
"message": "string",
"type": "string",
"param": "string",
"code": "string"
}
}
When
stream is set to true, the API returns generated content in SSE chunks.
Headers
string
required
Bearer token authentication. Format:
Authorization: Bearer sk-xxxxxxBody
Format:application/json
string
required
Model ID
object[]
required
number
default:"1"
Sampling temperature, range
0 to 2number
default:"1"
Nucleus sampling parameter, range
0 to 1integer
default:"1"
Number of completions to generate, range
1 and aboveboolean
default:"false"
Whether to stream the response
object
Streaming response options
Show Properties
Show Properties
boolean
Whether to include usage information in the streaming response
string | string[]
Stop sequence(s)
integer
Maximum number of tokens to generate
integer
Maximum number of completion tokens
number
default:"0"
Presence penalty, range
-2 to 2number
default:"0"
Frequency penalty, range
-2 to 2object
Sampling bias for specified tokens
Show Properties
Show Properties
number
Key is the token ID, value is the bias amount
string
User identifier
string | object
object
integer
Random seed
string
Reasoning effort (for models that support reasoning). Options:
"low", "medium", "high"string[]
List of modality types
Response
200 Successfully created response
Format:application/json
string
Completion ID
string
Object type, value is
chat.completioninteger
Creation timestamp
string
Model ID
object[]
List of generated results
Show Properties
Show Properties
integer
Result index
object
string
Finish reason, e.g.
stopobject
Token usage information
Show Properties
Show Properties
integer
Prompt token count
integer
Completion token count
integer
Total token count
object
string
System fingerprint
400 Invalid request parameters
Format:application/json
object
429 Rate limit exceeded
Format:application/json
object
curl -X POST "https://t.ato2.nodesms.com/v1/chat/completions" \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-4",
"messages": [
{
"role": "system",
"content": "string"
}
]
}'
import openai
client = openai.OpenAI(
api_key="sk-xxxxxx",
base_url="https://t.ato2.nodesms.com/v1"
)
response = client.chat.completions.create(
model="gpt-4",
messages=[{"role": "system", "content": "string"}]
)
print(response.choices[0].message.content)
{
"id": "string",
"object": "chat.completion",
"created": 0,
"model": "string",
"choices": [
{
"index": 0,
"message": {
"role": "system",
"content": "string",
"name": "string",
"tool_calls": [
{
"id": "string",
"type": "function",
"function": {
"name": "string",
"arguments": "string"
}
}
],
"tool_call_id": "string",
"reasoning_content": "string"
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 0,
"completion_tokens": 0,
"total_tokens": 0,
"prompt_tokens_details": {
"cached_tokens": 0,
"text_tokens": 0,
"audio_tokens": 0,
"image_tokens": 0
},
"completion_tokens_details": {
"text_tokens": 0,
"audio_tokens": 0,
"reasoning_tokens": 0
}
},
"system_fingerprint": "string"
}
{
"error": {
"message": "string",
"type": "string",
"param": "string",
"code": "string"
}
}
{
"error": {
"message": "string",
"type": "string",
"param": "string",
"code": "string"
}
}
Last modified on October 28, 2026
Was this page helpful?