Image-Text-to-Text
Transformers
Safetensors
cohere2_vision
conversational
chat
8-bit precision
compressed-tensors
Instructions to use CohereLabs/command-a-plus-05-2026-w4a4 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use CohereLabs/command-a-plus-05-2026-w4a4 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="CohereLabs/command-a-plus-05-2026-w4a4") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# Load model directly from transformers import AutoProcessor, AutoModelForImageTextToText processor = AutoProcessor.from_pretrained("CohereLabs/command-a-plus-05-2026-w4a4") model = AutoModelForImageTextToText.from_pretrained("CohereLabs/command-a-plus-05-2026-w4a4") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] inputs = processor.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Inference
- HuggingChat
- Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use CohereLabs/command-a-plus-05-2026-w4a4 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "CohereLabs/command-a-plus-05-2026-w4a4" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "CohereLabs/command-a-plus-05-2026-w4a4", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker
docker model run hf.co/CohereLabs/command-a-plus-05-2026-w4a4
- SGLang
How to use CohereLabs/command-a-plus-05-2026-w4a4 with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "CohereLabs/command-a-plus-05-2026-w4a4" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "CohereLabs/command-a-plus-05-2026-w4a4", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "CohereLabs/command-a-plus-05-2026-w4a4" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "CohereLabs/command-a-plus-05-2026-w4a4", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }' - Docker Model Runner
How to use CohereLabs/command-a-plus-05-2026-w4a4 with Docker Model Runner:
docker model run hf.co/CohereLabs/command-a-plus-05-2026-w4a4
| {%- set reasoning = reasoning if reasoning is not undefined else (false if reasoning_effort is defined and reasoning_effort | lower == "none" else true) -%} | |
| {%- set grounding = grounding | default("disabled") | upper %} | |
| {%- set grounding_enabled = grounding == "ENABLED" %} | |
| {%- set tools_or_docs_exist = tools or documents %} | |
| {%- set render_tools_section = true %} | |
| {%- set render_grounding = grounding_enabled and tools_or_docs_exist %} | |
| {%- set render_platform_instruction_override = true if platform_instruction_override else false %} | |
| {%- set has_developer_instruction = developer_instruction or developer_instruction == "" %} | |
| {%- set render_developer_instruction = true if developer_instruction else false %} | |
| {%- set convert_first_system_msg = convert_first_system_msg | default(true) -%} | |
| {%- set skip_thinking = skip_thinking | default(false) -%} | |
| {{ bos_token }} | |
| {%- macro document_turn(documents) -%} | |
| {# format documents into chat turn -#} | |
| <|START_OF_TURN_TOKEN|><|CHATBOT_TOKEN|>{%- if not skip_thinking -%}<|START_THINKING|>I will look through the document to address the users needs.<|END_THINKING|>{%- endif -%}<|START_ACTION|>[ | |
| {"tool_call_id": "0", "tool_name": "direct-injected-document", "parameters": {}} | |
| ]<|END_ACTION|><|END_OF_TURN_TOKEN|><|START_OF_TURN_TOKEN|><|SYSTEM_TOKEN|><|START_TOOL_RESULT|>[ | |
| { | |
| "tool_call_id": "0", | |
| "results": { | |
| {%- for doc in documents %} | |
| {%- set doc_val = doc.data if doc.data else doc %} | |
| "{{ loop.index0 }}": {{ doc_val|tojson }}{% if not loop.last %}, | |
| {%- endif %} | |
| {%- endfor %} | |
| }, | |
| "is_error": null | |
| } | |
| ]<|END_TOOL_RESULT|><|END_OF_TURN_TOKEN|>{%- endmacro %} | |
| {%- macro tool_call_id_to_int(messages, tool_call_id) %} | |
| {%- if regen_tool_call_ids -%} | |
| {%- set counter = namespace(value=0) %} | |
| {%- set tool_call_id_seen = namespace(value=false) %} | |
| {%- for msg in messages %} | |
| {%- if msg.tool_calls %} | |
| {%- for tool_call in msg.tool_calls %} | |
| {%- if tool_call.id == tool_call_id and not tool_call_id_seen.value -%} | |
| {{ counter.value }} | |
| {%- set tool_call_id_seen.value = true %} | |
| {%- endif %} | |
| {%- set counter.value = counter.value + 1 %} | |
| {%- endfor %} | |
| {%- endif %} | |
| {%- endfor %} | |
| {%- else -%} | |
| {{ tool_call_id }} | |
| {%- endif -%} | |
| {%- endmacro %} | |
| {%- macro format_tool_message(messages, tool_msg) -%} | |
| {#- format tool message #}{ | |
| "tool_call_id": "{{ tool_call_id_to_int(messages, tool_msg.tool_call_id) }}", | |
| "results": { | |
| {%- if tool_msg.content is mapping or tool_msg.content is string %} | |
| {% if tool_msg.content is string -%} | |
| {%- set text_wrapper = {"content": tool_msg.content} -%} | |
| {%- else -%} | |
| {%- set text_wrapper = tool_msg.content -%} | |
| {%- endif %} | |
| "0": {{ text_wrapper|tojson }} | |
| {%- else %} | |
| {%- for content in tool_msg.content %} | |
| "{{ loop.index0 }}": {{ print_tool_content(content) }}{% if not loop.last %},{% endif %} | |
| {%- endfor %} | |
| {%- endif %} | |
| }, | |
| "is_error": null | |
| } | |
| {%- endmacro -%} | |
| {%- macro print_tool_content(item) %} | |
| {%- if item.type|lower == "text" -%} | |
| {%- set text_wrapper = {"content": item.text} -%} | |
| {{ text_wrapper|tojson }} | |
| {%- elif item.type|lower == "document" and item.document and "data" in item.document -%} | |
| {{ item.document.data|tojson }} | |
| {%- else -%} | |
| {{ item|tojson }} | |
| {%- endif -%} | |
| {%- endmacro %} | |
| {%- macro print_msg(msg) %} | |
| {%- if msg is string -%} | |
| <|START_TEXT|>{{ msg }}<|END_TEXT|> | |
| {%- elif msg.content is string -%} | |
| <|START_TEXT|>{{ msg.content }}<|END_TEXT|> | |
| {%- else %} | |
| {%- set last_was_text = namespace(value=false) %} | |
| {%- for content in msg.content %} | |
| {%- if content.type|lower == "text" -%} | |
| {%- if not last_was_text.value -%} | |
| <|START_TEXT|> | |
| {%- endif -%} | |
| {{ content.text }} | |
| {%- if loop.last -%} | |
| <|END_TEXT|> | |
| {%- endif %} | |
| {%- set last_was_text.value = true -%} | |
| {%- else -%} | |
| {%- if last_was_text.value -%} | |
| <|END_TEXT|> | |
| {%- endif -%} | |
| {%- set last_was_text.value = false -%} | |
| {%- endif -%} | |
| {%- if content.type|lower == "image" -%} | |
| {%- if content.data -%} | |
| {{ content.data }} | |
| {%- else -%} | |
| <|IMG_PATCH|> | |
| {%- endif -%} | |
| {%- endif -%} | |
| {%- endfor %} | |
| {%- endif %} | |
| {%- endmacro %} | |
| {%- macro print_thinking(msg) %} | |
| {%- if msg.thinking -%} | |
| {{ msg.thinking }} | |
| {%- elif msg.content and msg.content[0].thinking -%} | |
| {{ msg.content[0].thinking }} | |
| {%- endif %} | |
| {%- endmacro %} | |
| {%- if messages and messages[0]['role']|lower == 'system' and not has_developer_instruction and convert_first_system_msg %}{%- set developer_instruction = messages[0] %}{%- set render_developer_instruction = true %}{%- set initial_instruction_message = true %}{% endif %} | |
| {%- set json_object = true if response_format and response_format.type == "json_object" else false %} | |
| {%- set json_schema = (response_format.json_schema or response_format.schema) if response_format %} | |
| {%- set json_mode = json_object or json_schema %} | |
| {%- set tool_idx = namespace(value=0) %} | |
| {%- set tool_ids_seen = namespace(value=[]) %} | |
| {%- set regen_tool_call_ids = regen_tool_call_ids | default(true) -%} | |
| {%- set sent_documents = namespace(value=false) -%} | |
| {%- if render_tools_section or render_platform_instruction_override or render_grounding or json_mode -%} | |
| <|START_OF_TURN_TOKEN|><|SYSTEM_TOKEN|><|START_TEXT|> | |
| {%- elif not render_developer_instruction -%} | |
| <|START_OF_TURN_TOKEN|><|SYSTEM_TOKEN|> | |
| {%- endif %} | |
| {%- set rendered_platform_turn_chunk = false %} | |
| {%- if render_platform_instruction_override -%} | |
| {{ platform_instruction_override }} | |
| {% set rendered_platform_turn_chunk = true %} | |
| {%- else %} | |
| {%- endif %} | |
| {%- if render_grounding -%} | |
| {%- if rendered_platform_turn_chunk %} | |
| {% endif -%} | |
| Note that both your responses and reflections can be grounded. Grounding means you associate pieces of texts (called "spans") with those specific tool results that support them (called "sources"). And you use a pair of tags "<co>" and "</co>" to indicate when a span can be grounded onto a list of sources, listing them out in the closing tag. Sources from the same tool call are grouped together and listed as "{tool_call_id}:[{list of result indices}]", before they are joined together by ",". E.g., "<co>span</co: 0:[1,2],1:[0]>" means that "span" is supported by result 1 and 2 from "tool_call_id=0" as well as result 0 from "tool_call_id=1". | |
| {% set rendered_platform_turn_chunk = true %} | |
| {%- endif %} | |
| {%- if render_tools_section %} | |
| {%- if rendered_platform_turn_chunk %} | |
| {% endif %} | |
| # Available Tools | |
| ```json | |
| [ | |
| {% if tools_or_docs_exist %} | |
| {%- if documents %} | |
| {"name": "direct-injected-document", "description": "This is a special tool to directly inject user-uploaded documents into the chat as additional context. DO NOT use this tool by yourself!", "parameters": {"type": "object", "properties": {}, "required": []}, "responses": {"200": {"description": "Successfully returned a list of chunked text snippets from the directly uploaded documents.", "content": {"application/json": {"schema": {"type": "array", "items": {"type": "object", "required": ["url", "snippet"], "properties": {"url": {"type": "string", "description": "The url of the uploaded document."}, "snippet": {"type": "string", "description": "The text snippet for the returned document chunk."}}}}}}}}} | |
| {%- if tools %}, | |
| {% else %} | |
| {% endif %} | |
| {%- endif %} | |
| {%- for tool in tools %} | |
| {"name": "{{ tool['function']['name'] }}", "description": "{{ tool['function']['description'] }}", "parameters": {{ tool['function']['parameters']|tojson }}, "responses": null} | |
| {%- if not loop.last %},{% endif %} | |
| {% endfor %} | |
| {%- else %} | |
| {% endif %} | |
| ] | |
| ``` | |
| {%- set rendered_platform_turn_chunk = true %} | |
| {%- endif -%} | |
| {%- if json_mode -%} | |
| {%- if rendered_platform_turn_chunk %} | |
| {% endif -%} | |
| When generating JSON objects, do not generate block markers. Generate an object directly without prefixing with ```json. Return only the JSON and nothing else. | |
| {%- if json_schema %} | |
| Your output should adhere to the following json schema: | |
| {{ json_schema }} | |
| {%- endif -%} | |
| {%- set rendered_platform_turn_chunk = true %} | |
| {%- endif %} | |
| {%- if rendered_platform_turn_chunk -%} | |
| <|END_TEXT|><|END_OF_TURN_TOKEN|> | |
| {%- elif not render_developer_instruction -%} | |
| <|END_OF_TURN_TOKEN|> | |
| {%- endif %} | |
| {%- if render_developer_instruction -%} | |
| <|START_OF_TURN_TOKEN|><|SYSTEM_TOKEN|>{{ print_msg(developer_instruction) }}<|END_OF_TURN_TOKEN|> | |
| {%- endif %} | |
| {%- for message in messages %} | |
| {%- set msg_role_downcased = message.role | lower %} | |
| {%- if msg_role_downcased == 'system' and (not (loop.first and initial_instruction_message)) -%} | |
| <|START_OF_TURN_TOKEN|><|SYSTEM_TOKEN|>{{ print_msg(message) }}<|END_OF_TURN_TOKEN|> | |
| {%- elif msg_role_downcased == 'user' -%} | |
| <|START_OF_TURN_TOKEN|><|USER_TOKEN|>{{ print_msg(message) }}<|END_OF_TURN_TOKEN|> | |
| {%- if documents and not sent_documents.value %}{%- set sent_documents.value = true %}{% set tool_idx.value = tool_idx.value + 1 %}{{ document_turn(documents) }}{% endif %} | |
| {%- elif msg_role_downcased == 'assistant' or msg_role_downcased == 'chatbot' -%} | |
| <|START_OF_TURN_TOKEN|><|CHATBOT_TOKEN|> | |
| {%- if message.tool_calls %} | |
| {% if not skip_thinking %} | |
| {% if message.tool_plan -%} | |
| <|START_THINKING|>{{ message.tool_plan }}<|END_THINKING|> | |
| {%- elif message.thinking or (message.content and message.content[0].type == "thinking") -%} | |
| <|START_THINKING|>{{ print_thinking(message) }}<|END_THINKING|> | |
| {%- endif %} | |
| {%- endif %}<|START_ACTION|>[ | |
| {%- for tc in message.tool_calls %} | |
| {"tool_call_id": "{%- if regen_tool_call_ids -%}{{ tool_idx.value }}{%- else -%}{{ tc.id }}{%- endif -%}", "tool_name": "{{ tc['function']['name'] }}", "parameters": {{ tc['function']['arguments']|tojson }}}{% if not loop.last %},{% endif %} | |
| {%- set tool_idx.value = tool_idx.value + 1 %} | |
| {%- endfor %} | |
| ]<|END_ACTION|><|END_OF_TURN_TOKEN|> | |
| {%- else -%} | |
| {% if (message.thinking or (message.content and message.content[0].type == "thinking")) and not skip_thinking -%} | |
| <|START_THINKING|>{{ print_thinking(message) }}<|END_THINKING|> | |
| {%- endif -%} | |
| {{ print_msg(message) }}<|END_OF_TURN_TOKEN|> | |
| {%- endif %} | |
| {%- elif msg_role_downcased == 'tool' and message.tool_call_id not in tool_ids_seen.value -%} | |
| <|START_OF_TURN_TOKEN|><|SYSTEM_TOKEN|><|START_TOOL_RESULT|>[ | |
| {{ format_tool_message(messages, message) }} | |
| {%- for msg in messages[loop.index0 + 1:] %} | |
| {%- if msg.role | lower == 'tool' %}, | |
| {{ format_tool_message(messages, msg) }} | |
| {%- set tool_ids_seen.value = tool_ids_seen.value + [msg.tool_call_id] %} | |
| {%- else %} | |
| {%- break %} | |
| {%- endif %} | |
| {%- endfor %} | |
| ]<|END_TOOL_RESULT|><|END_OF_TURN_TOKEN|> | |
| {%- endif %} | |
| {%- endfor %}{%- if add_generation_prompt -%}<|START_OF_TURN_TOKEN|><|CHATBOT_TOKEN|>{% if reasoning %}<|START_THINKING|>{% else %}<|START_THINKING|><|END_THINKING|>{% endif %}{%- endif %} | |