Claude Code的控制台客户端安装
npm install -g @anthropic-ai/claude-code
Ollama的安装,并拉取qwen3-vl:8B的模型
ollama pull qwen3-vl:8B
ollama作为service启动后,默认只开启在127.0.0.1端口上,需要修改服务配置达成到0.0.0.0
打开控制台,修改环境变量,而后启动claude
export ANTHROPIC_AUTH_TOKEN=ollama
export ANTHROPIC_BASE_URL=http://192.168.1.190:11434 //本地安装的ollama服务
claude
启动后,会和http服务器进行一次http交互,只是确认服务的存在。
进入控制台后选择模型
/model qwen3-vl:8B
----------HTTPRequest-----------
POST / v1 / messages ? beta = true HTTP / 1.1
host: localhost: 11434
connection: keep - alive
Accept: application / json
X - Stainless - Retry - Count: 0
X - Stainless - Timeout: 600
X - Stainless - Lang: js
X - Stainless - Package - Version: 0.81 .0
X - Stainless - OS: MacOS
X - Stainless - Arch: x64
X - Stainless - Runtime: node
X - Stainless - Runtime - Version: v22 .4 .1
anthropic - dangerous - direct - browser - access: true
anthropic - version: 2023 - 06 - 01
x - app: cli
User - Agent: claude - cli / 2.1 .110(external, cli)
X - Claude - Code - Session - Id: 745 a401e - a7a4 - 4 aba - 830e- b63bf409bedb
Authorization: Bearer ollama
content - type: application / json
anthropic - beta: claude - code - 20250219, interleaved - thinking - 2025 - 05 - 14, redact - thinking - 2026 - 02 - 12, context - management - 2025 - 06 - 27, prompt - caching - scope - 2026 - 01 - 05
accept - language: *
sec - fetch - mode: cors
accept - encoding: gzip, deflate
content - length: 533
{
"model": "qwen3-vl:8B",
"max_tokens": 1,
"system": [{
"type": "text",
"text": "x-anthropic-billing-header: cc_version=2.1.110.610; cc_entrypoint=cli; cch=00000;"
}, {
"type": "text",
"text": "You are Claude Code, Anthropic's official CLI for Claude."
}],
"messages": [{
"role": "user",
"content": [{
"type": "text",
"text": "Hi",
"cache_control": {
"type": "ephemeral"
}
}]
}],
"metadata": {
"user_id": "{\"device_id\":\"b1581fe7235e6eed0f44c26a8c26d7fc1c704ce894c977cb770f421cf7720923\",\"account_uuid\":\"\",\"session_id\":\"745a401e-a7a4-4aba-830e-b63bf409bedb\"}"
}
}
----------HTTPResponse-----------
HTTP / 1.1 200 OK
Content - Type: application / json
Date: Fri, 17 Apr 2026 07: 31: 04 GMT
Content - Length: 219
{
"id": "msg_c1a7f4c4be5ae8ca4843bd20",
"type": "message",
"role": "assistant",
"model": "qwen3-vl:8B",
"content": [{
"type": "thinking",
"thinking": "Okay"
}],
"stop_reason": "max_tokens",
"usage": {
"input_tokens": 67,
"output_tokens": 1
}
}
确认大模型端对qwen3-vl:8B的支持,此时也会该Session创建了唯一性的session编号。
提问: 创建文件index.html
两个HTTP交互见附件
- claude向qwen3-vl发起问题,提交<system-reminder>的提示词,模型指定命令<command-name>/model</command-name>,用户问题
{
"type": "text",
"text": "创建文件index.html",
"cache_control": {
"type": "ephemeral"
}
},通过tools":表达技能能力。qwen进行llm分析后,最终会回复tool use的调用
data: {
"type": "content_block_start",
"index": 0,
"content_block": {
"type": "tool_use",
"id": "call_ooye05av",
"name": "Write",
"input": {}
}
}
- 本地调用工具执行后,claude再次发起交互,汇报工具调用结果,
"content": [{
"tool_use_id": "call_ooye05av",
"type": "tool_result",
"content": "File created successfully at: /Users/xuxin/index.html",
"cache_control": {
"type": "ephemeral"
}
}] qwen返回结果描述以及后续建议。
如有部署疑问和私信沟通。也可浏览agent-llm概念文章。