Saltar al contenido principal

Documentation Index

Fetch the complete documentation index at: https://docs.aihubmix.com/llms.txt

Use this file to discover all available pages before exploring further.

Serie Qwen 3

Qwen3 redefine los LLM abiertos con modos de razonamiento dinámicos y destaca en código, matemáticas y razonamiento multilingüe. Impulsado por 22B parámetros activos dispersos, equilibra una velocidad fulgurante con inteligencia profunda, totalmente de código abierto, desde modelos ligeros hasta gigantes de 235B. 1. Uso básico: Reenvía con formato compatible con OpenAI.
2. Llamada a herramientas: Las herramientas habituales admiten el formato compatible con OpenAI, mientras que las MCP Tools dependen de qwen-agent y requieren instalar primero las dependencias con el comando: pip install -U qwen-agent mcp. Para más detalles, consulta la documentación oficial de Ali
from openai import OpenAI

client = OpenAI(
    api_key="sk-***", # 🔑 Replace it by your AiHubMix Key
    base_url="https://aihubmix.com/v1",
)

completion = client.chat.completions.create(
    model="Qwen/Qwen3-30B-A3B",
    messages=[
        {
            "role": "user",
            "content": "Explain the Occam's Razor concept and provide everyday examples of it"
        }
    ],
    stream=True
)

for chunk in completion:
    if hasattr(chunk.choices, '__len__') and len(chunk.choices) > 0:
        if hasattr(chunk.choices[0].delta, 'content') and chunk.choices[0].delta.content is not None:
            print(chunk.choices[0].delta.content, end="")

Series Qwen 2.5 y QwQ/QvQ

Utiliza el formato compatible con OpenAI para reenviar; la diferencia es que la llamada en streaming necesita extraer chunk.choices[0].delta.content, consulta a continuación. 1. QvQ, Qwen 2.5 VL: Reconocimiento de imágenes.
2. QwQ: Tarea de texto.
from openai import OpenAI
import base64
import os

client = OpenAI(
    api_key="sk-***", # 🔑 Replace it by your AiHubMix Key
    base_url="https://aihubmix.com/v1",
)

image_path = "yourpath/file.png"

def encode_image(image_path):
    if not os.path.exists(image_path):
        raise FileNotFoundError(f"Image file does not exist: {image_path}")
    
    with open(image_path, "rb") as image_file:
        return base64.b64encode(image_file.read()).decode('utf-8')

# Get the base64 encoding of the image
base64_image = encode_image(image_path)

completion = client.chat.completions.create(
    model="qwen2.5-vl-72b-instruct", #qwen2.5-vl-72b-instruct OR Qwen/QVQ-72B-Preview
    messages=[
        {
            "role": "user",
            "content": [
                {"type": "text", "text": "Please describe this image in detail"},
                {
                    "type": "image_url",
                    "image_url": {
                        "url": f"data:image/png;base64,{base64_image}"
                    }
                }
            ]
        }
    ],
    stream=True
)

for chunk in completion:
    if hasattr(chunk.choices, '__len__') and len(chunk.choices) > 0:
        if hasattr(chunk.choices[0].delta, 'content') and chunk.choices[0].delta.content is not None:
            print(chunk.choices[0].delta.content, end="")

Última actualización: 2026-06-01