🧠 autogen-oaiapi
OpenAI-style Chat API server for AutoGen teams.
Deploy your own /v1/chat/completions endpoint using any AutoGen-compatible team configuration.
🚀 Try it? → Don’t forget to ⭐ the repo if useful!
A self-hosted, open-source alternative to OpenAI’s ChatCompletion API, built on top of Microsoft AutoGen.
🔍 Looking for:
- OpenAI-style API server you can run locally?
- An AutoGen-based ChatCompletion implementation?
- A FastAPI wrapper for multi-agent LLM orchestration?
You found it. 🚀
WARNING
NOW(autogen-agentchat == 0.5.5) limit supported.
Because of it has bug on deserialization
AssistantAgentwith tools.
✨ Features
- ✅ OpenAI-compatible API interface
- ✅ Plug in any AutoGen
GroupChatorSocietyOfMindAgent - ✅ Session-aware execution (per session_id)
- ✅ FastAPI-based server with
/v1/chat/completionsendpoint - ✅
stream=Trueresponse support (coming soon)
📦 Installation
pip install autogen-oaiapi
How to use?
Using just SIMPLE api!
example
client = OpenAIChatCompletionClient(
model="claude-3-5-haiku-20241022"
)
agent1 = AssistantAgent(name="writer", model_client=client)
agent2 = AssistantAgent(name="editor", model_client=client)
team = RoundRobinGroupChat(
participants=[agent1, agent2],
termination_condition=TextMentionTermination("TERMINATE")
)
server = Server(team=team, source_select="writer")
server.run(host="0.0.0.0", port=8000) # you could do not filled that args. default is that host="0.0.0.0", port=8000
Just write AutoGen team, and... Run it!
CURL call test! example
curl -X POST http://localhost:8000/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"session_id": "test-session",
"messages": [ { "role": "user", "content": "Please write 5 funny stories." } ]
}'
Demo
Multi team support
from autogen_oaiapi.server import Server
from autogen_agentchat.agents import AssistantAgent
from autogen_agentchat.teams import RoundRobinGroupChat
from autogen_ext.models.openai import OpenAIChatCompletionClient
from autogen_agentchat.conditions import MaxMessageTermination, TextMentionTermination
client = OpenAIChatCompletionClient(
model="gpt-4.1-nano"
)
agent1 = AssistantAgent(name="writer", model_client=client)
agent2 = AssistantAgent(name="editor", model_client=client)
team = RoundRobinGroupChat(
participants=[agent1, agent2],
termination_condition=TextMentionTermination("TERMINATE"),
)
server = Server()
server.model.register(
name="TEST_TEAM",
actor=team,
source_select="writer",
)
server.run(port=8001)
or
from autogen_oaiapi.server import Server
from autogen_agentchat.agents import AssistantAgent
from autogen_agentchat.teams import RoundRobinGroupChat
from autogen_ext.models.openai import OpenAIChatCompletionClient
from autogen_agentchat.conditions import MaxMessageTermination, TextMentionTermination
server = Server()
@server.model.register(name="TEST_TEAM_DECORATOR", source_select="writer")
def build_team():
client = OpenAIChatCompletionClient(
model="gpt-4.1-nano"
)
agent1 = AssistantAgent(name="writer", model_client=client)
agent2 = AssistantAgent(name="editor", model_client=client)
team = RoundRobinGroupChat(
participants=[agent1, agent2],
termination_condition=TextMentionTermination("TERMINATE"),
)
return team
server.run(port=8001)
Look at the example folder include more examples!
- simmple example
- function style register example
- decorator sytle register example
- JSON file style api_key register example
- Memory style api_key register example
Star History
Metadata
Release files for autogen-oaiapi 0.0.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| autogen_oaiapi-0.0.7.tar.gz | 20.1 kB | Without provenance | Details for autogen_oaiapi-0.0.7.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| autogen_oaiapi-0.0.7-py3-none-any.whl | Python 3 | none | any | Details for autogen_oaiapi-0.0.7-py3-none-any.whl |
Total release size: 45.2 kB
Release files / autogen_oaiapi-0.0.7.tar.gz
| Download URL | autogen_oaiapi-0.0.7.tar.gz |
|---|---|
| Size | 20.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
81091cdbc9cafcfcb717070f7790721d946a54a00686e10edaf99efc33fa1513
|
|
BLAKE2b-256 checksum How to use checksums |
e15dec21589f8a9aa4dc6cb4706a4c969d3b6a5a2b4537f0d353a208528b4855
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Release files / autogen_oaiapi-0.0.7-py3-none-any.whl
| Download URL | autogen_oaiapi-0.0.7-py3-none-any.whl |
|---|---|
| Size | 25.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4b837ede3ca390484ce13901e7eb726c091ea457e3380bd7989df0851f1c3a05
|
|
BLAKE2b-256 checksum How to use checksums |
fa78f3bf21c1112c1be4ab1f591bb799d6e5a8252cf1816f188e0f0633e7441f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Security for autogen-oaiapi 0.0.7
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.