Use Semantic Kernel with Shannon
Give Semantic Kernel's OpenAIChatCompletion an AsyncOpenAI client pointed at Shannon; plugins and automatic function calling then run on Shannon models.
- Tested Nov 7, 2026
- OpenAI Chat Completions
- About 3 min
About Semantic Kernel
Semantic Kernel is Microsoft's open-source SDK for adding AI to apps in Python, C# and Java, with plugins, function calling and agents. Its OpenAI connector accepts your own OpenAI client, so a client pointed at Shannon makes every kernel function run on Shannon models.
What you need
- A Shannon API key
- Keys & usage
- Base URL
-
https://api.shannon-ai.com/v1Endpoint:/v1/chat/completions - Every snippet below follows your choice.
Set it up
-
Install Semantic Kernel
Shellpip install semantic-kernel -
Add Shannon as the chat service
Pythonfrom openai import AsyncOpenAI from semantic_kernel import Kernel from semantic_kernel.connectors.ai.open_ai import OpenAIChatCompletion client = AsyncOpenAI(base_url="https://api.shannon-ai.com/v1", api_key="YOUR_API_KEY") chat = OpenAIChatCompletion(ai_model_id="Kimi-K3-uncensored-NVFP4", async_client=client) kernel = Kernel() kernel.add_service(chat) -
Add a plugin and let the model call it
Pythonimport asyncio from semantic_kernel.connectors.ai.function_choice_behavior import FunctionChoiceBehavior from semantic_kernel.connectors.ai.open_ai import OpenAIChatPromptExecutionSettings from semantic_kernel.contents import ChatHistory from semantic_kernel.functions import kernel_function class Weather: @kernel_function(description="Weather for a city") def get_weather(self, city: str) -> str: return f"Sunny, 18 C in {city}" kernel.add_plugin(Weather(), plugin_name="weather") settings = OpenAIChatPromptExecutionSettings(function_choice_behavior=FunctionChoiceBehavior.Auto()) async def main(): history = ChatHistory() history.add_user_message("What is the weather in Oslo?") print(await chat.get_chat_message_content(history, settings, kernel=kernel)) asyncio.run(main())
Check that it works
Send: Run the plugin sample.
You should see: An answer built from the plugin's result: sunny, 18 C in Oslo.
Models that fit Semantic Kernel
Every id below meets what Semantic Kernel needs. The first one is the default in the snippets.
| Model id | Context window | Max output | Image input |
|---|---|---|---|
Kimi-K3-uncensored-NVFP4 | 1,022,976 | 262,144 | Yes |
Kimi-K3-uncensored-3BIT-REAP | 225,280 | 225,280 | Yes |
shannon-3 | 196,608 | 65,536 | Yes |
shannon-coder-1 | 131,072 | 65,536 | No |
Good to know
- Pass your own
AsyncOpenAIclient: it is the way to set a base URL in the Python connector. - With
FunctionChoiceBehavior.Auto(), the kernel runs the function and asks the model again, so one question takes two requests.
Tips
chat.get_streaming_chat_message_contents(history, settings)streams the answer.- In C#, the OpenAI connector takes an endpoint too:
AddOpenAIChatCompletion(modelId: "<id>", endpoint: new Uri("https://api.shannon-ai.com/v1"), apiKey: key). We tested the Python SDK. - Register several services with different
service_ids to mix Shannon models in one kernel.
Troubleshooting
| Symptom | Cause | Fix |
|---|---|---|
404 Not Found | base_url lacks /v1. | Use https://api.shannon-ai.com/v1. |
| The plugin is never called | No function_choice_behavior in the settings. | Use FunctionChoiceBehavior.Auto() and pass kernel=. |
401 Unauthorized | The key is missing, mistyped or rotated. | Copy the key again from Keys & usage; it starts with sk-. |
context_length_exceeded / "prompt is too long" | The conversation is longer than the model's window. | Start a new chat, let the tool compact it, or pick a model with a larger window. |
insufficient_quota | Your balance cannot pay for the request. | Top up or change plan; the request is not retried by itself. |
Questions
Does Semantic Kernel work with Shannon?
Yes, through OpenAIChatCompletion with an AsyncOpenAI client whose base_url is https://api.shannon-ai.com/v1.
Does automatic function calling work?
Yes; we ran a plugin call with FunctionChoiceBehavior.Auto().