تولید متن
cURL · chat completions
BASE_URL="${OPENAI_BASE_URL:-https://aistudio.shekarchi-app.ir}"
curl -sS "$BASE_URL/v1/chat/completions" \
-H 'Content-Type: application/json' \
-d '{
"model": "chatgpt/gpt-5.6-thinking-off",
"messages": [
{"role": "system", "content": "Answer briefly."},
{"role": "user", "content": "What is the capital of Iran?"}
]
}' | jq -r 'if .error then error(.error.message) else .choices[0].message.content end'Python · chat completions
import json
import os
import urllib.request
base_url = os.getenv("OPENAI_BASE_URL", "https://aistudio.shekarchi-app.ir")
payload = {
"model": "chatgpt/gpt-5.6-thinking-off",
"messages": [{"role": "user", "content": "پایتخت ایران چیست؟"}],
}
request = urllib.request.Request(
f"{base_url}/v1/chat/completions",
data=json.dumps(payload).encode(),
headers={"Content-Type": "application/json"},
method="POST",
)
with urllib.request.urlopen(request, timeout=240) as response:
result = json.load(response)
print(result["choices"][0]["message"]["content"])