Zum Hauptinhalt springen
Unterstützung der multifunktionalen OpenAI-Responses-API. Folgende Funktionen sind verfügbar:
  • Text input: Texteingabe
  • Image input: Bildeingabe
  • Streaming: Streaming
  • Web search: Websuche
  • Deep research: Für komplexe Analyse- und Recherche-Aufgaben
  • Reasoning: Reasoning-Tiefensteuerung, unterstützt 4 Stufen (minimal / low / medium / high). Nur die gpt-5-Serie unterstützt minimal.
  • Verbosity: Ausgabelänge, die gpt-5-Serie unterstützt 3 Stufen (low / medium / high)
  • Functions: Functions
  • Verwendung des image_generation-Tools: Bilderzeugung wird unter gpt-image-1 abgerechnet.
  • Code Interpreter: Erlaubt Modellen, Python zu schreiben und auszuführen, um Probleme zu lösen. reasoning.effort „minimal” wird zusammen mit dem Code Interpreter bei gpt-5 nicht unterstützt.
  • Remote MCP: Aufruf eines Remote-MCP-Servers
  • Computer Use: Computer Use

Verwendung (Python-Aufruf):

Identisch mit der offiziellen OpenAI-Aufrufmethode; ersetzen Sie lediglich api_key und base_url zum Forwarden. Festland China kann direkt zugreifen.
client = OpenAI(
    api_key="AIHUBMIX_API_KEY", # Replace with the key you generated in AiHubMix
    base_url="https://aihubmix.com/v1"
)
  1. Bei Reasoning-Modellen kann die Ausgabe-Reasoning-Zusammenfassung mit folgendem Parameter gesteuert werden; die Detailtiefe der Zusammenfassung folgt der Reihenfolge detailed > auto > None, wobei auto den besten Ausgleich bietet.
"summary": "auto"
  1. Optionale Deep-Reasoning-Modelle: ‎⁠o3-deep-research⁠ und ‎⁠o4-mini-deep-research⁠, nur am ‎⁠responses⁠-Endpoint unterstützt.
  2. Die gpt-5-Serie konzentriert sich auf stabiles Reasoning und konsistente Ausgaben und unterstützt die Parameter temperature und top_p zur Steuerung der Zufälligkeit nicht mehr. Wenn Sie mehr Spielraum benötigen, können Sie gpt-5-chat-latest ausprobieren, das temperature unterstützt.
  3. Reasoning-Modelle (o-Serie / gpt-5-Serie) haben max_tokens veraltet. Bitte verwenden Sie max_completion_tokens für Completions oder max_output_tokens für Responses, um das Output-Token-Limit explizit zu setzen.
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)
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)
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)
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)
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)
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)
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)
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)
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))
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)
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)
Hinweis:
  1. Das neueste codex-mini-latest unterstützt keine Suche.
  2. Das Feature Computer use erfordert die Integration mit Playwright. Es wird empfohlen, das offizielle Repository zu konsultieren.
Bekannte Probleme:
  • Anwendungsfälle sind komplex aufzurufen
  • Viele Screenshots werden benötigt, was zeitaufwändig und oft unzuverlässig ist
  • Kann CAPTCHA oder Cloudflare-Verifizierungen auslösen und so zu Endlosschleifen führen

Zuletzt aktualisiert: 2026-06-01