OpenAI Models
Authentication: All protocols use
Authorization: Bearer <API Key>request header. Set"stream": trueto enable SSE streaming.
Basic Chat
http
POST /v1/chat/completionsbash
curl --location --request POST 'https://neolink.com/api/v1/chat/completions' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <API Key>' \
--data-raw '{
"model": "<Model ID>",
"messages": [
{
"role": "user",
"content": "hello"
}
]
}'python
import requests
url = "https://neolink.com/api/v1/chat/completions"
headers = {
"Content-Type": "application/json",
"Authorization": "Bearer <API Key>",
}
payload = {
"model": "<Model ID>",
"messages": [
{
"role": "user",
"content": "hello"
}
]
}
response = requests.post(url, headers=headers, json=payload, timeout=30)
response.raise_for_status()
result = response.json()
print(result)
if "choices" in result:
print("Assistant:", result["choices"][0]["message"]["content"])Optional Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
max_completion_tokens | int | No | - | Maximum tokens for generated content (including reasoning process). This is the recommended new parameter, especially for reasoning models (like o1 series), as it includes the model's thinking process tokens. Takes precedence over max_tokens if both are set |
max_tokens | int | No | - | Maximum tokens for response generation (excluding reasoning process). This is a legacy parameter kept for backward compatibility. Still usable for non-reasoning models, but reasoning models should use max_completion_tokens instead |
temperature | float | No | 1.0 | Sampling temperature, range 0.0~2.0. Higher values (e.g., 1.5) make output more random and creative, lower values (e.g., 0.3) make output more deterministic and focused. 0 means greedy sampling. Recommended to adjust either this or top_p, not both |
top_p | float | No | 1.0 | Nucleus sampling threshold, range 0.0~1.0. The model considers tokens with cumulative probability up to top_p. For example, 0.1 means only consider the top 10% probability tokens. Recommended to adjust either this or temperature, not both |
frequency_penalty | float | No | 0.0 | Frequency penalty coefficient, range -2.0~2.0. Positive values penalize tokens based on their frequency in the text so far, decreasing likelihood of repeating the same words. Higher values make the model more likely to use different vocabulary |
presence_penalty | float | No | 0.0 | Presence penalty coefficient, range -2.0~2.0. Positive values penalize tokens that have already appeared (regardless of frequency), encouraging the model to talk about new topics. Unlike frequency_penalty, it doesn't consider how often, only whether it appeared |
n | int | No | 1 | Number of chat completion choices to generate for each input message. Setting it greater than 1 returns multiple candidate responses, each billed separately. Useful for scenarios requiring multiple different answers |
stop | string or array | No | null | Stop sequences, up to 4. Generation stops immediately when any stop sequence appears in the generated text. Useful for controlling output boundaries, e.g., ["\n\n", "###"] |
stream | bool | No | false | Whether to enable SSE (Server-Sent Events) streaming output. When set to true, responses are returned progressively as a data stream, suitable for scenarios requiring real-time display of generated content |
seed | int | No | - | Random seed for reproducible outputs. Using the same seed and parameters will attempt to generate the same results (though not guaranteed to be identical). Useful for debugging and scenarios requiring consistent output |
logprobs | bool | No | false | Whether to return log probability information for output tokens. When enabled, the response includes log probabilities for each token, useful for analyzing model certainty and confidence |
top_logprobs | int | No | - | Number of most likely tokens to return at each position, range 0~20. Requires logprobs: true to work. The returned information can be used to analyze alternative tokens at each position |
user | string | No | - | Unique identifier for the end-user, recommended to use user ID or device ID. OpenAI uses this parameter to monitor and detect abuse, helping to take action when abuse is detected |
response_format | object | No | - | Specifies the model's output format. Setting {"type": "json_object"} forces the model to output valid JSON. Note: when using JSON mode, you must explicitly request JSON output in the messages, otherwise it may cause infinite generation |
tools | array | No | - | List of tools (functions) the model may call. Each tool needs a name, description, and parameter schema. The model can decide whether to call tools based on the conversation, returning function name and parameters when calling, which the application executes and returns results to the model |
tool_choice | string or object | No | auto | Controls how the model calls tools. none means no tool calling, auto means the model decides, required means must call at least one tool. Can also specify a specific tool like {"type": "function", "function": {"name": "my_function"}} |
reasoning_effort | string | No | medium | Reasoning effort (only for reasoning models like o1 series). Options: minimal, low, medium, high. Higher values mean the model invests more tokens in reasoning, potentially better quality but higher cost and slower speed |
Notes:
reasoning_effortonly works with reasoning models (like o1, o3 series). Regular models ignore this parameter.- Reasoning models should use
max_completion_tokensinstead ofmax_tokens, as the former includes thinking process token count.- Recommended to adjust only one of
temperatureortop_p, adjusting both may lead to unpredictable behavior.frequency_penaltyandpresence_penaltycan be used together; combining them provides better control over repetition.
Full Parameters Example
bash
curl --location --request POST 'https://neolink.com/api/v1/chat/completions' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <API Key>' \
--data-raw '{
"model": "<Model ID>",
"max_completion_tokens": 2048,
"temperature": 1.0,
"top_p": 1.0,
"reasoning_effort": "medium",
"stream": false,
"messages": [
{
"role": "user",
"content": "hello"
}
]
}'python
import requests
url = "https://neolink.com/api/v1/chat/completions"
headers = {
"Content-Type": "application/json",
"Authorization": "Bearer <API Key>",
}
payload = {
"model": "<Model ID>",
"max_completion_tokens": 2048,
"temperature": 1.0,
"top_p": 1.0,
"reasoning_effort": "medium",
"stream": False,
"messages": [
{
"role": "user",
"content": "hello"
}
]
}
response = requests.post(url, headers=headers, json=payload, timeout=30)
response.raise_for_status()
result = response.json()
print(result)Responses API
For the complete Responses API (/v1/responses) documentation including multimodal requests, search requests, and all parameters, please refer to OpenAI Responses API.
