1123Javayanglei/new-api-vision-proxy/vision does not have a README file

    AssistOutcome

    pub(all) enum AssistOutcome {
    PassThrough
    Rewritten(body~ : Bytes, images~ : Int, reused~ : Int)
    Failed(
    VisionFailure
    )
    }

    Outcome of inspecting/rewriting a POST /v1/chat/completions body.

    VisionSpec

    pub struct VisionSpec {
    entry_model : String
    entry_model_lower : Bytes
    entry_model_quoted : Bytes
    vision_model : String
    vision_max_tokens : Int
    vision_prompt : String
    vision_prompt_utf8 : Bytes
    vision_req_prefix : Bytes
    vision_req_suffix : Bytes
    }

    Precomputed byte templates for the configured entry/vision models and prompt.

    bad_caption_failure

    Build a 502 VisionFailure matching bad_caption in proxy.py.

    canonical_python_json_bytes

    fn canonical_python_json_bytes(v :
    Json
    ) -> Bytes

    Serialize a Json value in Python json.dumps(..., sort_keys=True) canonical ASCII format (", " / ": " separators, \uXXXX for non-ASCII) so fallback cache keys match proxy.py and the fast-path byte hash 100%.

    extract_caption_from_vision_response

    fn extract_caption_from_vision_response(raw : Bytes) -> Result[String,
    VisionFailure
    ]

    Parse the vision upstream JSON response and extract a non-empty, non-SKIP caption string (supporting both plain string and array-of-text content).

    maybe_rewrite_vision_chat

    Inspect a POST /v1/chat/completions request body; if it targets cfg.entry_model and contains user images, caption each image (via cache, coalesced in-flight slot, or fetch_vision) and splice the captions in.

    Source Files