🌐

「gpt-oss」発表内容まとめと使い方。OpenAIのオープンウェイトモデル

に公開

2025年8月5日、ついにOpenAIから誰でも自由に利用・改変できるオープンウェイトモデル「gpt-oss」が発表されました。

gpt-ossとは?

gpt-ossは、OpenAIが開発した、オープンウェイトの大規模言語モデル(LLM)です。開発者はこれらのモデルを自由にダウンロードし、特定のユースケースに合わせてカスタマイズしたり、商用利用したりすることが可能です。
公開されたモデルは以下の2つです。

gpt-oss-120b

1170億パラメータを持つ大規模モデル。60GB以上のVRAMが最適で、マルチGPUや強力なワークステーションでの利用に適しています。

gpt-oss-20b

210億パラメータを持つ中規模モデル。16GB以上のVRAMで快適に動作し、ハイエンドのコンシューマーGPUやApple Silicon Macに適しています。

gpt-ossの特徴

特徴1:寛容なライセンス

Apache 2.0ライセンスで提供されており、研究、実験、カスタマイズ、そして商用展開まで、非常に幅広い用途で自由に利用できます。

特徴2:エージェントタスク向けの設計

Web検索やPythonコードの実行といった、複数のステップを要する複雑なタスク(思考の連鎖)をこなす能力に長けています。強力な指示追従能力とツール使用能力が特徴です。

特徴3:高度なカスタマイズ性

推論の労力(計算量)を低・中・高で調整したり、フルパラメータのファインチューニングで特定の用途に特化させたりと、高度なカスタマイズが可能です。

特徴4:完全な思考連鎖へのアクセス

モデルが最終的な回答を出すまでの思考プロセス全体にアクセスできます。これにより、デバッグが容易になり、なぜその出力に至ったのかを理解できるため、信頼性が向上します。

ブラウザでお試し

gpt-ossはブラウザで試せる環境も用意されています。
https://www.gpt-oss.com/

ローカルでの実行方法

Ollamaを使ったローカル実行

ローカル環境で手軽に試すにはOllamaが最も簡単です。

  1. Ollamaをインストール: 公式サイトからインストーラを入手します。
  2. モデルをプル: ターミナルで以下のコマンドを実行します。
    # 中規模モデルの場合
    ollama pull gpt-oss:20b
    
    # 大規模モデルの場合
    ollama pull gpt-oss:120b
    
  3. チャットを開始:
    ollama run gpt-oss:20b
    

API経由での利用

OllamaはOpenAI互換のAPIを公開しているため、既存のOpenAI SDKのコードを少し変更するだけで利用できます。
以下はPythonの例です。

from openai import OpenAI
 
client = OpenAI(
    base_url="http://localhost:11434/v1",  # Local Ollama API
    api_key="ollama"                       # Dummy key
)
 
response = client.chat.completions.create(
    model="gpt-oss:20b",
    messages=[
        {"role": "system", "content": "You are a helpful assistant."},
        {"role": "user", "content": "Explain what MXFP4 quantization is."}
    ]
)
 
print(response.choices[0].message.content)

関数呼び出し(ツール使用)

チャット補完を介して関数を呼び出す例

tools = [
    {
        "type": "function",
        "function": {
            "name": "get_weather",
            "description": "Get current weather in a given city",
            "parameters": {
                "type": "object",
                "properties": {"city": {"type": "string"}},
                "required": ["city"]
            },
        },
    }
]
 
response = client.chat.completions.create(
    model="gpt-oss:20b",
    messages=[{"role": "user", "content": "What's the weather in Berlin right now?"}],
    tools=tools
)
 
print(response.choices[0].message)

Agents SDKとの連携

OpenAIのAgents SDKと連携させることも可能です。Pythonの場合はLiteLLMを、TypeScriptの場合はAI SDKのOllamaアダプターを利用することで、ローカルモデルをエージェントとして動作させることができます。
以下は LiteLLM を使用した Python エージェント SDK の例です。

import asyncio
from agents import Agent, Runner, function_tool, set_tracing_disabled
from agents.extensions.models.litellm_model import LitellmModel
 
set_tracing_disabled(True)
 
@function_tool
def get_weather(city: str):
    print(f"[debug] getting weather for {city}")
    return f"The weather in {city} is sunny."
 
 
async def main(model: str, api_key: str):
    agent = Agent(
        name="Assistant",
        instructions="You only respond in haikus.",
        model=LitellmModel(model="ollama/gpt-oss:120b", api_key=api_key),
        tools=[get_weather],
    )
 
    result = await Runner.run(agent, "What's the weather in Tokyo?")
    print(result.final_output)
 
if __name__ == "__main__":
    asyncio.run(main())

料金

オープンソースモデルのため、モデル自体の利用は無料です。ただし、実行環境(コンピューティングリソース)のコストは別途必要になります。

参考文献

https://openai.com/open-models/
https://github.com/openai/gpt-oss
https://cookbook.openai.com/articles/gpt-oss/run-locally-ollama
https://ollama.com/download

Discussion