xfusionai
  1. Chat
xfusionai
  • 产品介绍
  • 模型价格
  • 快速开始
  • Azure语音服务
  • Azure翻译服务
  • Azure open AI
  • 常见问题
  • OpenAI API
    • About OpenAI Compatible API
    • Chat
      • Chat Completion
        POST
    • Images
      • Create Image
    • Audio
      • Text To Speech API
  • Midjourney Open API
    • About Midjourney and Prices
    • Submit Imagine Task
      POST
    • Specify ID Query Task (fetch)
      GET
    • Specify the ID List Query Task
      GET
    • Obtain the seed of the Task Image
      GET
    • Specify ID Query Task
      GET
    • Submit Blend Task
      POST
    • Submit Modal Task
      POST
    • Submit Describe Task
      POST
    • Submit Shorten Task
      POST
    • Submit FaceSwap Task
      POST
    • Upload Files to Discord
      POST
    • Submit Action Task(All associated button actions UPSCALE; VARIATION; REROLL; ZOOM, etc.)
      POST
  • Luma video
    • Luma Task Creation
      POST
    • Luma Expand Video
      POST
    • Luma Query Task
      GET
    • Luma Download video
      GET
  • Suno Music
    • Generate music
    • Query task
  • Anthropic Claude
    • Claude Chat Completion
  • Flux API
    • Create Image
  1. Chat

Chat Completion

开发环境
http://dev-cn.your-api-server.com
开发环境
http://dev-cn.your-api-server.com
POST
/v1/chat/completions
OpenAI's ChatCompletion interface
Supports all OpenAI Chat models, including the latest 1106 batch.
For more information about the parameters of this interface, you can refer to the official OpenAI documentation at https://platform.openai.com/docs/api-reference/chat/create.
You can also use this interface to call the following non-OpenAI models in the same format as the OpenAI ChatCompletion API:

Anthropic Serises:#

claude-2
claude-instant-1.

Google AI Series:#

gemini-pro
gemini-pro-vision
palm-2-chat-bison
palm-2-chat-bison-32k
You only need to specify these models in the model parameter.

Google AI Series Notes#

0. Due to the poor API interface developed by Google VertexAI, we won't provide the native API, only offering the standard OpenAI Chat/Completions API.
1. Although the Gemini Pro series does not support non-streaming requests, we have implemented a wrapper for both streaming and non-streaming responses according to the OpenAI standard. Applications native to GPT can easily integrate by changing the model name.
2. Google AI's Gemini Pro and PaLM series models are currently in a preview stage with low concurrent quota, but our site is providing these model inference services for free. You can evaluate their capabilities or integrate them into your application in advance.
3. Gemini Pro Vision is a multimodal large model, similar to GPT4Vision, supporting mixed inference based on text and input images. Its usage is consistent with GPT4v.
4. As Google AI models are billed based on the number of characters, the Tokens in the bill will directly reflect the length of the input and output strings, not the actual Token length.
5. Regarding the capability level of the Gemini Pro series models: They are approximately at the level of 3.5, but the Vision version supports multimodality with moderately satisfactory results (meaning generally pleasing), and can be used as a smaller version of GPT4V.

About How to Use Gemini Pro Vision#

You can fully refer to OpenAI's Vision instructions: https://platform.openai.com/docs/guides/vision

请求参数

Authorization
在 Header 添加参数
Authorization
,其值为在 Bearer 之后拼接 Token
示例:
Authorization: Bearer ********************
Body 参数application/json
model
string 
必需
messages
array [object {2}] 
必需
role
string 
必需
content
string 
必需
stream
boolean 
必需
示例
{
    "model": "gpt-3.5-turbo",
    "messages": [
        {
            "role": "system",
            "content": "You are a helpful assistant."
        },
        {
            "role": "user",
            "content": "Say test"
        }
    ],
    "stream": false
}

示例代码

Shell
JavaScript
Java
Swift
Go
PHP
Python
HTTP
C
C#
Objective-C
Ruby
OCaml
Dart
R
请求示例请求示例
Shell
JavaScript
Java
Swift
curl --location --request POST 'http://dev-cn.your-api-server.com/v1/chat/completions' \
--header 'Content-Type: application/json' \
--data-raw '{
    "model": "gpt-3.5-turbo",
    "messages": [
        {
            "role": "system",
            "content": "You are a helpful assistant."
        },
        {
            "role": "user",
            "content": "Say test"
        }
    ],
    "stream": false
}'

返回响应

🟢200OK
application/json
Body
object {0}
示例
{
    "id": "chatcmpl-8Je5EIkoizgX7HIZHCfak05B9YmYx",
    "object": "chat.completion",
    "created": 1699693004,
    "model": "gpt-3.5-turbo-1106",
    "choices": [
        {
            "index": 0,
            "message": {
                "role": "assistant",
                "content": "Test"
            },
            "finish_reason": "stop"
        }
    ],
    "usage": {
        "prompt_tokens": 19,
        "completion_tokens": 1,
        "total_tokens": 20
    },
    "system_fingerprint": "fp_eeff13170a"
}
修改于 2024-11-09 17:14:40
上一页
About OpenAI Compatible API
下一页
Create Image
Built with