← Về thư mục
skills/generate-image/scripts/generate_image.py
- ApiError · class · L92-L93 — class ApiError(RuntimeError)
- RequestRejected · class · L96-L97 — class RequestRejected(ApiError)
- find_api_key · function · L100-L143 — def find_api_key(explicit: str | None = None) -> str
- encode_reference · function · L146-L168 — def encode_reference(source: str) -> str
- request_bytes · function · L171-L231 — def request_bytes( url: str, api_key: str | None, payload: dict | None, timeout: float, retries: int = 2, accept: str = "application/json", max_bytes: int | None = None, ) -> bytes
- retry_delay · function · L234-L241 — def retry_delay(retry_after: str | None, attempt: int) -> float
- error_detail · function · L244-L264 — def error_detail(status: int, body: str) -> str
- request_json · function · L267-L274 — def request_json(url: str, api_key: str | None, payload: dict | None, timeout: float, retries: int = 2) -> Any
- fetch_catalogue · function · L277-L280 — def fetch_catalogue(timeout: float, retries: int = 2) -> dict[str, dict]
- describe_spec · function · L283-L291 — def describe_spec(spec: dict) -> str
- spec_problem · function · L294-L310 — def spec_problem(name: str, value: Any, spec: dict) -> str | None
- models_supporting · function · L313-L324 — def models_supporting(catalogue: dict[str, dict], parameter: str, value: Any = None) -> list[str]
- preflight · function · L327-L383 — def preflight(payload: dict, catalogue: dict[str, dict]) -> None
- build_payload · function · L386-L412 — def build_payload(args: argparse.Namespace) -> dict
- redacted_payload · function · L415-L428 — def redacted_payload(payload: dict) -> dict
- acceptable_suffixes · function · L431-L434 — def acceptable_suffixes(media_type: str) -> set[str]
- normalise_media_type · function · L437-L439 — def normalise_media_type(media_type: str) -> str
- output_paths · function · L442-L465 — def output_paths(requested: str | None, media_type: str, count: int) -> list[Path]
- image_bytes · function · L468-L487 — def image_bytes(item: dict, timeout: float) -> bytes | None
- save_images · function · L490-L522 — def save_images(result: dict, requested_output: str | None, timeout: float = 60.0) -> list[Path]
- format_cost · function · L525-L529 — def format_cost(cost: Any) -> str
- format_pricing · function · L532-L543 — def format_pricing(pricing: list[dict] | None) -> list[str]
- cost_lines · function · L546-L568 — def cost_lines(usage: dict) -> list[str]
- print_model · function · L571-L586 — def print_model(model: dict) -> None
- list_models · function · L589-L605 — def list_models(timeout: float, substring: str = "") -> int
- model_info · function · L608-L626 — def model_info(model_id: str, timeout: float) -> int
- main · function · L629-L748 — def main(argv: list[str] | None = None) -> int