SPB Git

Repository Public

list_models.sh 2.3 KB 53 lines shellscript

1#!/usr/bin/env bash2# =============================================================================3#                  SP BOUCHER | INFRASTRUCTURE & AUTOMATION4#             ARTIFICIAL INTELLIGENCE • FINANCE • ENGINEERING5# =============================================================================6#7# Project          : API Atlas8# File             : examples/xai/images/list_models.sh9# Module           : examples10# Repository       : https://git.spboucher.ai/doc-api11# Created          : 2026-09-1912# Last Modified    : 2026-09-1913#14# Author           : Simon-Pierre Boucher15# Position         : Professor of Finance16# Institution      : Université du Québec en Outaouais (UQO)17# Organization     : SP Boucher18# Website          : https://spboucher.ai19# Git              : https://git.spboucher.ai20#21# Preferred Contact: contact@spboucher.ai22# Technical Contact: dev@spboucher.ai23# Security/Admin   : admin@spboucher.ai24#25# Copyright (c) 202626# Simon-Pierre Boucher27# All rights reserved where applicable. This file is governed by the28# applicable project license, copyright notices and relevant law.29# Existing third-party rights and notices remain unaffected.30#31# License          : None specified (no license file in this repository)32#33# Do not embed credentials, private keys, access tokens,34# certificates or confidential personal information.35#36# =============================================================================37# END OF SP BOUCHER SOURCE HEADER38# =============================================================================3940# STATUS: LIVE_VERIFIED 2026-09-18 (200; 3 image models incl. the per-tier pricing matrix of grok-imagine-image-2.0). Free.41# Usage: bash examples/xai/images/list_models.sh42set -euo pipefail43cd "$(dirname "$0")/../../.."44source scripts/lib.sh45body=$(mktemp)46xai GET /v1/image-generation-models > "$body"47log_request xai GET /v1/image-generation-models "$XAI_STATUS" 0 "example images/list_models.sh"48echo "HTTP $XAI_STATUS"49python3 -c 'import sys,json; r=json.load(sys.stdin)50for m in r["models"]:51    print(m["id"], "aliases=", m["aliases"], "max_prompt=", m["max_prompt_length"], "image_price_usd=", m["image_price"]/1e10)52    for t in m.get("pricing", []): print("   ", t["quality"], t["resolution"], "$%.2f" % (t["price_per_image"]/1e10))' < "$body"53
Files main
Menu

Theme