0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Claude CodeをLiteLLM経由でローカルLLM(Ollama / DGX Spark)に接続して動かす方法【Podman】

0
Last updated at Posted at 2026-08-22

windowsPCにClaudCodeをインストールして、ローカルLLMに繋げたいと思います。

1. まずDGX Spark等のローカルLLMを用意します

ウチはASUS Ascent GX10です
image.png

windows側から接続確認
DGX Sparkは基本的には127.0.0.1からしか繋がらないので、そこは開放する設定を調べてやってください
今回使うモデルはgemma4:e2bです(特に意図はないです)
image.png

2. Podmanを起動します

podman machine start
image.png

3. compose.yml をつくります

モデルは各自好きなのに書き換えてください
あとDGX Spark等のサーバのIP

compose.yml
services:
  litellm-gemma:
    image: ghcr.io/berriai/litellm:main-latest
    container_name: litellm_proxy_gemma
    ports:
      - "4001:4000"
    environment:
      - OPENAI_API_BASE=http://192.168.10.41:11434/v1
      - OPENAI_API_KEY=ollama
    command:
      - "--model"
      - "openai/gemma4:e2b"
      - "--host"
      - "0.0.0.0"
      - "--port"
      - "4000"
    extra_hosts:
      - "host.containers.internal:host-gateway"

  claude-agent-gemma:
    image: node:22-slim
    container_name: claude_code_agent_gemma
    stdin_open: true
    tty: true
    volumes:
      - ./workspace:/workspace
    working_dir: /workspace
    environment:
      - ANTHROPIC_BASE_URL=http://litellm-gemma:4000
      - ANTHROPIC_API_KEY=dummy
      - ANTHROPIC_AUTH_TOKEN=dummy
      - ANTHROPIC_MODEL=openai/gemma4:e2b
      - ANTHROPIC_DEFAULT_SONNET_MODEL=openai/gemma4:e2b
      - ANTHROPIC_DEFAULT_HAIKU_MODEL=openai/gemma4:e2b
      - ANTHROPIC_DEFAULT_OPUS_MODEL=openai/gemma4:e2b
      - ENV=/root/.bashrc
    command: >
      bash -c "
      echo 'alias bye=exit' >> /root/.bashrc &&
      apt-get update &&
      apt-get install -y curl git &&
      npm install -g @anthropic-ai/claude-code &&
      exec bash
      "
    depends_on:
      - litellm-gemma
    extra_hosts:
      - "host.containers.internal:host-gateway"

4. workspaceのフォルダを作ってからコンテナ起動します

image.png

podman compose up -d
image.png

podman logs -f claude_code_agent_gemma
ログ見て全部完了してる事を確認
image.png

5. エージェントのコンテナに入ります

podman exec -it claude_code_agent_gemma bash
image.png

5. claude code起動します

claude
image.png

API Keyの所だけは、「1. Yes」 に変更します
それ以外は全部エンター連打です
image.png

Claude Codeの画面がでました
image.png

「1+1は?」をしてみます
image.png

GX10側のollamaもログがでてるので、ちゃんと繋ってますね
image.png

以上です

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?