mimo2codex 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +124 -0
- package/LICENSE +21 -0
- package/README.md +536 -0
- package/README.zh.md +750 -0
- package/dist/cli.js +202 -0
- package/dist/cli.js.map +1 -0
- package/dist/config.js +86 -0
- package/dist/config.js.map +1 -0
- package/dist/server.js +161 -0
- package/dist/server.js.map +1 -0
- package/dist/translate/reqToChat.js +381 -0
- package/dist/translate/reqToChat.js.map +1 -0
- package/dist/translate/respToResponses.js +94 -0
- package/dist/translate/respToResponses.js.map +1 -0
- package/dist/translate/streamToSse.js +352 -0
- package/dist/translate/streamToSse.js.map +1 -0
- package/dist/translate/types.js +4 -0
- package/dist/translate/types.js.map +1 -0
- package/dist/upstream/chatStream.js +56 -0
- package/dist/upstream/chatStream.js.map +1 -0
- package/dist/upstream/mimoClient.js +99 -0
- package/dist/upstream/mimoClient.js.map +1 -0
- package/dist/util/ids.js +19 -0
- package/dist/util/ids.js.map +1 -0
- package/dist/util/log.js +32 -0
- package/dist/util/log.js.map +1 -0
- package/dist/util/sse.js +61 -0
- package/dist/util/sse.js.map +1 -0
- package/mimoskill/SKILL.md +145 -0
- package/mimoskill/assets/pet_prompt_template.md +94 -0
- package/mimoskill/references/models.md +111 -0
- package/mimoskill/references/pet_workflow.md +197 -0
- package/mimoskill/scripts/generate_pet.py +365 -0
- package/mimoskill/scripts/install_pet.sh +220 -0
- package/mimoskill/scripts/mimo_chat.py +199 -0
- package/package.json +69 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sse.js","sourceRoot":"","sources":["../../src/util/sse.ts"],"names":[],"mappings":"AAYA,MAAM,UAAU,sBAAsB,CAAC,GAAmB;IACxD,GAAG,CAAC,SAAS,CAAC,cAAc,EAAE,kCAAkC,CAAC,CAAC;IAClE,GAAG,CAAC,SAAS,CAAC,eAAe,EAAE,wBAAwB,CAAC,CAAC;IACzD,GAAG,CAAC,SAAS,CAAC,YAAY,EAAE,YAAY,CAAC,CAAC;IAC1C,GAAG,CAAC,SAAS,CAAC,mBAAmB,EAAE,IAAI,CAAC,CAAC;IACzC,IAAI,OAAQ,GAAgD,CAAC,YAAY,KAAK,UAAU,EAAE,CAAC;QACxF,GAA+C,CAAC,YAAY,EAAE,CAAC;IAClE,CAAC;IAED,IAAI,QAAQ,GAAG,KAAK,CAAC;IACrB,GAAG,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE;QACnB,QAAQ,GAAG,IAAI,CAAC;IAClB,CAAC,CAAC,CAAC;IAEH,OAAO;QACL,KAAK,CAAC,KAAK,EAAE,IAAI;YACf,IAAI,QAAQ;gBAAE,OAAO;YACrB,MAAM,OAAO,GAAG,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;YACvE,GAAG,CAAC,KAAK,CAAC,UAAU,KAAK,WAAW,OAAO,MAAM,CAAC,CAAC;QACrD,CAAC;QACD,OAAO,CAAC,IAAI;YACV,IAAI,QAAQ;gBAAE,OAAO;YACrB,GAAG,CAAC,KAAK,CAAC,KAAK,IAAI,MAAM,CAAC,CAAC;QAC7B,CAAC;QACD,GAAG;YACD,IAAI,QAAQ;gBAAE,OAAO;YACrB,QAAQ,GAAG,IAAI,CAAC;YAChB,GAAG,CAAC,GAAG,EAAE,CAAC;QACZ,CAAC;QACD,MAAM;YACJ,OAAO,QAAQ,CAAC;QAClB,CAAC;KACF,CAAC;AACJ,CAAC;AAQD,MAAM,UAAU,cAAc;IAC5B,MAAM,MAAM,GAAoB,EAAE,CAAC;IACnC,MAAM,QAAQ,GAAa,EAAE,CAAC;IAC9B,IAAI,QAAQ,GAAG,KAAK,CAAC;IACrB,OAAO;QACL,MAAM;QACN,QAAQ;QACR,KAAK,CAAC,KAAK,EAAE,IAAI;YACf,IAAI,QAAQ;gBAAE,OAAO;YACrB,MAAM,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;QAC/B,CAAC;QACD,OAAO,CAAC,IAAI;YACV,IAAI,QAAQ;gBAAE,OAAO;YACrB,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACtB,CAAC;QACD,GAAG;YACD,QAAQ,GAAG,IAAI,CAAC;QAClB,CAAC;QACD,MAAM;YACJ,OAAO,QAAQ,CAAC;QAClB,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: mimoskill
|
|
3
|
+
description: Use Xiaomi MiMo V2.5 (the LLM behind mimo2codex) for chat, vision, web search, TTS and ASR — and route around capabilities MiMo doesn't natively support, especially image generation needed for things like Codex Pets `/hatch`. Trigger when the user mentions MiMo, calls into mimo2codex, asks to generate / hatch a Codex pet, asks for image generation while using MiMo as the chat backend, or hits a "no image generation available" / "image_gen tool unavailable" message inside Codex.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# mimoskill — Xiaomi MiMo V2.5 + gap fillers
|
|
7
|
+
|
|
8
|
+
This skill bundles two things:
|
|
9
|
+
|
|
10
|
+
1. **Direct MiMo V2.5 access** — recipes for hitting `https://api.xiaomimimo.com/v1` for chat, vision, web search, TTS, and ASR (works whether or not the [mimo2codex](../README.md) proxy is running).
|
|
11
|
+
2. **Workarounds for MiMo's gaps** — concrete scripts for the few things MiMo doesn't do, particularly **image generation** (which is what Codex's `/hatch` pet creation needs).
|
|
12
|
+
|
|
13
|
+
## When to use
|
|
14
|
+
|
|
15
|
+
Trigger this skill when:
|
|
16
|
+
|
|
17
|
+
- User asks to hit MiMo's API directly (chat / vision / web search / TTS / ASR)
|
|
18
|
+
- User asks "how do I generate a Codex pet" / "/hatch isn't working" / "image_gen tool not available"
|
|
19
|
+
- User wants image generation as part of a MiMo-backed workflow
|
|
20
|
+
- User pastes the Codex error: `the image generation tool (image_gen) is not available in this environment` or `the CLI fallback requires the openai Python package`
|
|
21
|
+
- Anything in the `mimo2codex` repo that touches a feature MiMo doesn't support
|
|
22
|
+
|
|
23
|
+
## What MiMo V2.5 does and doesn't do
|
|
24
|
+
|
|
25
|
+
Quick answer:
|
|
26
|
+
|
|
27
|
+
| Capability | MiMo native | Best model | Notes |
|
|
28
|
+
|---|---|---|---|
|
|
29
|
+
| Text chat | ✅ | `mimo-v2.5-pro` | reasoning + tools |
|
|
30
|
+
| 1M context | ✅ | `mimo-v2.5-pro[1m]` | append `[1m]` suffix |
|
|
31
|
+
| Tool / function calling | ✅ | any | parallel calls supported |
|
|
32
|
+
| Vision (image input) | ✅ | `mimo-v2.5` or `mimo-v2-omni` | NOT mimo-v2.5-pro |
|
|
33
|
+
| Web search | ✅ | any | requires Web Search Plugin activated in MiMo console |
|
|
34
|
+
| TTS (speech synth) | ✅ | `mimo-v2.5-tts` | separate endpoint |
|
|
35
|
+
| ASR (speech recog) | ✅ | `mimo-v2.5-asr` | separate endpoint |
|
|
36
|
+
| Audio chat | ✅ | `mimo-v2-omni` | input only |
|
|
37
|
+
| Video understanding | ✅ | `mimo-v2-omni` | input only |
|
|
38
|
+
| **Image generation** | ❌ | — | **see workaround below** |
|
|
39
|
+
| Code interpreter / sandbox | ❌ | — | not provided |
|
|
40
|
+
|
|
41
|
+
For the full capability matrix and examples, read [references/models.md](references/models.md).
|
|
42
|
+
|
|
43
|
+
## Decision tree: what does the user actually want?
|
|
44
|
+
|
|
45
|
+
```
|
|
46
|
+
Is it chat / vision / search / TTS / ASR?
|
|
47
|
+
├── Yes → use MiMo directly (see "Calling MiMo directly" below) or via mimo2codex if Codex is the client
|
|
48
|
+
└── No, they want image generation
|
|
49
|
+
│
|
|
50
|
+
Is it for a Codex pet (`/hatch`)?
|
|
51
|
+
├── Yes → see "Generating a Codex pet" below
|
|
52
|
+
└── No → see "Image generation in general" below
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Calling MiMo directly
|
|
56
|
+
|
|
57
|
+
Use `scripts/mimo_chat.py` to send a single chat completion (or stream):
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
export MIMO_API_KEY=sk-xxxxxxxxxxxxxxxx
|
|
61
|
+
python3 mimoskill/scripts/mimo_chat.py "your prompt here"
|
|
62
|
+
python3 mimoskill/scripts/mimo_chat.py --model mimo-v2.5 --image https://example.com/x.png "describe this"
|
|
63
|
+
python3 mimoskill/scripts/mimo_chat.py --search "今天上海天气?"
|
|
64
|
+
python3 mimoskill/scripts/mimo_chat.py --stream "tell me a story"
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
The script handles all the MiMo-specific quirks — `max_completion_tokens` instead of `max_tokens`, the required `text` part next to `image_url`, web_search plugin invocation, `reasoning_content` round-tripping, etc.
|
|
68
|
+
|
|
69
|
+
For non-trivial integrations, [references/models.md](references/models.md) and [the official MiMo OpenAI-compat doc](https://platform.xiaomimimo.com/docs/api/chat/openai-api) are the authoritative references.
|
|
70
|
+
|
|
71
|
+
## Generating a Codex pet (the `/hatch` alternative)
|
|
72
|
+
|
|
73
|
+
**Why this needs special handling**: Codex's built-in `/hatch` pet generation requires OpenAI's image generation API (`gpt-image-1`). MiMo doesn't have an image generation endpoint, and mimo2codex can't fake one. So `/hatch` from inside Codex won't work when Codex is pointed at MiMo.
|
|
74
|
+
|
|
75
|
+
**The workaround**: generate the pet image *outside* of Codex, then drop the result into Codex's pet directory and restart Codex. The script supports several image-gen backends:
|
|
76
|
+
|
|
77
|
+
- **`auto` (default)** — picks `gpt-image-1` if you have an OpenAI key set, otherwise falls back to **pollinations.ai** (free, no key, no signup). **Works with only a MiMo key.**
|
|
78
|
+
- **`pollinations`** — free, no key required
|
|
79
|
+
- **`gpt-image-1`** — best quality, needs a real OpenAI key (separate from `MIMO_API_KEY`)
|
|
80
|
+
- **`replicate`** — FLUX/SDXL, ~$0.003/img, needs `REPLICATE_API_TOKEN`
|
|
81
|
+
- **`local-sd`** — Automatic1111/ComfyUI on `127.0.0.1:7860`, free, needs local setup
|
|
82
|
+
|
|
83
|
+
### Quickstart (only MiMo key required)
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
# 1. No OpenAI key, no pip install — just run with the free fallback
|
|
87
|
+
python3 mimoskill/scripts/generate_pet.py \
|
|
88
|
+
--description "a chubby cyberpunk axolotl coding hero" \
|
|
89
|
+
--out ~/Downloads/my-pet.png
|
|
90
|
+
|
|
91
|
+
# 2. Install into Codex's pet folder
|
|
92
|
+
bash mimoskill/scripts/install_pet.sh ~/Downloads/my-pet.png "axolotl-coder"
|
|
93
|
+
|
|
94
|
+
# 3. Restart Codex completely and select the new pet from the pet menu
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
`generate_pet.py` will print `[provider] auto → pollinations` so you know the free path is in use.
|
|
98
|
+
|
|
99
|
+
### Optional: better quality with an OpenAI key
|
|
100
|
+
|
|
101
|
+
If you do want gpt-image-1 quality (and image-to-image edit via `--reference`):
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
export PET_OPENAI_API_KEY=sk-real-openai-key # NOT mimo2codex-local
|
|
105
|
+
python3 mimoskill/scripts/generate_pet.py \
|
|
106
|
+
--reference path/to/source-image.jpg \
|
|
107
|
+
--description "a chubby cyberpunk axolotl coding hero" \
|
|
108
|
+
--out ~/Downloads/my-pet.png
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
`auto` will pick gpt-image-1 automatically when this env var is set. This OpenAI key is **only** used for the image generation call — your chat conversations still go through MiMo via mimo2codex.
|
|
112
|
+
|
|
113
|
+
### Step-by-step walkthrough + prompt design
|
|
114
|
+
|
|
115
|
+
Read [references/pet_workflow.md](references/pet_workflow.md) for:
|
|
116
|
+
|
|
117
|
+
- The exact Codex pet folder location on macOS / Linux / Windows
|
|
118
|
+
- How to make a static image work (most pets are animated GIFs, but a static PNG fallback works)
|
|
119
|
+
- How to generate animated states (idle / working / done) — typically requires multiple gpt-image-1 calls with edit / remix prompting
|
|
120
|
+
- How to mix MiMo + image gen: have MiMo write the prompt, then feed that prompt to gpt-image-1
|
|
121
|
+
|
|
122
|
+
Use the proven pet prompt formula in [assets/pet_prompt_template.md](assets/pet_prompt_template.md) — it's tuned for the chibi / sticker style Codex uses.
|
|
123
|
+
|
|
124
|
+
## Image generation in general
|
|
125
|
+
|
|
126
|
+
If the user wants image generation for some other reason (not a pet), the same workaround applies: `gpt-image-1` is the highest-quality option but requires a real OpenAI key. Free alternatives:
|
|
127
|
+
|
|
128
|
+
- **Stable Diffusion** locally via [Automatic1111](https://github.com/AUTOMATIC1111/stable-diffusion-webui) or [ComfyUI](https://github.com/comfyanonymous/ComfyUI) — heavy setup but no per-call cost
|
|
129
|
+
- **Together AI** / **Replicate** — pay-as-you-go for SDXL / FLUX
|
|
130
|
+
- **Pollinations.ai** — free, no key required, lower quality
|
|
131
|
+
|
|
132
|
+
`scripts/generate_pet.py` defaults to gpt-image-1 but accepts `--provider pollinations` for the free path (with reduced quality).
|
|
133
|
+
|
|
134
|
+
## Cost notes
|
|
135
|
+
|
|
136
|
+
- Direct MiMo: pay-as-you-go (`sk-xxx`) or token plan (`tp-xxx`). See [pricing](https://platform.xiaomimimo.com/docs/pricing).
|
|
137
|
+
- Web Search plugin: separately metered per keyword search. Cap with `max_keyword`.
|
|
138
|
+
- gpt-image-1: ~$0.04 per 1024×1024 image (low quality), up to ~$0.17 (HD). One pet usually costs <$0.50 even with retries.
|
|
139
|
+
- Pollinations.ai: free.
|
|
140
|
+
|
|
141
|
+
## Don't use this skill for
|
|
142
|
+
|
|
143
|
+
- Just running mimo2codex (that's an HTTP proxy; this skill is direct API + workarounds). For mimo2codex itself, see the project [README.md](../README.md) / [README.zh.md](../README.zh.md).
|
|
144
|
+
- Configuring Codex (use `mimo2codex print-config` or `mimo2codex print-cc-switch`).
|
|
145
|
+
- Anything Anthropic / Claude — this is MiMo-specific.
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
# Pet prompt templates
|
|
2
|
+
|
|
3
|
+
Tuned for the chibi / sticker style Codex's built-in pets use. `generate_pet.py`
|
|
4
|
+
auto-prepends and appends the boilerplate, so what you pass via `--description`
|
|
5
|
+
should just be the **subject** (and optionally an action / pose for state-aware
|
|
6
|
+
variants).
|
|
7
|
+
|
|
8
|
+
The full assembled prompt looks like:
|
|
9
|
+
|
|
10
|
+
```
|
|
11
|
+
Chibi sticker mascot of <description>, <action>, front-facing, expressive face,
|
|
12
|
+
soft cel-shading, thin clean outline, transparent background, high detail,
|
|
13
|
+
playful, single character centered, 1024x1024 sticker style
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Subject formula
|
|
17
|
+
|
|
18
|
+
```
|
|
19
|
+
<adjective> <species/character> <(optional) accessory or trait>
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Examples:
|
|
23
|
+
|
|
24
|
+
| Description | Result style |
|
|
25
|
+
|---|---|
|
|
26
|
+
| `chubby cyberpunk axolotl` | rounder body, neon highlights |
|
|
27
|
+
| `wise old shiba inu wearing tiny glasses` | classic dev mascot vibe |
|
|
28
|
+
| `tiny astronaut cat with a USB cable tail` | sci-fi quirky |
|
|
29
|
+
| `pixel-art slime in a hoodie` | indie game feel |
|
|
30
|
+
| `red panda with antennae and a debugger sword` | combat-coder mood |
|
|
31
|
+
| `kawaii rubber duck with a tie and laptop` | corporate-debug humor |
|
|
32
|
+
|
|
33
|
+
Tips:
|
|
34
|
+
- **One creature only.** "axolotl AND a cat" produces clutter.
|
|
35
|
+
- **Keep adjectives concrete.** "soft", "round", "tiny", "neon", "glowing" >
|
|
36
|
+
"cool", "epic", "amazing".
|
|
37
|
+
- **Mention 1 accessory max.** A laptop, a coffee cup, a wrench — not all three.
|
|
38
|
+
|
|
39
|
+
## State action overrides (for `--bundle` mode)
|
|
40
|
+
|
|
41
|
+
These are inserted between subject and the boilerplate, replacing the script's
|
|
42
|
+
default actions if you customize.
|
|
43
|
+
|
|
44
|
+
| State | Default action |
|
|
45
|
+
|---|---|
|
|
46
|
+
| `idle` | `calm pose, hands together, soft smile` |
|
|
47
|
+
| `working` | `typing on a tiny laptop, focused expression, sparkles around hands` |
|
|
48
|
+
| `done` | `celebrating with arms raised, sparkles and confetti` |
|
|
49
|
+
|
|
50
|
+
Custom action examples:
|
|
51
|
+
|
|
52
|
+
- working: `welding sparks flying, goggles down, intense concentration`
|
|
53
|
+
- done: `triumphantly holding up a 'shipped' flag, confetti raining`
|
|
54
|
+
- error: `comedic stunned face, smoke wisps, holding a broken keyboard`
|
|
55
|
+
|
|
56
|
+
## Generating descriptions with MiMo
|
|
57
|
+
|
|
58
|
+
Have MiMo describe the reference image first:
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
python3 mimoskill/scripts/mimo_chat.py \
|
|
62
|
+
--image path/to/reference.jpg \
|
|
63
|
+
"Describe this character in 12-25 words as a chibi pet sticker prompt for \
|
|
64
|
+
image generation. Output ONLY the description, no preamble. Format: \
|
|
65
|
+
'<adjective> <species> <accessory>'."
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Pipe it straight into the generator:
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
DESC=$(python3 mimoskill/scripts/mimo_chat.py --image src.jpg \
|
|
72
|
+
"Describe this character in 12-25 words ... Output ONLY the description.")
|
|
73
|
+
python3 mimoskill/scripts/generate_pet.py \
|
|
74
|
+
--reference src.jpg --description "$DESC" --bundle ./my-pet/
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## Style overrides
|
|
78
|
+
|
|
79
|
+
If the default chibi-sticker style isn't what you want, edit
|
|
80
|
+
`scripts/generate_pet.py` and change `PROMPT_PREFIX` / `PROMPT_SUFFIX`. Common
|
|
81
|
+
alternatives:
|
|
82
|
+
|
|
83
|
+
- **Pixel art**: prefix `Retro 16-bit pixel art sprite of `, suffix `, transparent background, single sprite, 64x64 upscaled to 1024x1024 with nearest-neighbor`
|
|
84
|
+
- **Hand-drawn**: prefix `Hand-drawn ink-and-watercolor sticker of `, suffix `, transparent background, loose linework, watercolor wash, single character`
|
|
85
|
+
- **3D rendered**: prefix `Cute 3D render mascot of `, suffix `, soft global illumination, transparent background, octane render, isometric three-quarter view`
|
|
86
|
+
|
|
87
|
+
## Anti-patterns
|
|
88
|
+
|
|
89
|
+
These tend to produce bad pets — avoid:
|
|
90
|
+
|
|
91
|
+
- Listing more than 3 visual traits in the subject (model averages them poorly)
|
|
92
|
+
- Naming a real human ("looks like Steve Jobs") — gpt-image-1 will refuse
|
|
93
|
+
- Negative prompts in the description ("not blurry") — handled by the suffix
|
|
94
|
+
- Specifying impossible camera angles ("from below") for sticker-style outputs
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
# MiMo V2.5 model capability matrix
|
|
2
|
+
|
|
3
|
+
Authoritative source: <https://platform.xiaomimimo.com/docs>. This file summarizes
|
|
4
|
+
the bits the skill cares about — read the official docs for full schemas.
|
|
5
|
+
|
|
6
|
+
## Models at a glance
|
|
7
|
+
|
|
8
|
+
| Model | Text | Vision | Audio in | Image gen | Audio gen | Reasoning | Context | Best for |
|
|
9
|
+
|---|---|---|---|---|---|---|---|---|
|
|
10
|
+
| `mimo-v2.5-pro` | ✅ | ❌ | ❌ | ❌ | ❌ | ✅ strong | 128K | Coding, agentic tasks, complex reasoning |
|
|
11
|
+
| `mimo-v2.5-pro[1m]` | ✅ | ❌ | ❌ | ❌ | ❌ | ✅ strong | 1M | Long-doc / large-codebase analysis |
|
|
12
|
+
| `mimo-v2.5` | ✅ | ✅ | ❌ | ❌ | ❌ | ✅ medium | 128K | Multimodal chat with image input |
|
|
13
|
+
| `mimo-v2.5[1m]` | ✅ | ✅ | ❌ | ❌ | ❌ | ✅ medium | 1M | Long-context with images |
|
|
14
|
+
| `mimo-v2-omni` | ✅ | ✅ | ✅ | ❌ | ❌ | ✅ | 128K | Full-modal input (text/image/audio/video) |
|
|
15
|
+
| `mimo-v2-flash` | ✅ | ❌ | ❌ | ❌ | ❌ | – | 128K | Cheap / fast simple chat |
|
|
16
|
+
| `mimo-v2.5-tts` | ❌ | ❌ | ❌ | ❌ | ✅ | – | – | TTS (separate endpoint) |
|
|
17
|
+
| `mimo-v2.5-asr` | ❌ | ❌ | ✅ | ❌ | ❌ | – | – | ASR (separate endpoint) |
|
|
18
|
+
|
|
19
|
+
> **Image generation is not in this table because no MiMo model produces images.**
|
|
20
|
+
> For image generation, see [pet_workflow.md](./pet_workflow.md) → "Image gen alternatives".
|
|
21
|
+
|
|
22
|
+
## Endpoints
|
|
23
|
+
|
|
24
|
+
| Capability | Endpoint | Compatible with |
|
|
25
|
+
|---|---|---|
|
|
26
|
+
| Chat (text + vision) | `https://api.xiaomimimo.com/v1/chat/completions` | OpenAI Python SDK / curl |
|
|
27
|
+
| Chat (Anthropic shape) | `https://api.xiaomimimo.com/anthropic/v1/messages` | Anthropic SDK / Claude Code |
|
|
28
|
+
| TTS | (consult MiMo TTS docs) | MiMo SDK |
|
|
29
|
+
| ASR | (consult MiMo ASR docs) | MiMo SDK |
|
|
30
|
+
|
|
31
|
+
Token Plan users substitute `https://token-plan-cn.xiaomimimo.com` for the host.
|
|
32
|
+
|
|
33
|
+
## Authentication
|
|
34
|
+
|
|
35
|
+
Both header forms are accepted:
|
|
36
|
+
|
|
37
|
+
```
|
|
38
|
+
Authorization: Bearer ${MIMO_API_KEY}
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
or
|
|
42
|
+
|
|
43
|
+
```
|
|
44
|
+
api-key: ${MIMO_API_KEY}
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Key prefixes:
|
|
48
|
+
|
|
49
|
+
- `sk-...` — pay-as-you-go (uses default `api.xiaomimimo.com` base URL)
|
|
50
|
+
- `tp-...` — token plan subscription (uses `token-plan-cn.xiaomimimo.com` base URL)
|
|
51
|
+
|
|
52
|
+
## Field quirks (vs OpenAI)
|
|
53
|
+
|
|
54
|
+
These trip people up:
|
|
55
|
+
|
|
56
|
+
1. Use **`max_completion_tokens`**, not `max_tokens`. MiMo follows the newer spec.
|
|
57
|
+
2. **Reasoning is exposed as `reasoning_content`** on assistant messages (DeepSeek-style), not OpenAI's `reasoning_summary`.
|
|
58
|
+
3. For **multi-turn tool calls in thinking mode**, *re-inject all prior `reasoning_content`* on the next request — MiMo recommends this, drops in quality otherwise.
|
|
59
|
+
4. **Image input requires both `image_url` AND a `text` part**. An image-only message returns `400 Param Incorrect: text is not set`. Add a `{type: "text", text: " "}` part if you don't have a real prompt.
|
|
60
|
+
5. **`tool_choice` other than `"auto"`** is currently silently ignored upstream — behavior is always equivalent to `auto`.
|
|
61
|
+
6. **Web Search builtin** is a tool of `type: "web_search"` (not a function tool). Requires the [Web Search Plugin](https://platform.xiaomimimo.com/#/console/plugin) to be activated in your console first; separately metered.
|
|
62
|
+
7. Annotations come back on `message.annotations` as `{type: "url_citation", url, title, summary}`.
|
|
63
|
+
|
|
64
|
+
## Tools and function calling
|
|
65
|
+
|
|
66
|
+
Standard OpenAI function tool format works:
|
|
67
|
+
|
|
68
|
+
```json
|
|
69
|
+
{
|
|
70
|
+
"type": "function",
|
|
71
|
+
"function": {
|
|
72
|
+
"name": "...",
|
|
73
|
+
"description": "...",
|
|
74
|
+
"parameters": { "type": "object", "properties": { ... } },
|
|
75
|
+
"strict": false
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
`tool_calls` come back on the assistant message; reply with `{role: "tool", tool_call_id, content}`. Parallel tool calls are supported.
|
|
81
|
+
|
|
82
|
+
## Web search
|
|
83
|
+
|
|
84
|
+
```json
|
|
85
|
+
{
|
|
86
|
+
"type": "web_search",
|
|
87
|
+
"max_keyword": 3,
|
|
88
|
+
"force_search": true,
|
|
89
|
+
"limit": 1,
|
|
90
|
+
"user_location": {
|
|
91
|
+
"type": "approximate",
|
|
92
|
+
"country": "China",
|
|
93
|
+
"region": "Hubei",
|
|
94
|
+
"city": "Wuhan"
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
Streaming: search sources arrive in the **first** SSE chunk's `delta.annotations`.
|
|
100
|
+
|
|
101
|
+
## Quick model picker
|
|
102
|
+
|
|
103
|
+
```
|
|
104
|
+
Need image input? → mimo-v2.5 (or mimo-v2-omni for audio/video too)
|
|
105
|
+
Need 1M context? → mimo-v2.5-pro[1m] or mimo-v2.5[1m]
|
|
106
|
+
Doing heavy reasoning/code? → mimo-v2.5-pro
|
|
107
|
+
Just doing cheap text chat? → mimo-v2-flash
|
|
108
|
+
Need TTS? → mimo-v2.5-tts (separate endpoint)
|
|
109
|
+
Need ASR? → mimo-v2.5-asr (separate endpoint)
|
|
110
|
+
Need image generation? → MiMo can't. Use gpt-image-1 / Pollinations / SD.
|
|
111
|
+
```
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
# Codex Pet generation workflow (the `/hatch` alternative)
|
|
2
|
+
|
|
3
|
+
`/hatch` inside Codex calls OpenAI's image generation API (`gpt-image-1`). When
|
|
4
|
+
Codex is pointed at MiMo (via mimo2codex), `/hatch` fails because MiMo doesn't
|
|
5
|
+
have an image generation endpoint and the `mimo2codex-local` placeholder key
|
|
6
|
+
isn't a real OpenAI key.
|
|
7
|
+
|
|
8
|
+
This doc shows you how to generate the pet **outside** of Codex and drop it in.
|
|
9
|
+
|
|
10
|
+
## TL;DR (only MiMo key required)
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
# No OpenAI key, no pip install — defaults to free Pollinations
|
|
14
|
+
python3 mimoskill/scripts/generate_pet.py \
|
|
15
|
+
--description "chibi cyberpunk axolotl with a laptop" \
|
|
16
|
+
--out ~/Downloads/my-pet.png
|
|
17
|
+
|
|
18
|
+
bash mimoskill/scripts/install_pet.sh ~/Downloads/my-pet.png "axolotl-coder"
|
|
19
|
+
# fully quit and relaunch Codex; pick the new pet from the picker
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
The script prints `[provider] auto → pollinations` to confirm the free path
|
|
23
|
+
is in use. For better quality, see "Image gen alternatives" below.
|
|
24
|
+
|
|
25
|
+
## TL;DR (with OpenAI key for higher quality)
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
export PET_OPENAI_API_KEY=sk-real-openai-key # NOT mimo2codex-local
|
|
29
|
+
python3 mimoskill/scripts/generate_pet.py \
|
|
30
|
+
--reference path/to/source.jpg \
|
|
31
|
+
--description "chibi cyberpunk axolotl with a laptop" \
|
|
32
|
+
--out ~/Downloads/my-pet.png
|
|
33
|
+
|
|
34
|
+
bash mimoskill/scripts/install_pet.sh ~/Downloads/my-pet.png "axolotl-coder"
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
`--reference` (image-to-image edit) only works with `gpt-image-1`.
|
|
38
|
+
|
|
39
|
+
## Pet folder location
|
|
40
|
+
|
|
41
|
+
Codex looks for custom pet bundles in these locations (it picks the first that exists):
|
|
42
|
+
|
|
43
|
+
| OS | Path |
|
|
44
|
+
|---|---|
|
|
45
|
+
| macOS | `~/Library/Application Support/Codex/pets/` (desktop), or `~/Documents/Codex/pets/` (CLI dump) |
|
|
46
|
+
| Linux | `~/.config/Codex/pets/` or `~/.codex/pets/` |
|
|
47
|
+
| Windows | `%APPDATA%\Codex\pets\` |
|
|
48
|
+
|
|
49
|
+
The exact path depends on your Codex version. `install_pet.sh` will probe each
|
|
50
|
+
candidate and put the file in the first writable directory it finds, falling
|
|
51
|
+
back to `~/.codex/pets/` if none exist (creating it).
|
|
52
|
+
|
|
53
|
+
After install, **fully quit Codex** (system tray → Quit, not just close window)
|
|
54
|
+
and reopen — the picker will show the new entry.
|
|
55
|
+
|
|
56
|
+
## Pet bundle format
|
|
57
|
+
|
|
58
|
+
A Codex pet bundle is a small directory:
|
|
59
|
+
|
|
60
|
+
```
|
|
61
|
+
my-pet/
|
|
62
|
+
├── manifest.json # name, author, sprite filenames, default state
|
|
63
|
+
├── idle.png # required: idle animation
|
|
64
|
+
├── working.png # required: shown while Codex is processing
|
|
65
|
+
├── done.png # optional: shown briefly on success
|
|
66
|
+
└── error.png # optional: shown on failure
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
If you only have one image, use it for `idle.png` — Codex will reuse it for the
|
|
70
|
+
other states.
|
|
71
|
+
|
|
72
|
+
`scripts/install_pet.sh` writes a minimal `manifest.json` for you.
|
|
73
|
+
|
|
74
|
+
> **Note:** This format is reverse-engineered from observed behavior and may
|
|
75
|
+
> evolve. If a future Codex version rejects the bundle, check the Codex docs at
|
|
76
|
+
> <https://developers.openai.com/codex/app/pets> (or run `/pet --debug` if such a
|
|
77
|
+
> flag exists in your version) to see the current schema, and update the script.
|
|
78
|
+
|
|
79
|
+
## Step-by-step
|
|
80
|
+
|
|
81
|
+
### 1. Pick a reference image
|
|
82
|
+
|
|
83
|
+
Anything works — a photo of yourself, a screenshot of a character, a logo.
|
|
84
|
+
gpt-image-1's edit mode will turn it into a chibi-style sticker. PNG or JPG,
|
|
85
|
+
recommended ≤ 4 MB.
|
|
86
|
+
|
|
87
|
+
If you don't have a reference image, skip `--reference` and gpt-image-1 will
|
|
88
|
+
generate from your text description alone.
|
|
89
|
+
|
|
90
|
+
### 2. Write a description
|
|
91
|
+
|
|
92
|
+
The "description" goes into the prompt. Use [assets/pet_prompt_template.md](../assets/pet_prompt_template.md)
|
|
93
|
+
for the proven pattern. In short:
|
|
94
|
+
|
|
95
|
+
> `chibi sticker of <subject>, <pose>, transparent background, soft cel-shading,
|
|
96
|
+
> playful, sticker outline, 1024x1024`
|
|
97
|
+
|
|
98
|
+
The script will wrap your description with the rest of the prompt automatically.
|
|
99
|
+
|
|
100
|
+
You can also have **MiMo write the description for you**:
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
python3 mimoskill/scripts/mimo_chat.py \
|
|
104
|
+
--image path/to/source.jpg \
|
|
105
|
+
"Describe this image as a 25-word chibi pet sticker prompt for an image generator. \
|
|
106
|
+
Use this format: 'chibi sticker of {subject}, {pose}, transparent background, \
|
|
107
|
+
soft cel-shading'."
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
Then paste the output as `--description`.
|
|
111
|
+
|
|
112
|
+
### 3. Generate states (single image vs animated)
|
|
113
|
+
|
|
114
|
+
The default `generate_pet.py` produces **one** PNG (idle). For an animated pet
|
|
115
|
+
with multiple states, run it 3 times with different action descriptions:
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
python3 mimoskill/scripts/generate_pet.py \
|
|
119
|
+
--reference src.jpg --description "chibi axolotl, calm, hands on lap" \
|
|
120
|
+
--out idle.png
|
|
121
|
+
|
|
122
|
+
python3 mimoskill/scripts/generate_pet.py \
|
|
123
|
+
--reference src.jpg --description "chibi axolotl, typing on laptop, focused expression" \
|
|
124
|
+
--out working.png
|
|
125
|
+
|
|
126
|
+
python3 mimoskill/scripts/generate_pet.py \
|
|
127
|
+
--reference src.jpg --description "chibi axolotl, hands raised in celebration, sparkles" \
|
|
128
|
+
--out done.png
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
Then point `install_pet.sh` at the directory containing all three:
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
bash mimoskill/scripts/install_pet.sh --bundle ./my-axolotl/ "axolotl-coder"
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
### 4. Restart Codex completely
|
|
138
|
+
|
|
139
|
+
This is the step people skip. Codex caches the pet list at startup:
|
|
140
|
+
|
|
141
|
+
- **CLI**: just exit and rerun `codex`
|
|
142
|
+
- **Desktop**: system tray / menu bar → **Quit** (not just close window). Relaunch.
|
|
143
|
+
|
|
144
|
+
### 5. Select the new pet
|
|
145
|
+
|
|
146
|
+
Open the pet picker (e.g. `/pet` slash command, or settings → Pets) and select
|
|
147
|
+
your new entry by the name you passed to `install_pet.sh`.
|
|
148
|
+
|
|
149
|
+
## Image gen alternatives (if you don't want to pay OpenAI)
|
|
150
|
+
|
|
151
|
+
The script supports `--provider`:
|
|
152
|
+
|
|
153
|
+
| Provider | Quality | Cost | Setup |
|
|
154
|
+
|---|---|---|---|
|
|
155
|
+
| `gpt-image-1` (default) | best | ~$0.04–0.17/image | needs OpenAI key |
|
|
156
|
+
| `pollinations` | ok | free | no setup |
|
|
157
|
+
| `replicate` | great (FLUX/SDXL) | ~$0.003/image | needs Replicate key |
|
|
158
|
+
| `local-sd` | varies | free (after setup) | needs Automatic1111/ComfyUI running locally |
|
|
159
|
+
|
|
160
|
+
Examples:
|
|
161
|
+
|
|
162
|
+
```bash
|
|
163
|
+
# Free, no key
|
|
164
|
+
python3 mimoskill/scripts/generate_pet.py --provider pollinations \
|
|
165
|
+
--description "..." --out pet.png
|
|
166
|
+
|
|
167
|
+
# Replicate FLUX-Schnell
|
|
168
|
+
export REPLICATE_API_TOKEN=r8_...
|
|
169
|
+
python3 mimoskill/scripts/generate_pet.py --provider replicate \
|
|
170
|
+
--description "..." --out pet.png
|
|
171
|
+
|
|
172
|
+
# Local Stable Diffusion (Automatic1111 with --api flag, default port 7860)
|
|
173
|
+
python3 mimoskill/scripts/generate_pet.py --provider local-sd \
|
|
174
|
+
--description "..." --out pet.png
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
## Troubleshooting
|
|
178
|
+
|
|
179
|
+
**"Authentication failed"**
|
|
180
|
+
You're using the placeholder `mimo2codex-local` key. Set `PET_OPENAI_API_KEY`
|
|
181
|
+
to a real OpenAI key for `gpt-image-1`. The MiMo key won't work for OpenAI's
|
|
182
|
+
image API.
|
|
183
|
+
|
|
184
|
+
**"Codex doesn't see my new pet"**
|
|
185
|
+
- Check the install path in the install script's output
|
|
186
|
+
- Fully quit & relaunch Codex (not just close the window)
|
|
187
|
+
- Make sure `manifest.json` is valid JSON
|
|
188
|
+
- Try copying a built-in pet's directory, replacing only the PNGs, to rule out
|
|
189
|
+
manifest schema drift
|
|
190
|
+
|
|
191
|
+
**"The image looks bad / off-character"**
|
|
192
|
+
- Iterate on the description with MiMo: "Improve this image-gen prompt for a
|
|
193
|
+
chibi pet sticker"
|
|
194
|
+
- For gpt-image-1, add `quality: "hd"` (script default is `medium`); pass
|
|
195
|
+
`--quality hd` for the high-quality 1024×1024 path
|
|
196
|
+
- For consistency across states, use `--reference` so all three calls edit the
|
|
197
|
+
same source image instead of generating from scratch
|