Use LlamaIndex with Shannon
Use LlamaIndex's OpenAILike class with Shannon's base URL; chat, streaming and function calling work through it.
- Tested Nov 7, 2026
- OpenAI Chat Completions
- About 2 min
About LlamaIndex
LlamaIndex is a Python and TypeScript framework for apps that read your documents: indexing, retrieval, agents and workflows. Its OpenAILike class talks to any OpenAI-compatible server, so Shannon models can answer questions, call tools and drive LlamaIndex agents.
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 the OpenAI-like integration
Shellpip install llama-index-core llama-index-llms-openai-like -
Create the model and stream
is_chat_model=Trueuses the chat endpoint;is_function_calling_model=Truelets agents call tools;context_windowtells LlamaIndex how much text fits.Pythonfrom llama_index.llms.openai_like import OpenAILike llm = OpenAILike( model="Kimi-K3-uncensored-NVFP4", api_base="https://api.shannon-ai.com/v1", api_key="YOUR_API_KEY", context_window=1022976, is_chat_model=True, is_function_calling_model=True, ) for r in llm.stream_complete("Name three colours a cat can be."): print(r.delta, end="", flush=True) -
Call tools
Pythonfrom llama_index.core.tools import FunctionTool def get_weather(city: str) -> str: """Weather for a city.""" return f"Sunny in {city}" tool = FunctionTool.from_defaults(fn=get_weather) resp = llm.chat_with_tools([tool], user_msg="What is the weather in Oslo?") print(llm.get_tool_calls_from_response(resp)) # [ToolSelection(tool_name='get_weather', tool_kwargs={'city': 'Oslo'})]
Check that it works
Send: Run the streaming sample.
You should see: The colours printed as they stream in.
Models that fit LlamaIndex
Every id below meets what LlamaIndex 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 |
Model settings
LlamaIndex asks for these values. They follow the model you picked.
| Setting | Value | Why |
|---|---|---|
context_window | 1022976 | LlamaIndex fits retrieved text into this many tokens. |
Good to know
- Without
is_chat_model=True,OpenAILikecalls the old/v1/completionsendpoint, which returns404on Shannon. - Without
is_function_calling_model=True, agents fall back to text-based tool use. - Retrieval needs an embedding model; Shannon does not serve
/v1/embeddings, so set LlamaIndex'sembed_modelto another provider or a local model.
Tips
- Set
Settings.llm = llmonce so every index, query engine and agent uses Shannon. FunctionAgentandReActAgentboth take thisllm.- For long documents, pick a model with a large window and raise
context_windowto match.
Troubleshooting
| Symptom | Cause | Fix |
|---|---|---|
404 on /v1/completions | is_chat_model is not set. | Pass is_chat_model=True. |
| Indexing asks for an OpenAI key | LlamaIndex's default embedding model is OpenAI's. | Set Settings.embed_model to an embedding model you have. |
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 LlamaIndex work with Shannon?
Yes, through OpenAILike with api_base="https://api.shannon-ai.com/v1".
Can LlamaIndex agents call tools on Shannon?
Yes; with is_function_calling_model=True the model returns native tool calls, which we tested.