Xiaomi MiMo

Xiaomi MiMo

https://platform.xiaomimimo.com/#/docs

모든 Xiaomi MiMo 모델을 지원해요. LiteLLM 요청 시 model=xiaomi_mimo/<any-model-on-xiaomi-mimo>처럼 접두어로 xiaomi_mimo/를 붙이면 돼요.

API 키 (API Key)

# env variable
os.environ['XIAOMI_MIMO_API_KEY']

샘플 사용법 (Sample Usage)

from litellm import completion
import os

os.environ['XIAOMI_MIMO_API_KEY'] = ""
response = completion(
    model="xiaomi_mimo/mimo-v2-flash",
    messages=[
        {
            "role": "user",
            "content": "What's the weather like in Boston today in Fahrenheit?",
        }
    ],
    max_tokens=1024,
    temperature=0.3,
    top_p=0.95,
)
print(response)

샘플 사용법 - 스트리밍 (Sample Usage - Streaming)

from litellm import completion
import os

os.environ['XIAOMI_MIMO_API_KEY'] = ""
response = completion(
    model="xiaomi_mimo/mimo-v2-flash",
    messages=[
        {
            "role": "user",
            "content": "What's the weather like in Boston today in Fahrenheit?",
        }
    ],
    stream=True,
    max_tokens=1024,
    temperature=0.3,
    top_p=0.95,
)

for chunk in response:
    print(chunk)

LiteLLM Proxy Server와 함께 사용하기 (Usage with LiteLLM Proxy Server)

LiteLLM Proxy Server로 Xiaomi MiMo 모델을 호출하는 방법이에요.

  • config.yaml 수정:
model_list:
  - model_name: my-model
    litellm_params:
      model: xiaomi_mimo/<your-model-name>  # add xiaomi_mimo/ prefix to route as Xiaomi MiMo provider
      api_key: api-key                      # api key to send your model
  • 프록시 시작:
$ litellm --config /path/to/config.yaml
  • LiteLLM Proxy Server에 요청 보내기:

  • OpenAI Python v1.0.0+

  • curl

import openai
client = openai.OpenAI(
    api_key="sk-<your-litellm-api-key>",             # pass litellm proxy key, if you're using virtual keys
    base_url="http://0.0.0.0:4000" # litellm-proxy-base url
)

response = client.chat.completions.create(
    model="my-model",
    messages = [
        {
            "role": "user",
            "content": "what llm are you"
        }
    ],
)

print(response)
curl --location 'http://0.0.0.0:4000/chat/completions' \
    --header "Authorization: Bearer ***" \
    --header 'Content-Type: application/json' \
    --data '{
    "model": "my-model",
    "messages": [
        {
        "role": "user",
        "content": "what llm are you"
        }
    ],
}'

지원 모델 (Supported Models)

모델명 사용법
mimo-v2-flash completion(model="xiaomi_mimo/mimo-v2-flash", messages)

출처: 문서

본문

더 알아보기 (Learn more)