SPB Git forge

spb/doc-api

Public
2commits 1branches 0releases
15.7 MBsize
maindefault branch
13 days agolast push
Python 88.3% TypeScript 7.6% Shell 4.1%
984 B · 12 lines shellscript
Raw Blame History
1#!/usr/bin/env bash2# STATUS: LIVE_VERIFIED — executed 2026-09-19 (exit 0 in 6.5s)3# xAI alias {"type":"code_execution"} is accepted and echoed back as code_interpreter.4set -euo pipefail5cd "$(dirname "$0")/../../../.."6source scripts/lib.sh7T=$(mktemp); trap 'rm -f "$T"' EXIT8xai POST /v1/responses -m 300 -d '{"model":"grok-4.3","store":false,"max_output_tokens":4000,"max_turns":2,"include":["code_interpreter_call.outputs"],"input":"Run print(2+2) in Python and reply with the output only.","tools":[{"type":"code_execution"}]}' > "$T"9log_request xai POST /v1/responses "$XAI_STATUS" 0.01 "example xai/tools/code-execution/code_execution.sh"10mask < "$T" | python3 -c 'import json,sys; r=json.load(sys.stdin); print("tools echo:", r["tools"]); print([ (o["type"], o.get("code"), o.get("outputs")) for o in r["output"] if o["type"]=="code_interpreter_call"]); print(next(c["text"] for o in r["output"] if o["type"]=="message" for c in o["content"]))'11[ "$XAI_STATUS" = "200" ]12