---
url: 'https://docs.byesu.com/en/clients/autogen.md'
description: >-
  Connect Microsoft AutoGen v0.4 & AG2 to byesu API: OpenAIChatCompletionClient
  with custom model_info fix for Claude 5.5, GPT-6.2, and DeepSeek V4 teams.
---

# Connect Microsoft AutoGen (v0.4) & AG2 to byesu API

> **Key facts**: In modern **AutoGen v0.4** (`autogen-agentchat` + `autogen-ext[openai]`), set `base_url="https://byesu.com/v1"` on `OpenAIChatCompletionClient` and pass an explicit **`model_info`** dictionary so non-OpenAI IDs like `claude-opus-5-5` and `deepseek-v4-pro` never raise `ValueError: model_info is required`. Classic **AG2** (`llm_config`) works over the exact same `/v1` endpoint and **`auto`** group key.

The **AutoGen** ecosystem spans two widely deployed Python APIs: Microsoft's async, event-driven **AutoGen v0.4+** (`autogen-agentchat`) and classic **`llm_config`-based AG2** (`ag2` / v0.2). Connecting either stack to **[byesu](https://byesu.com)** lets multi-agent teams pair `claude-opus-5-5`, `gpt-6.2-sol`, `gemini-4-argon`, and `deepseek-v4-pro` under one pay-as-you-go API key.

::: tip Quick configuration

