LiteLLM ကို Shannon ဖြင့် အသုံးပြုခြင်း
openai/ ရှေ့ဆက်နှင့် api_base ဖြင့် LiteLLM မှ Shannon ကို ခေါ်ပါ၊ သို့မဟုတ် LiteLLM proxy ၏ model စာရင်းတွင် ထည့်ပါ။
- 2026 နို 7 တွင် စမ်းသပ်ထားသည်
- OpenAI Chat Completions
- ခန့်မှန်း 2 မိနစ်
LiteLLM အကြောင်း
LiteLLM သည် routing၊ budget နှင့် logging ပါသော model provider များစွာကို OpenAI format ဖြင့် interface တစ်ခုတည်း ပေးသော Python library နှင့် proxy server ဖြစ်သည်။ အဖွဲ့များသည် code မပြောင်းဘဲ provider များ ပြောင်းနိုင်ရန် ၎င်းကို app များ၏ ရှေ့တွင် ထားသည်။ Shannon သည် SDK တွင်ဖြစ်စေ proxy တွင်ဖြစ်စေ OpenAI-compatible provider အဖြစ် ချိတ်ဆက်သည်။
လိုအပ်သည်များ
- Shannon API key တစ်ခု
- Keys & usage စာမျက်နှာ
- အခြေ URL
-
https://api.shannon-ai.com/v1အဆုံးမှတ်:/v1/chat/completions - အောက်ပါ နမူနာအားလုံးသည် သင့်ရွေးချယ်မှုအတိုင်း ပြောင်းလဲသည်။
သတ်မှတ်ပုံ
-
LiteLLM ကို install လုပ်ပါ
Shellpip install 'litellm[proxy]' -
SDK မှ Shannon ကို ခေါ်ပါ
openai/ရှေ့ဆက်သည် LiteLLM ၏ OpenAI-compatible route ကို သုံးရန် ပြောသည်။api_baseက ၎င်းကို Shannon သို့ ညွှန်သည်။Pythonimport litellm kw = dict(model="openai/Kimi-K3-uncensored-NVFP4", api_base="https://api.shannon-ai.com/v1", api_key="YOUR_API_KEY") for chunk in litellm.completion(messages=[{"role": "user", "content": "Name three colours a cat can be."}], stream=True, **kw): print(chunk.choices[0].delta.content or "", end="") r = litellm.completion( messages=[{"role": "user", "content": "What is the weather in Oslo?"}], tools=[{"type": "function", "function": {"name": "get_weather", "parameters": {"type": "object", "properties": {"city": {"type": "string"}}, "required": ["city"]}}}], **kw, ) print(r.choices[0].message.tool_calls[0].function.arguments) # {"city": "Oslo"} -
သို့မဟုတ် LiteLLM proxy မှတစ်ဆင့် Shannon ကို ပံ့ပိုးပါ
Shannon ကို proxy ၏
model_listတွင် ထည့်ပါ၊ ထို့နောက် proxy ၏ client များသည်model_nameကို တောင်းသည်။config.yamlmodel_list: - model_name: Kimi-K3-uncensored-NVFP4 litellm_params: model: openai/Kimi-K3-uncensored-NVFP4 api_base: https://api.shannon-ai.com/v1 api_key: os.environ/SHANNON_API_KEY general_settings: master_key: os.environ/LITELLM_MASTER_KEY -
Proxy ကို စတင်ပါ
လက်ရှိ LiteLLM သည် ခိုင်ခံ့သော master key မပါဘဲ proxy ကို စတင်ရန် ငြင်းဆိုသည်။ client များက ၎င်းကို bearer key အဖြစ် ပို့သည်။
Shellexport SHANNON_API_KEY=YOUR_API_KEY export LITELLM_MASTER_KEY=sk-$(openssl rand -hex 24) litellm --config config.yaml --port 4000
အလုပ်လုပ်ကြောင်း စစ်ဆေးပါ
ပို့ရန်: SDK နမူနာကို run ပါ။
မြင်ရမည့်အရာ: အရောင်များ stream ဝင်လာပြီးနောက် tool argument များ ပုံနှိပ်ပေါ်လာသည်။
LiteLLM နှင့် ကိုက်ညီသော model များ
အောက်ပါ id တိုင်းသည် LiteLLM ၏ လိုအပ်ချက်နှင့် ကိုက်ညီသည်။ ပထမ id သည် code နမူနာများတွင် default ဖြစ်သည်။
| မော်ဒယ် ID | Context အရွယ် | အများဆုံး output | ပုံ ထည့်သွင်းမှု |
|---|---|---|---|
Kimi-K3-uncensored-NVFP4 | 1,022,976 | 262,144 | ဟုတ် |
Kimi-K3-uncensored-3BIT-REAP | 225,280 | 225,280 | ဟုတ် |
shannon-3 | 196,608 | 65,536 | ဟုတ် |
shannon-coder-1 | 131,072 | 65,536 | မဟုတ် |
သိထားသင့်သည်များ
openai/ရှေ့ဆက်မပါလျှင် LiteLLM သည် မည်သည့် route သုံးရမည်ကို မသိဘဲLLM Provider NOT providedဟု error ပေးသည်။- LiteLLM တွင် Shannon id များအတွက် ဈေးနှုန်းဒေတာ မရှိပါ။ ၎င်း၏ spend tracking ကို လိုလျှင်
model_infoအောက်တွင်input_cost_per_tokenနှင့်output_cost_per_tokenကို ထည့်ပါ။ - proxy သည် စတင်ချိန်တွင်
os.environ/SHANNON_API_KEYကို ဖတ်သည်။litellm --configမလုပ်မီ variable ကို export လုပ်ပါ။ master_keyမပါလျှင် proxy သည် စတင်ချိန်တွင် master key အားနည်းသည် သို့မဟုတ် မသတ်မှတ်ထားဟု သတင်းစကားပြပြီး ရပ်သွားသည်။
အကြံပြုချက်များ
api_base="https://api.shannon-ai.com"ပါသောanthropic/<id>သည် Shannon ၏ Anthropic-format endpoint ကို အစားထိုး သုံးသည်။- proxy အသုံးပြုသူများကို
model_nameတွင် အမည်တိုတစ်ခု ပေးပြီး Shannon id ကိုlitellm_params.modelတွင် ထားပါ။ - ၎င်းတို့အကြား route လုပ်ရန် သို့မဟုတ် fallback လုပ်ရန်
model_listတွင် Shannon id အများအပြား ထည့်ပါ။
ပြဿနာဖြေရှင်းခြင်း
| လက္ခဏာ | အကြောင်းရင်း | ဖြေရှင်းနည်း |
|---|---|---|
LLM Provider NOT provided | model တွင် openai/ ရှေ့ဆက် မပါပါ။ | model ကို openai/<id> ဟု ရေးပါ။ |
404 Not Found | api_base တွင် /v1 မပါပါ။ | https://api.shannon-ai.com/v1 ကို သုံးပါ။ |
proxy မှတစ်ဆင့် 401 | proxy စတင်ချိန်တွင် SHANNON_API_KEY မသတ်မှတ်ထားပါ။ | ကို export လုပ်ပြီး proxy ကို ပြန်စတင်ပါ။ |
401 Unauthorized | Key မရှိခြင်း၊ စာလုံးပေါင်းမှားခြင်း သို့မဟုတ် လဲလှယ်ပြီးသွားခြင်း ဖြစ်သည်။ | Keys & usage မှ key ကို ထပ်မံကူးယူပါ။ ၎င်းသည် sk- ဖြင့် စတင်သည်။ |
context_length_exceeded သို့မဟုတ် "prompt is too long" စာတို | စကားပြောဆိုမှုသည် model ၏ context window ထက် ပိုရှည်နေသည်။ | chat အသစ် စတင်ပါ၊ tool ကို ချုံ့ခွင့်ပေးပါ သို့မဟုတ် window ပိုကြီးသော model ကို ရွေးပါ။ |
insufficient_quota | သင့် လက်ကျန်ငွေသည် request အတွက် ပေးချေရန် မလုံလောက်ပါ။ | Top up ပြုလုပ်ပါ သို့မဟုတ် plan ပြောင်းပါ။ request ကို အလိုအလျောက် ပြန်မပို့ပါ။ |
မေးခွန်းများ
LiteLLM သည် Shannon နှင့် အလုပ်လုပ်ပါသလား။
လုပ်ပါသည်၊ OpenAI-compatible provider အဖြစ်- api_base="https://api.shannon-ai.com/v1" ပါသော model="openai/<id>"။
Shannon ကို LiteLLM proxy နောက်တွင် ထားနိုင်ပါသလား။
နိုင်ပါသည်၊ ပြထားသည့်အတိုင်း model_list တွင် ထည့်ပါ၊ proxy client အားလုံး ၎င်းကို သုံးနိုင်သည်။