Make Your First Request
This test checks only the network, API key, group, and model. Leave streaming, tools, images, proxies, and long prompts for later.
1. Set the key
# Replace sk-your-key with the complete value copied from the key page.
export SPRELAY_API_KEY="sk-your-key"# This sets the key only for the current PowerShell window.
$env:SPRELAY_API_KEY = "sk-your-key"2. Send the request
The examples do not inspect or print the model's reply. When the server successfully completes the request, the local script prints a fixed success message. No extra tool such as jq is required.
# --fail returns a failure status for HTTP 4xx/5xx responses.
# --silent --show-error hides progress while preserving error messages.
# --output /dev/null discards the model response body.
if curl --fail --silent --show-error \
https://sprelaytoken.com/v1/chat/completions \
-H "Authorization: Bearer $SPRELAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-5.6-sol",
"messages": [
{"role": "user", "content": "Reply with OK"}
]
}' \
--output /dev/null
then
printf '%s\n' '--------Connection successful--------'
else
printf '%s\n' '--------Request failed--------' >&2
fi# Build the two HTTP headers. Bearer must be followed by one space.
$headers = @{
Authorization = "Bearer $env:SPRELAY_API_KEY"
"Content-Type" = "application/json"
}
# Convert the PowerShell object to the JSON body expected by the API.
# The prompt triggers a minimal generation; its reply is not printed.
$body = @{
model = "gpt-5.6-sol"
messages = @(
@{ role = "user"; content = "Reply with OK" }
)
} | ConvertTo-Json -Depth 5
# Discard the response body and print a fixed message only after success.
# On failure, catch prints the specific PowerShell error.
try {
Invoke-RestMethod `
-Uri "https://sprelaytoken.com/v1/chat/completions" `
-Method Post `
-Headers $headers `
-Body $body | Out-Null
Write-Output "--------Connection successful--------"
}
catch {
Write-Error "Request failed: $($_.Exception.Message)"
}Authorization identifies the account, Content-Type declares JSON, model selects the route, and messages holds the conversation. JSON does not support comments, so preserve its quotes, commas, braces, and brackets when editing.
3. Confirm success
After a successful HTTP request, the terminal prints only:
--------Connection successful--------This message is produced by the local script after the HTTP request completes; it does not depend on the model following the prompt. If it does not appear, check for a duplicated /v1, a missing space after Bearer, an expired or exhausted key, a group that does not support the model, or a model ID that does not exactly match GET /v1/models.
Continue with Client Setup using the next-page link below.
