> ## 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.

# Soporte para la Responses API de OpenAI

Compatible con la interfaz multifunción Responses API de OpenAI; se han lanzado las siguientes funciones:

* Entrada de texto: Entrada de texto
* Entrada de imagen: Entrada de imagen
* Streaming: Streaming
* Búsqueda web: Búsqueda web
* Investigación profunda: Para tareas complejas de análisis e investigación
* Razonamiento: Control de la profundidad del razonamiento; admite 4 niveles (minimal / low / medium / high). Solo la serie gpt-5 admite `minimal`.
* Verbosity: Longitud de la salida; la serie gpt-5 admite 3 niveles (low / medium / high)
* Functions: Funciones
* Uso de la herramienta image\_generation: El dibujo y la generación de imágenes se facturan en `gpt-image-1`.
* Code Interpreter: Permite a los modelos escribir y ejecutar Python para resolver problemas. reasoning.effort 'minimal' no se admite al usar code interpreter con gpt-5.
* MCP remoto: Llamada a un servidor MCP remoto
* Computer Use: Uso del ordenador

## Uso (llamada en Python):

Igual que el método oficial de llamada de OpenAI; solo tienes que reemplazar `api_key` y `base_url` para el reenvío.
China continental puede acceder directamente.

```py theme={null}
client = OpenAI(
    api_key="AIHUBMIX_API_KEY", # Replace with the key you generated in AiHubMix
    base_url="https://aihubmix.com/v1"
)
```

<Tip>
  1. Para los modelos de inferencia, el resumen de razonamiento de salida puede controlarse con el siguiente parámetro; la riqueza del detalle del resumen sigue el orden detailed > auto > None, donde auto ofrece el mejor equilibrio.

  ```py theme={null}
  "summary": "auto"
  ```

  2. Modelos opcionales de razonamiento profundo: ⁠o3-deep-research⁠ y ⁠o4-mini-deep-research⁠, solo admitidos en el endpoint ⁠responses⁠.
  3. La serie gpt-5 se centra en un razonamiento estable y salidas consistentes, y ya no admite los parámetros `temperature` y `top_p` para controlar la aleatoriedad. Si necesitas más libertad, puedes probar `gpt-5-chat-latest`, que admite `temperature`.
  4. Los modelos de razonamiento (serie o / serie gpt-5) han descontinuado max\_tokens. Usa `max_completion_tokens` para completions o `max_output_tokens` para responses para establecer explícitamente el límite de tokens de salida.
</Tip>

