Connect through the API
Use a compatible SDK or an HTTP request in your application.
First request
Store your key in the CLOSEROUTER_API_KEY environment variable.
cURL
export CLOSEROUTER_API_KEY="closerouter_your_key"
curl https://api.closerouter.dev/v1/chat/completions \
-H "Authorization: Bearer $CLOSEROUTER_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "openai/gpt-5.4-mini",
"messages": [
{ "role": "user", "content": "Reply with exactly: ok" }
],
"max_tokens": 16
}'Result
Abbreviated response. Read the text from choices[0].message.content; the SDK examples print it.
JSON
{
"choices": [
{
"message": {
"role": "assistant",
"content": "ok"
}
}
]
}