Ollama API
The AI Pod comes pre-deployed with Ollama, allowing applications within the LCMD to directly use the exposed Ollama API.
ollamaendpoint is at:ollamacompatible withOpenAI APIendpoint is at:
If you have the LCMD client installed locally, you can use the above endpoints to call the service from your local applications. For example, you can directly use curl to access the endpoint.
sh
curl https://ollama-ai.${微服名称}.heiyu.space/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{"model": "qwen3:4b", "messages": [{"role": "user", "content": "Hello!"}]}'The AI Pod's ollama port is also exposed on the local network. Access http://算力舱ip:11434 to use the ollama service. You can find the AI Pod's local network IP address in the device list here.
Python example
python
import base64
import requests
import json
# 获取图片并进行 base64 编码
image_url = "https://i-blog.csdnimg.cn/direct/7184675ec6ad495e8b7469c17edd56d9.png"
try:
response = requests.get(image_url)
response.raise_for_status() # 检查请求是否成功
image_data = response.content
encoded_image = base64.b64encode(image_data).decode('utf-8')
except requests.exceptions.RequestException as e:
print(f"Error downloading image: {e}")
exit(1)
# 构建请求的 JSON 数据
request_data = {
"model": "qwen3-vl:2b-instruct",
"messages": [
{
"role": "user",
"content": [
{
"type": "text",
"text": "提取文字为 Markdown 格式,要求格式正确。"
},
{
"type": "image_url",
"image_url": {
"url": f"data:image/jpeg;base64,{encoded_image}"
}
}
]
}
]
}
ollama_api_url = "https://ollama-ai.${微服名称}.heiyu.space/v1/chat/completions"
headers = {
"Content-Type": "application/json"
}
try:
response = requests.post(ollama_api_url, headers=headers, data=json.dumps(request_data))
response.raise_for_status() # 检查请求是否成功
# 打印响应
print(response.json())
except requests.exceptions.RequestException as e:
print(f"Error sending request to Ollama API: {e}")