diff --git a/python/docs/src/user-guide/agentchat-user-guide/tutorial/models.ipynb b/python/docs/src/user-guide/agentchat-user-guide/tutorial/models.ipynb index 0d1bdf26ba80..034659bdcd58 100644 --- a/python/docs/src/user-guide/agentchat-user-guide/tutorial/models.ipynb +++ b/python/docs/src/user-guide/agentchat-user-guide/tutorial/models.ipynb @@ -481,6 +481,83 @@ "await model_client.close()" ] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## FuturMix (OpenAI-compatible)\n", + "\n", + "[FuturMix](https://futurmix.ai) is a unified AI gateway that provides access to 22+ models from OpenAI, Anthropic, and Google through a single OpenAI-compatible API endpoint.\n", + "\n", + "Since FuturMix is fully OpenAI-compatible, you can use the {py:class}`~autogen_ext.models.openai.OpenAIChatCompletionClient` with the FuturMix API.\n", + "\n", + "To get started, obtain an API key from [FuturMix](https://futurmix.ai)." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "from autogen_core.models import UserMessage\n", + "from autogen_ext.models.openai import OpenAIChatCompletionClient\n", + "\n", + "model_client = OpenAIChatCompletionClient(\n", + " model=\"gpt-4o\",\n", + " base_url=\"https://futurmix.ai/v1\",\n", + " api_key=\"sk-your-futurmix-key\",\n", + ")\n", + "\n", + "response = await model_client.create([UserMessage(content=\"What is the capital of France?\", source=\"user\")])\n", + "print(response)\n", + "await model_client.close()" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "You can also use models from other providers through FuturMix, such as Anthropic's Claude or Google's Gemini:\n", + "\n", + "```python\n", + "from autogen_ext.models.openai import OpenAIChatCompletionClient\n", + "from autogen_core.models import ModelInfo\n", + "\n", + "# Use Claude through FuturMix\n", + "claude_client = OpenAIChatCompletionClient(\n", + " model=\"claude-sonnet-4-20250514\",\n", + " base_url=\"https://futurmix.ai/v1\",\n", + " api_key=\"sk-your-futurmix-key\",\n", + " model_info=ModelInfo(\n", + " vision=True,\n", + " function_calling=True,\n", + " json_output=True,\n", + " family=\"unknown\",\n", + " structured_output=True,\n", + " ),\n", + ")\n", + "\n", + "# Use Gemini through FuturMix\n", + "gemini_client = OpenAIChatCompletionClient(\n", + " model=\"gemini-2.5-flash\",\n", + " base_url=\"https://futurmix.ai/v1\",\n", + " api_key=\"sk-your-futurmix-key\",\n", + " model_info=ModelInfo(\n", + " vision=True,\n", + " function_calling=True,\n", + " json_output=True,\n", + " family=\"unknown\",\n", + " structured_output=True,\n", + " ),\n", + ")\n", + "```\n", + "\n", + "```{note}\n", + "When using non-OpenAI models through FuturMix, you may need to specify `model_info` to define the model's capabilities, as the client may not automatically recognize them.\n", + "```" + ] + }, { "cell_type": "markdown", "metadata": {}, @@ -599,4 +676,4 @@ }, "nbformat": 4, "nbformat_minor": 2 -} +} \ No newline at end of file