SPB Git forge

spb/doc-api

Public
2commits 1branches 0releases
15.7 MBsize
maindefault branch
14 days agolast push
Python 88.3% TypeScript 7.6% Shell 4.1%
1.2 KB · 26 lines shellscript
Raw Blame History
1#!/usr/bin/env bash2# STATUS: UNVERIFIED — no cloud credentials in this atlas; snippet follows official docs verbatim-ish3# Source: https://platform.claude.com/docs/en/build-with-claude/claude-in-microsoft-foundry (retrieved 2026-09-18)4# No secrets in this file: key read from ANTHROPIC_FOUNDRY_API_KEY; resource name from ANTHROPIC_FOUNDRY_RESOURCE.5set -eo pipefail6RESOURCE="${ANTHROPIC_FOUNDRY_RESOURCE:?set ANTHROPIC_FOUNDRY_RESOURCE}"78if [ -n "${ANTHROPIC_FOUNDRY_API_KEY:-}" ]; then9  AUTH_HEADER="api-key: ${ANTHROPIC_FOUNDRY_API_KEY}"      # x-api-key is accepted too10else11  # Microsoft Entra ID token (requires Azure CLI login and Entra auth enabled on the resource)12  AUTH_HEADER="Authorization: Bearer $(az account get-access-token --resource https://ai.azure.com --query accessToken -o tsv)"13fi1415curl -sS "https://${RESOURCE}.services.ai.azure.com/anthropic/v1/messages" \16  -H "content-type: application/json" \17  -H "${AUTH_HEADER}" \18  -H "anthropic-version: 2023-06-01" \19  -d '{20    "model": "claude-haiku-4-5",21    "max_tokens": 8,22    "messages": [{"role": "user", "content": "Reply with OK."}]23  }'24echo25# Debugging: quote both `request-id` and `apim-request-id` response headers to support (curl -i).26