Skip to content

Instantly share code, notes, and snippets.

@mostlyfine
Created August 8, 2025 03:25
Show Gist options
  • Select an option

  • Save mostlyfine/9bcf1047d1c978946df6179e2f97e322 to your computer and use it in GitHub Desktop.

Select an option

Save mostlyfine/9bcf1047d1c978946df6179e2f97e322 to your computer and use it in GitHub Desktop.
#!/bin/sh
# https://learn.microsoft.com/ja-jp/azure/ai-foundry/openai/reference
API_VERSION=2024-10-21
curl -s "${AZURE_OPENAI_ENDPOINT}/openai/deployments/${AZURE_OPENAI_DEPLOYMENT_NAME}/chat/completions?api-version=${API_VERSION}" \
-H "Content-Type: application/json" \
-H "api-key: ${AZURE_OPENAI_API_KEY}" \
-d "{
\"messages\":[
{\"role\": \"system\", \"content\": \"Always reply in Japanese.\"},
{\"role\": \"user\", \"content\": \"${1}\"}
],
\"max_tokens\": 800
}" | jq -r '.choices[0].message.content // .error.message'
# -d options:
# temperature: 0.3
# top_p: 1
# max_tokens: 300
# presence_penalty: 0.5
# frequency_penalty: 0.5
# stream: true
# stop: null
# n: 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment