Skip to content
共绩算力文档中心

GPT-OSS-20B 弹性部署

GPT-OSS-20B 是一款由 OpenAI 推出的开源大型语言模型,拥有约 210 亿总参数,采用稀疏激活技术,每次激活约 36 亿参数 . 它基于 Transformer 架构,适用于低延迟、本地部署及推理任务,可在消费级硬件上运行。

本指南全面介绍了在共绩算力平台上部署 GPT-OSS-20B 大语言模型 OpenAI-Compatible APIs 服务的完整解决方案。

🐋

此镜像提供了标准化的 API 接口,让您能够便捷地通过 API 调用方式访问和使用所有功能。

访问共绩算力控制台 https://console.suanli.cn/serverless/idc

依次访问【弹性部署服务】-> 【新增部署任务】 -> 【选择 GPU 型号】-> 下拉至【服务配置】页面

在【服务配置】选项选择【GPT-OSS-20B】-> 【部署服务】

等待服务部署完毕,需要 5-30 分钟 (镜像拉取 + 模型编译)。

部署后平台会自动暴露出服务

此时 OpenAI-Compatible APIs 服务 URL 为:https://xxxxxxxx-xxxx-xxx-xxxxxxxx.30000.550c.cloud/v1 (红色箭头所指向,某些平台上 “/v1” 需要自己添加)

api key 不填或者随便填

Model id openai/gpt-oss-20b

接下来通过 Open WebUI 举例

【管理员设置】-> 【外部连接】->【管理直接连接】->【URL】->【密钥】->【模型 ID】->【保存】->【保存】

URL 为上述 OpenAI-Compatible APIs URL 注意要包含 “/v1”

密钥即为 api key 这里填 None,也可以随便填其他的

模型 ID 即为 Model id 填openai/gpt-oss-20b

来试试效果:

速度飞快✈️

我们也可以通过代码方式通过 API 接口调用

from openai import OpenAI
client = OpenAI(
base_url="https://d08271142-ollama-gpt-oss01-20b-239-awcwriyr-11434.550c.cloud/v1",
api_key="None" # 本地模型使用占位符密钥
)
response = client.chat.completions.create(
model="gpt-oss:20b",
messages=[
{
"role": "system",
"content": (
"You are an expert AI Prompt Optimization Engineer. Your task is to refine and enhance user-provided prompts"
)
},
{
"role": "user",
"content": "三个火柴人,左边的一位女性火柴人穿着紫色连衣裙,头顶上浮现一个问好,和中间的一位火柴人抢着话筒。右边的一位火柴人穿着婚纱,拉着中间火柴人的右手"
}
]
)
print(response.choices[0].message.content)

输出:

Refined Prompt (Chinese)

3 个火柴人:

  • 左侧是一个女性火柴人,穿着紫色连衣裙,头顶浮现一个“问候”图标(如笑脸或问号)。她正抢着中间火柴人的话筒,表情调皮。
  • 中间是一个普通火柴人,正与左侧争夺话筒,手中握着话筒,面部表情专注。
  • 右侧是一个穿着婚纱的火柴人,正拉着中间火柴人的右手,姿势温柔。
    > - 风格:明快的卡通风格,线条清晰、色彩饱满。背景保持简洁(可用浅色渐变或柔和几何图形),突出人物动态与互动。光影自然,氛围轻松幽默。

Refined Prompt (English)

Three match‑stick figures:

  • On the left, a female match‑stick wearing a purple dress, with a floating “greeting” icon (e.g., a smiling face or question mark) above her head, playfully vying for the microphone with the middle figure.
  • In the center, a neutral match‑stick holding the microphone, looking focused as they compete with the left figure.
  • On the right, a match‑stick in a wedding dress, gently holding the right hand of the middle figure.
    > - Style: bright, clean‑lined cartoon with vivid colors. Keep the background simple (soft gradient or light geometric pattern) to emphasize the characters’ poses and interactions. Natural lighting, a light‑hearted, humorous mood.

Optional Enhancements

  • Add a subtle spotlight on the microphone to emphasize the competition.
  • Include a light breeze effect on the female’s dress to convey movement.
  • Use a slightly warmer color palette to reinforce the joyous atmosphere.
    > Feel free to tweak any details (e.g., the exact greeting icon, background color, or additional props) to match your vision.