Skip to main content

Chat Interface

Note: The following examples need to replace the Authorization with the actual Login Code

Streaming Response

curl --location 'https://ai.liaobots.work/v1/chat/completions' \
--header 'Authorization: Bearer <authcode>' \
--header 'Content-Type: application/json' \
--data '{
    "model": "gpt-4o",
    "messages": [
        {
            "role": "user",
            "content": "Hi"
        }
    ],
    "temperature": 1,
    "stream": true
}'

Non-Streaming Response

curl --location 'https://ai.liaobots.work/v1/chat/completions' \
--header 'Authorization: Bearer <authcode>' \
--header 'Content-Type: application/json' \
--data '{
    "model": "gpt-4o",
    "messages": [
        {
            "role": "user",
            "content": "Hi"
        }
    ],
    "temperature": 1,
    "stream": false
}'

Gemini(Gemini format)

Non-Streaming Response

Curl
curl "https://ai.liaobots.work/v1beta/models/gemini-3-pro-preview(or other models):generateContent" \
  -H "x-goog-api-key: <authcode>" \
  -H 'Content-Type: application/json' \
  -X POST \
  -d '{
    "contents": [
      {
        "parts": [
          {
            "text": "Explain how AI works in a few words"
          }
        ]
      }
    ]
  }'

Streaming Response

Curl
curl "https://ai.liaobots.work/v1beta/models/gemini-3-pro-preview(or other models):streamGenerateContent?alt=sse" \
  -H "x-goog-api-key: <authcode>" \
  -H 'Content-Type: application/json' \
  -X POST \
  -d '{
    "contents": [
      {
        "parts": [
          {
            "text": "Explain how AI works in a few words"
          }
        ]
      }
    ]
  }'

Gemini Nano Banana 2/Pro

Non-Streaming Response

Curl
curl "https://ai.liaobots.work/v1beta/models/gemini-3-pro-image-preview:generateContent" \
  -H "x-goog-api-key: <authcode>" \
  -H 'Content-Type: application/json' \
  -X POST \
  -d '{
      "contents": [
          {
              "parts": [
                  {
                      "text": "Generate a visualization of the current weather in Tokyo."
                  }
              ]
          }
      ],
      "tools": [
          {
              "googleSearch": {}
          }
      ],
      "generationConfig": {
          "imageConfig": {
              "aspectRatio": "1:1",
              "imageSize": "2k"
          },
          "responseModalities":
          [
              "TEXT",
              "IMAGE"
          ]
      }
  }

Streaming Response

Curl
curl "https://ai.liaobots.work/v1beta/models/gemini-3-pro-image-preview:streamGenerateContent?alt=sse" \
  -H "x-goog-api-key: <authcode>" \
  -H 'Content-Type: application/json' \
  -X POST \
  -d '{
      "contents": [
          {
              "parts": [
                  {
                      "text": "Generate two dogs in manga style."
                  }
              ]
          }
      ],
      "generationConfig": {
          "imageConfig": {
              "aspectRatio": "16:9",
              "imageSize": "1K"
          },
          "responseModalities":
          [
              "TEXT",
              "IMAGE"
          ]
      }
  }