UniAPI API Doc
首页全部OpenAI平台接口音乐模型图像模型视频模型
首页全部OpenAI平台接口音乐模型图像模型视频模型
  1. Chat
  • Audio
    • 文本生成音频
      POST
    • 音频转文本
      POST
    • 创建转录
      POST
  • Chat
    • 聊天接口
      POST
  • Completions
    • 自动补全
      POST
  • Embeddings
    • 向量接口
      POST
  • Images
    • 图像编辑
      POST
    • 图像生成
      POST
    • 图像变体
      POST
  • Models
    • 获取模型列表
      GET
  • Moderations
    • 审核
      POST
  • Responses
    • response
      POST
  1. Chat

聊天接口

POST
/v1/chat/completions
请求示例请求示例
Shell
JavaScript
Java
Swift
curl --location --request POST 'https://api.uniapi.io/v1/chat/completions' \
--header 'Content-Type: application/json' \
--data-raw '{
    "metadata": {
        "property1": "string",
        "property2": "string"
    },
    "temperature": 1,
    "top_p": 1,
    "user": "user-1234",
    "service_tier": "auto",
    "messages": [
        {
            "content": "string",
            "role": "developer",
            "name": "string"
        }
    ],
    "model": "string",
    "modalities": [
        "text"
    ],
    "reasoning_effort": "medium",
    "max_completion_tokens": 0,
    "frequency_penalty": 0,
    "presence_penalty": 0,
    "web_search_options": {
        "user_location": {
            "type": "approximate",
            "approximate": {
                "country": "string",
                "region": "string",
                "city": "string",
                "timezone": "string"
            }
        },
        "search_context_size": "medium"
    },
    "top_logprobs": 0,
    "response_format": {
        "type": "text"
    },
    "audio": {
        "voice": "string",
        "format": "wav"
    },
    "store": false,
    "stream": false,
    "stop": "<|endoftext|>",
    "logit_bias": null,
    "logprobs": false,
    "max_tokens": 0,
    "n": 1,
    "prediction": {
        "type": "content",
        "content": "string"
    },
    "seed": -9223372036854776000,
    "stream_options": null,
    "tools": [
        {
            "type": "function",
            "function": {
                "description": "string",
                "name": "string",
                "parameters": {},
                "strict": false
            }
        }
    ],
    "tool_choice": "none",
    "parallel_tool_calls": true,
    "function_call": "none",
    "functions": [
        {
            "description": "string",
            "name": "string",
            "parameters": {}
        }
    ]
}'
响应示例响应示例
{
    "id": "string",
    "choices": [
        {
            "finish_reason": "stop",
            "index": 0,
            "message": {
                "content": "string",
                "refusal": "string",
                "tool_calls": [
                    {
                        "id": "string",
                        "type": "function",
                        "function": {
                            "name": "string",
                            "arguments": "string"
                        }
                    }
                ],
                "annotations": [
                    {
                        "type": "url_citation",
                        "url_citation": {
                            "end_index": 0,
                            "start_index": 0,
                            "url": "string",
                            "title": "string"
                        }
                    }
                ],
                "role": "assistant",
                "function_call": {
                    "arguments": "string",
                    "name": "string"
                },
                "audio": {
                    "id": "string",
                    "expires_at": 0,
                    "data": "string",
                    "transcript": "string"
                }
            },
            "logprobs": {
                "content": [
                    {
                        "token": "string",
                        "logprob": 0,
                        "bytes": [
                            0
                        ],
                        "top_logprobs": [
                            {
                                "token": "string",
                                "logprob": 0,
                                "bytes": [
                                    0
                                ]
                            }
                        ]
                    }
                ],
                "refusal": [
                    {
                        "token": "string",
                        "logprob": 0,
                        "bytes": [
                            0
                        ],
                        "top_logprobs": [
                            {
                                "token": "string",
                                "logprob": 0,
                                "bytes": [
                                    0
                                ]
                            }
                        ]
                    }
                ]
            }
        }
    ],
    "created": 0,
    "model": "string",
    "service_tier": "auto",
    "system_fingerprint": "string",
    "object": "chat.completion",
    "usage": {
        "completion_tokens": 0,
        "prompt_tokens": 0,
        "total_tokens": 0,
        "completion_tokens_details": {
            "accepted_prediction_tokens": 0,
            "audio_tokens": 0,
            "reasoning_tokens": 0,
            "rejected_prediction_tokens": 0
        },
        "prompt_tokens_details": {
            "audio_tokens": 0,
            "cached_tokens": 0
        }
    }
}

请求参数

Authorization
在 Header 添加参数
Authorization
,其值为在 Bearer 之后拼接 Token
示例:
Authorization: Bearer ********************
Body 参数application/json

示例

返回响应

🟢200成功
application/json
OK
Body

修改于 2025-05-18 07:36:21
上一页
创建转录
下一页
自动补全
Built with