Chat Completions
curl --request POST \
--url https://api.aisa.one/apis/v1/parallel/chat/completions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"messages": [
{
"content": "<string>",
"name": "<string>"
}
]
}
'import requests
url = "https://api.aisa.one/apis/v1/parallel/chat/completions"
payload = { "messages": [
{
"content": "<string>",
"name": "<string>"
}
] }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({messages: [{content: '<string>', name: '<string>'}]})
};
fetch('https://api.aisa.one/apis/v1/parallel/chat/completions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.aisa.one/apis/v1/parallel/chat/completions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'messages' => [
[
'content' => '<string>',
'name' => '<string>'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.aisa.one/apis/v1/parallel/chat/completions"
payload := strings.NewReader("{\n \"messages\": [\n {\n \"content\": \"<string>\",\n \"name\": \"<string>\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.aisa.one/apis/v1/parallel/chat/completions")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"messages\": [\n {\n \"content\": \"<string>\",\n \"name\": \"<string>\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.aisa.one/apis/v1/parallel/chat/completions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"messages\": [\n {\n \"content\": \"<string>\",\n \"name\": \"<string>\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"choices": [
{
"delta": {
"content": "<string>",
"function_call": {
"arguments": "<string>",
"name": "<string>"
},
"refusal": "<string>",
"role": "developer",
"tool_calls": [
{
"index": 123,
"function": {
"arguments": "<string>",
"name": "<string>"
},
"id": "<string>",
"type": "function"
}
]
},
"index": 123,
"finish_reason": "stop",
"logprobs": {
"content": [
{
"logprob": 123,
"token": "<string>",
"top_logprobs": [
{
"logprob": 123,
"token": "<string>",
"bytes": [
123
]
}
],
"bytes": [
123
]
}
],
"refusal": [
{
"logprob": 123,
"token": "<string>",
"top_logprobs": [
{
"logprob": 123,
"token": "<string>",
"bytes": [
123
]
}
],
"bytes": [
123
]
}
]
}
}
],
"created": 123,
"id": "<string>",
"model": "<string>",
"object": "chat.completion",
"basis": [],
"interaction_id": "<string>",
"moderation": {
"input": {
"model": "<string>",
"results": [
{
"categories": {},
"category_applied_input_types": {},
"category_scores": {},
"flagged": true,
"model": "<string>",
"type": "moderation_result"
}
],
"type": "moderation_results"
},
"output": {
"model": "<string>",
"results": [
{
"categories": {},
"category_applied_input_types": {},
"category_scores": {},
"flagged": true,
"model": "<string>",
"type": "moderation_result"
}
],
"type": "moderation_results"
}
},
"service_tier": "auto",
"system_fingerprint": "<string>",
"usage": {
"completion_tokens": 123,
"prompt_tokens": 123,
"total_tokens": 123,
"completion_tokens_details": {
"accepted_prediction_tokens": 123,
"audio_tokens": 123,
"reasoning_tokens": 123,
"rejected_prediction_tokens": 123
},
"prompt_tokens_details": {
"audio_tokens": 123,
"cached_tokens": 123
}
}
}Parallel
Chat Completions
Chat completions.
This endpoint can be used to get realtime chat completions. It can also be used with the Task API processors to get structured, research outputs via a chat interface.
POST
https://api.aisa.one
/
apis
/
v1
/
parallel
/
chat
/
completions
Chat Completions
curl --request POST \
--url https://api.aisa.one/apis/v1/parallel/chat/completions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"messages": [
{
"content": "<string>",
"name": "<string>"
}
]
}
'import requests
url = "https://api.aisa.one/apis/v1/parallel/chat/completions"
payload = { "messages": [
{
"content": "<string>",
"name": "<string>"
}
] }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({messages: [{content: '<string>', name: '<string>'}]})
};
fetch('https://api.aisa.one/apis/v1/parallel/chat/completions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.aisa.one/apis/v1/parallel/chat/completions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'messages' => [
[
'content' => '<string>',
'name' => '<string>'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.aisa.one/apis/v1/parallel/chat/completions"
payload := strings.NewReader("{\n \"messages\": [\n {\n \"content\": \"<string>\",\n \"name\": \"<string>\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.aisa.one/apis/v1/parallel/chat/completions")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"messages\": [\n {\n \"content\": \"<string>\",\n \"name\": \"<string>\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.aisa.one/apis/v1/parallel/chat/completions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"messages\": [\n {\n \"content\": \"<string>\",\n \"name\": \"<string>\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"choices": [
{
"delta": {
"content": "<string>",
"function_call": {
"arguments": "<string>",
"name": "<string>"
},
"refusal": "<string>",
"role": "developer",
"tool_calls": [
{
"index": 123,
"function": {
"arguments": "<string>",
"name": "<string>"
},
"id": "<string>",
"type": "function"
}
]
},
"index": 123,
"finish_reason": "stop",
"logprobs": {
"content": [
{
"logprob": 123,
"token": "<string>",
"top_logprobs": [
{
"logprob": 123,
"token": "<string>",
"bytes": [
123
]
}
],
"bytes": [
123
]
}
],
"refusal": [
{
"logprob": 123,
"token": "<string>",
"top_logprobs": [
{
"logprob": 123,
"token": "<string>",
"bytes": [
123
]
}
],
"bytes": [
123
]
}
]
}
}
],
"created": 123,
"id": "<string>",
"model": "<string>",
"object": "chat.completion",
"basis": [],
"interaction_id": "<string>",
"moderation": {
"input": {
"model": "<string>",
"results": [
{
"categories": {},
"category_applied_input_types": {},
"category_scores": {},
"flagged": true,
"model": "<string>",
"type": "moderation_result"
}
],
"type": "moderation_results"
},
"output": {
"model": "<string>",
"results": [
{
"categories": {},
"category_applied_input_types": {},
"category_scores": {},
"flagged": true,
"model": "<string>",
"type": "moderation_result"
}
],
"type": "moderation_results"
}
},
"service_tier": "auto",
"system_fingerprint": "<string>",
"usage": {
"completion_tokens": 123,
"prompt_tokens": 123,
"total_tokens": 123,
"completion_tokens_details": {
"accepted_prediction_tokens": 123,
"audio_tokens": 123,
"reasoning_tokens": 123,
"rejected_prediction_tokens": 123
},
"prompt_tokens_details": {
"audio_tokens": 123,
"cached_tokens": 123
}
}
}请求规范
- 方法与路径: POST /apis/v1/parallel/chat/completions
- 可用状态: enabled
- 请求 URL 模板:
https://api.aisa.one/apis/v1/parallel/chat/completions
{
"operationId": "post_parallel_ai_apis_v1_parallel_chat_completions",
"method": "POST",
"path": "/apis/v1/parallel/chat/completions",
"servers": [
{
"url": "https://api.aisa.one"
}
],
"parameters": [],
"security": [
{
"bearerAuth": []
}
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"description": "Request for the chat completions endpoint.\n\nNote that all parameters except for `model`, `stream`, and `response_format`\nare ignored.",
"properties": {
"frequency_penalty": {
"anyOf": [
{
"type": "number"
},
{
"type": "null"
}
],
"description": "The frequency penalty to use for chat completions. Unsupported.",
"title": "Frequency Penalty"
},
"max_tokens": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"description": "The maximum number of tokens to generate. Unsupported.",
"title": "Max Tokens"
},
"messages": {
"description": "The messages to use for chat completions.",
"items": {
"description": "Chat message for OpenAI API.",
"properties": {
"content": {
"description": "The content of the chat message.",
"title": "Content",
"type": "string"
},
"name": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"description": "An optional name for the participant. Provides the model information to differentiate between participants of the same role.",
"title": "Name"
},
"role": {
"description": "The role of the chat message.",
"enum": [
"system",
"user",
"assistant"
],
"title": "Role",
"type": "string"
}
},
"required": [
"role",
"content"
],
"title": "ChatMessage",
"type": "object"
},
"minItems": 1,
"title": "Messages",
"type": "array"
},
"model": {
"description": "The model to use for chat completions.",
"enum": [
"base",
"core",
"lite",
"speed"
],
"title": "Model",
"type": "string"
},
"n": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"description": "The number of chat completions to generate. Unsupported.",
"title": "N"
},
"presence_penalty": {
"anyOf": [
{
"type": "number"
},
{
"type": "null"
}
],
"description": "The presence penalty to use for chat completions. Unsupported.",
"title": "Presence Penalty"
},
"previous_interaction_id": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"description": "Interaction ID from a previous chat completion to use as context.",
"title": "Previous Interaction Id"
},
"response_format": {
"anyOf": [
{
"description": "Default response format. Used to generate text responses.",
"properties": {
"type": {
"const": "text",
"title": "Type",
"type": "string"
}
},
"required": [
"type"
],
"title": "ResponseFormatText",
"type": "object"
},
{
"description": "JSON Schema response format.\n\nUsed to generate structured JSON responses.\nLearn more about [Structured Outputs](https://platform.openai.com/docs/guides/structured-outputs).",
"properties": {
"json_schema": {
"description": "Structured Outputs configuration options, including a JSON Schema.",
"properties": {
"description": {
"title": "Description",
"type": "string"
},
"name": {
"title": "Name",
"type": "string"
},
"schema": {
"additionalProperties": false,
"title": "Schema",
"type": "object"
},
"strict": {
"anyOf": [
{
"type": "boolean"
},
{
"type": "null"
}
],
"title": "Strict"
}
},
"required": [
"name"
],
"title": "JSONSchema",
"type": "object"
},
"type": {
"const": "json_schema",
"title": "Type",
"type": "string"
}
},
"required": [
"json_schema",
"type"
],
"title": "ResponseFormatJSONSchema",
"type": "object"
},
{
"description": "JSON object response format.\n\nAn older method of generating JSON responses.\nUsing `json_schema` is recommended for models that support it. Note that the\nmodel will not generate JSON without a system or user message instructing it\nto do so.",
"properties": {
"type": {
"const": "json_object",
"title": "Type",
"type": "string"
}
},
"required": [
"type"
],
"title": "ResponseFormatJSONObject",
"type": "object"
},
{
"type": "null"
}
],
"description": "The response format to use for chat completions. OpenAI compatible.",
"title": "Response Format"
},
"stream": {
"anyOf": [
{
"type": "boolean"
},
{
"type": "null"
}
],
"description": "Whether to stream the chat completions.",
"title": "Stream"
},
"temperature": {
"anyOf": [
{
"type": "number"
},
{
"type": "null"
}
],
"description": "The temperature to use for chat completions. Unsupported.",
"title": "Temperature"
},
"top_p": {
"anyOf": [
{
"type": "number"
},
{
"type": "null"
}
],
"description": "The top p to use for chat completions. Unsupported.",
"title": "Top P"
}
},
"required": [
"messages",
"model"
],
"title": "ChatCompletionRequest",
"type": "object"
}
}
},
"required": true
},
"x-aisa-status": "enabled",
"components": {
"securitySchemes": {
"bearerAuth": {
"scheme": "bearer",
"type": "http"
}
}
}
}
费用与请求规则
请求费用。 默认请求预估费用:$0.01 USD。 最终费用以实际用量为准。 账户适用价格可能不同;支持报价的接口可按实际请求获取报价。授权
请求体
application/json
Request for the chat completions endpoint.
Note that all parameters except for model, stream, and response_format
are ignored.
响应
Returns a ChatCompletion object for non-streaming requests (application/json), or a stream of ChatCompletionResponseChunk objects for streaming requests (text/event-stream) when stream=true is set in the request.
Chat completion response.