# 接口配置示例 把下面其中一份 JSON 放入 `~/.dsh/settings.yaml` 的 `use-images.inbox` 字段。插件读取成功后会自动清空 `inbox`,并把正式配置写入 `use-images.routes`。 ## OpenAI 兼容的 JSON base64 接口 ```json { "dsh-media-provider": 1, "id": "my-images", "name": "My Image API", "kind": "image", "baseUrl": "https://api.example.com/v1", "path": "/images/generations", "method": "POST", "apiKeyEnv": "MY_IMAGE_API_KEY", "models": [ { "id": "image-model-1", "name": "Image Model 1" } ], "request": { "model": "{{model}}", "prompt": "{{prompt}}", "n": "{{n}}", "response_format": "b64_json", "size": "1024x1024" }, "response": { "urls": "data[*].url", "b64": "data[*].b64_json", "mime": "image/png" }, "timeoutMs": 120000 } ``` `"{{n}}"` 占满整个字符串时会保留数字类型,所以最终请求里是 `"n": 1`,不是字符串。 ## 直接返回图片字节的接口 ```json { "dsh-media-provider": 1, "id": "binary-images", "name": "Binary Image API", "kind": "image", "baseUrl": "https://api.example.com", "path": "/generate", "method": "POST", "responseMode": "binary", "apiKeyEnv": "MY_IMAGE_API_KEY", "models": ["image-model-1"], "request": { "model": "{{model}}", "prompt": "{{prompt}}" }, "extractMime": "image/png" } ``` `responseMode` 可选 `auto` / `json` / `binary`。默认 `auto` 会根据 HTTP `Content-Type` 自动判断。