<CodeGroup>
  ```py gpt-5 series theme={null}
  from openai import OpenAI

  client = OpenAI(
      api_key="sk-***", # Replace with the key generated in your AIHubMix dashboard
      base_url="https://aihubmix.com/v1"
  )

  response = client.responses.create(
      model="gpt-5", # gpt-5, gpt-5-chat-latest, gpt-5-mini, gpt-5-nano
      input="Why is tarot divination effective? What are the underlying principles and transferable methods? Output format: Markdown", # GPT-5 does not output in Markdown format by default, so you need to explicitly specify it.
      reasoning={
          "effort": "minimal" # Reasoning depth – Controls how many reasoning tokens the model generates before producing a response. Value can be "minimal", "low", "medium" or "high". Default is "medium".
      },
      text={
          "verbosity": "low" # Output length – Verbosity determines how many output tokens are generated. Value can be "low", "medium", or "high". Models before GPT-5 defaulted to "medium" verbosity.
      },
      stream=True
  )

  for event in response:
    print(event)
  ```

  ```py Text input theme={null}
  from openai import OpenAI

  client = OpenAI(
      api_key="AIHUBMIX_API_KEY", # Your Key "sk-***"
      base_url="https://aihubmix.com/v1"
  )

  response = client.responses.create(
    model="gpt-4o-mini", # codex-mini-latest AVAILABLE
    input="Tell me a three sentence bedtime story about a unicorn."
  )

  print(response)
  ```

  ```py Image input theme={null}
  from openai import OpenAI

  client = OpenAI(
      api_key="AIHUBMIX_API_KEY", # Your Key "sk-***"
      base_url="https://aihubmix.com/v1"
  )

  response = client.responses.create(
      model="gpt-4o-mini", # codex-mini-latest AVAILABLE
      input=[
          {
              "role": "user",
              "content": [
                  { "type": "input_text", "text": "what is in this image?" },
                  {
                      "type": "input_image",
                      "image_url": "https://upload.wikimedia.org/wikipedia/commons/thumb/d/dd/Gfp-wisconsin-madison-the-nature-boardwalk.jpg/2560px-Gfp-wisconsin-madison-the-nature-boardwalk.jpg"
                  }
              ]
          }
      ]
  )

  print(response)
  ```

  ```py Streaming theme={null}
  from openai import OpenAI

  client = OpenAI(
      api_key="AIHUBMIX_API_KEY", # Your Key "sk-***"
      base_url="https://aihubmix.com/v1"
  )

  response = client.responses.create(
    model="gpt-4o-mini", # codex-mini-latest AVAILABLE
    instructions="You are a helpful assistant.",
    input="Hello!",
    stream=True
  )

  for event in response:
    print(event)
  ```

  ```py Web search theme={null}
  from openai import OpenAI

  client = OpenAI(
      api_key="AIHUBMIX_API_KEY", # Your Key "sk-***"
      base_url="https://aihubmix.com/v1"
  )

  response = client.responses.create(
    model="gpt-4o-mini",
    tools=[{ "type": "web_search_preview" }],
    input="What was a positive news story from today?",
  )

  print(response)
  ```

  ```py Deep Research theme={null}
  from openai import OpenAI

  client = OpenAI(
      api_key="AIHUBMIX_API_KEY", # Your Key "sk-***"
      base_url="https://aihubmix.com/v1",
      timeout=3600
  )

  input_text = """
  Research the economic impact of semaglutide on global healthcare systems.
  Do:
  - Include specific figures, trends, statistics, and measurable outcomes.
  - Prioritize reliable, up-to-date sources: peer-reviewed research, health
    organizations (e.g., WHO, CDC), regulatory agencies, or pharmaceutical
    earnings reports.
  - Include inline citations and return all source metadata.

  Be analytical, avoid generalities, and ensure that each section supports
  data-backed reasoning that could inform healthcare policy or financial modeling.
  """

  response = client.responses.create(
    model="o3-deep-research", # o4-mini-deep-research
    input=input_text,
    tools=[
      {"type": "web_search_preview"},
      {"type": "code_interpreter", "container": {"type": "auto"}},
    ],
  )

  print(response.output_text)
  ```

  ```py Reasoning theme={null}
  from openai import OpenAI

  client = OpenAI(
      api_key="AIHUBMIX_API_KEY", # Your Key "sk-***"
      base_url="https://aihubmix.com/v1/"
  )

  response = client.responses.create(
      model="o4-mini", # codex-mini-latest, o4-mini, o3-mini, o3, o1
      input="How much wood would a woodchuck chuck?",
      reasoning={
          "effort": "medium", # low, medium, high
          "summary": "auto", # resoning summary
      }
  )

  print(response)
  ```

  ```py Functions theme={null}
  from openai import OpenAI

  client = OpenAI(
      api_key="AIHUBMIX_API_KEY", # Your Key "sk-***"
      base_url="https://aihubmix.com/v1"
  )

  tools = [
      {
          "type": "function",
          "name": "get_current_weather",
          "description": "Get the current weather in a given location",
          "parameters": {
            "type": "object",
            "properties": {
                "location": {
                    "type": "string",
                    "description": "The city and state, e.g. San Francisco, CA",
                },
                "unit": {"type": "string", "enum": ["celsius", "fahrenheit"]},
            },
            "required": ["location", "unit"],
          }
      }
  ]

  response = client.responses.create(
    model="gpt-4o-mini", # codex-mini-latest AVAILABLE
    tools=tools,
    input="What is the weather like in Boston today?",
    tool_choice="auto"
  )

  print(response)
  ```

  ```py Image Generation Tool theme={null}
  from openai import OpenAI
  import base64

  client = OpenAI(
      api_key="AIHUBMIX_API_KEY", # Your Key "sk-***"
      base_url="https://aihubmix.com/v1"
  )

  response = client.responses.create(
      model="gpt-4.1-mini",
      input="Generate an image of gray tabby cat hugging an otter with an orange scarf",
      tools=[
          {
              "type": "image_generation",
              "background": "opaque", 
              "quality": "high",
          }
      ],
  )

  # Save the image to a file
  image_data = [
      output.result
      for output in response.output
      if output.type == "image_generation_call"
  ]

  if image_data:
      image_base64 = image_data[0]
      with open("cat_and_otter.png", "wb") as f:
          f.write(base64.b64decode(image_base64))
  ```

  ```py Code Interpreter theme={null}
  from openai import OpenAI

  client = OpenAI(
      api_key="AIHUBMIX_API_KEY", # Your Key "sk-***"
      base_url="https://aihubmix.com/v1"
  )

  instructions = """
  You are a personal math tutor. When asked a math question, 
  write and run code using the python tool to answer the question.
  """

  resp = client.responses.create(
      model="gpt-4.1",
      tools=[
          {
              "type": "code_interpreter",
              "container": {"type": "auto"}
          }
      ],
      instructions=instructions,
      input="I need to solve the equation 3x + 11 = 14. Can you help me?",
  )

  print(resp.output)
  ```

  ```py Remote MCP theme={null}
  from openai import OpenAI

  client = OpenAI(
      api_key="AIHUBMIX_API_KEY", # Your Key "sk-***"
      base_url="https://aihubmix.com/v1"
  )

  resp = client.responses.create(
      model="gpt-4.1",
      tools=[{
          "type": "mcp",
          "server_label": "deepwiki",
          "server_url": "https://mcp.deepwiki.com/mcp",
          "require_approval": "never",
          "allowed_tools": ["ask_question"],
      }],
      input="What transport protocols does the 2025-03-26 version of the MCP spec (modelcontextprotocol/modelcontextprotocol) support?",
  )

  print(resp.output_text)
  ```
</CodeGroup>

**Nota:**

1. El más reciente `codex-mini-latest` **no** admite búsqueda.
2. La función **Computer use** requiere integración con **Playwright**. Se recomienda consultar el [repositorio oficial](https://github.com/openai/openai-cua-sample-app).

Problemas conocidos:

* Los casos de uso son complejos de invocar
* Realiza muchas capturas de pantalla, lo que consume tiempo y suele ser poco fiable
* Puede activar CAPTCHA o la verificación humana de Cloudflare, lo que puede llevar a bucles infinitos

***

Última actualización: 2026-06-01