* **OpenAI-compatible `base_url`**: `https://byesu.com/v1` *(covers all vendors via `OpenAIChatCompletionClient` or `llm_config`)*
* **Anthropic-native `base_url`**: `https://byesu.com` *(no `/v1`, for `autogen-ext[anthropic]` + `0.1x` cache reads)*
* **API Key**: `BYESU_API_KEY="sk-..."` in the default **`auto`** group ([Sign up & get key](https://byesu.com/register))
  :::

## Option 1: Modern AutoGen v0.4 (`autogen-agentchat` + `model_info` Fix)

Install the official v0.4 packages:

```bash
pip install "autogen-agentchat" "autogen-ext[openai]"
export BYESU_API_KEY="sk-your-byesu-token"
```

### Why `ValueError: model_info is required` Happens — and How to Fix It

`OpenAIChatCompletionClient` validates `model` against a built-in table of legacy OpenAI model names. Whenever you pass a non-OpenAI identifier (`claude-opus-5-5`, `deepseek-v4-pro`, `gemini-4-argon`) or a newer generation (`gpt-6.2-sol`), AutoGen throws:

```text
ValueError: model_info is required when model name is not a valid OpenAI model
```

Passing an explicit `model_info` dictionary resolves this cleanly and tells AutoGen's runtime which capabilities (`vision`, `function_calling`, `json_output`, `structured_output`) each agent supports:

```python
import asyncio
import os
from autogen_agentchat.agents import AssistantAgent
from autogen_agentchat.conditions import MaxMessageTermination
from autogen_agentchat.teams import RoundRobinGroupChat
from autogen_ext.models.openai import OpenAIChatCompletionClient

BYESU_KEY = os.environ["BYESU_API_KEY"]
BYESU_V1 = "https://byesu.com/v1"

# Multimodal + tool-capable model_info (Claude 5.5, GPT-6.2, Gemini 4 Argon)
MULTIMODAL_TOOL_INFO = {
    "vision": True,
    "function_calling": True,
    "json_output": True,
    "family": "unknown",
    "structured_output": True,
}

# Text-only + tool-capable model_info (DeepSeek V4 Pro)
TEXT_TOOL_INFO = {
    "vision": False,
    "function_calling": True,
    "json_output": True,
    "family": "unknown",
    "structured_output": True,
}


async def main() -> None:
    architect_client = OpenAIChatCompletionClient(
        model="claude-opus-5-5",
        api_key=BYESU_KEY,
        base_url=BYESU_V1,
        model_info=MULTIMODAL_TOOL_INFO,
        timeout=150.0,
    )

    verifier_client = OpenAIChatCompletionClient(
        model="deepseek-v4-pro",
        api_key=BYESU_KEY,
        base_url=BYESU_V1,
        model_info=TEXT_TOOL_INFO,
        timeout=120.0,
    )

    architect = AssistantAgent(
        name="architect",
        model_client=architect_client,
        system_message="Propose a concise PostgreSQL advisory-lock migration runner in Python.",
    )
    verifier = AssistantAgent(
        name="verifier",
        model_client=verifier_client,
        system_message="Check connection-pool session affinity pitfalls in PgBouncer transaction mode.",
    )

    team = RoundRobinGroupChat(
        [architect, verifier],
        termination_condition=MaxMessageTermination(max_messages=3),
    )
    result = await team.run(task="Design a zero-race schema migration lock for 8 replicas.")
    for msg in result.messages:
        print(f"[{msg.source}]: {msg.content}\n")

    await architect_client.close()
    await verifier_client.close()


asyncio.run(main())
```

### Optional: Native Anthropic Client (`0.1x` Prompt Caching)

If your AutoGen v0.4 team relies heavily on Claude 5.5 with large shared system prompts, `autogen-ext[anthropic]` speaks native `/v1/messages` to `https://byesu.com` (**without `/v1`**), preserving `0.1x` cache-read billing ([Prompt Caching guide](/en/guide/prompt-caching)):

```python
import os
from autogen_ext.models.anthropic import AnthropicChatCompletionClient

claude_native = AnthropicChatCompletionClient(
    model="claude-sonnet-5-5",
    api_key=os.environ["BYESU_API_KEY"],
    base_url="https://byesu.com",  # NO /v1 suffix
    model_info=MULTIMODAL_TOOL_INFO,
)
```

## Option 2: Classic AutoGen v0.2 / AG2 (`llm_config` Compatibility)

Maintaining an existing **AG2** (`pip install "ag2[openai]"`) codebase? Pass `base_url: "https://byesu.com/v1"` inside `config_list`:

```python
import os
from autogen import AssistantAgent, UserProxyAgent

config_list = [
    {
        "model": "claude-sonnet-5-5",
        "api_key": os.environ["BYESU_API_KEY"],
        "base_url": "https://byesu.com/v1",
    },
    {
        "model": "gpt-6.1-sol",
        "api_key": os.environ["BYESU_API_KEY"],
        "base_url": "https://byesu.com/v1",
    },
]

llm_config = {
    "config_list": config_list,
    "timeout": 150,
}

assistant = AssistantAgent("coder", llm_config=llm_config)
user_proxy = UserProxyAgent("user", code_execution_config=False, human_input_mode="NEVER")
user_proxy.initiate_chat(assistant, message="Write an exponential backoff decorator with full jitter.", max_turns=1)
```

## Production Best Practices

* **Omit fixed `temperature` on Claude 5.5 and GPT-6.2**: Do not add `"temperature": 0` to `llm_config` or `OpenAIChatCompletionClient` when calling `claude-opus-5-5`, `claude-sonnet-5-5`, or `gpt-6.2-sol` — fixed sampling parameters trigger HTTP `400` ([Claude 400 temperature fix](/en/errors/claude-api-400-temperature-top-p-not-supported), [OpenAI `max_tokens` fix](/en/errors/openai-unsupported-parameter-max-tokens)).
* **Set `vision: False` for text-only models**: Keeping `"vision": False` on `deepseek-v4-pro` prevents AutoGen multimodal message adapters from sending raw image blocks to text-only endpoints.
* **Timeouts & billing**: Set `timeout >= 120`–`150`s based on real p95 data in the **[December 2026 Production Latency & Uptime Report](/en/articles/llm-api-latency-uptime-december-2026)**. Usage bills pay-as-you-go per token in the [byesu Console](https://byesu.com) with live rates shown after sign-in; compare snippets in the **[Config Generator](/en/tools/config-generator)** or see **[CrewAI Setup](/en/clients/crewai)** and **[LangChain Setup](/en/clients/langchain)**.

## FAQ

### How do I fix `ValueError: model_info is required` in AutoGen v0.4?

Pass `model_info={"vision": True, "function_calling": True, "json_output": True, "family": "unknown", "structured_output": True}` (or `"vision": False` for text-only models) to `OpenAIChatCompletionClient`.

### Does AutoGen v0.4 work with Claude, GPT-6.2, Gemini, and DeepSeek on one byesu key?

Yes. All default **`auto`** group models work over `base_url="https://byesu.com/v1"` using a single `BYESU_API_KEY` ([Choosing a Group](/en/guide/groups)).

### Can classic AutoGen v0.2 / AG2 `llm_config` connect to byesu API?

Yes. Add `"base_url": "https://byesu.com/v1"` and `"api_key": os.environ["BYESU_API_KEY"]` to each item in `config_list`.

### Can AutoGen v0.4 also call byesu's native Anthropic `/v1/messages` endpoint?

Yes. Use `AnthropicChatCompletionClient` from `autogen-ext[anthropic]` with `base_url="https://byesu.com"` (**without `/v1`**).

## Related Guides & Tools

* [Connect CrewAI to byesu API](/en/clients/crewai)
* [Connect LangChain & LangGraph to byesu API](/en/clients/langchain)
* [Connect OpenAI Agents SDK to byesu API](/en/clients/openai-agents-sdk)
* [AI Client & SDK Config Generator](/en/tools/config-generator)
* [December 2026 LLM API Latency & Uptime Report](/en/articles/llm-api-latency-uptime-december-2026)
