企業內架設落地 GPT-OSS-20B 模型

原來習慣使用meta llama 模型,後來OpenAI直接釋出Open Source的 gpt-oss-20B, 就開始改用它當落地模型。

公司內部主機 作法

curl --location 'http://xxxx:11434/api/chat' \

--header 'Content-Type: application/json' \

--header 'Accept: application/json' \

--data '{

"model": "gpt-oss:20b",

"messages": [

{"role": "system", "content": "你是一位專業助理,請用繁體中文回覆。"},

{"role": "user", "content": "用三點說明向量資料庫是什麼?"}

],

"stream": false,

"options": {

"temperature": 0.7,

"num_ctx": 8192

},

"keep_alive": "30m"

}'

OpenRouter 作法

curl --location 'https://openrouter.ai/api/v1/chat/completions' \

--header 'Content-Type: application/json' \

--header 'Authorization: Bearer sk-or-v1-xxxxxx' \

--data '

{

"model": "openai/gpt-oss-20b:free",

"messages": [

{"role": "system", "content": "你是一位專業助理,請用繁體中文回覆。"},

{"role": "user", "content": "用三點說明向量資料庫是什麼?"}

],

"stream": false,

"options": {

"temperature": 0.7,

"num_ctx": 8192

},

"keep_alive": "30m"

}'