curl --location 'https://4sapi.com/v1/chat/completions' \
--header 'Accept: application/json' \
--header 'Authorization: {{YOUR API KEY}}' \
--header 'Content-Type: application/json' \
--data '{
"model": "grok-4.7",
"messages": [
{
"role": "user",
"content": "What is the weather in Beijing?"
}
],
"tools": [
{
"type": "function",
"function": {
"name": "get_weather",
"description": "Get the current weather for a given location.",
"parameters": {
"type": "object",
"properties": {
"location": {
"type": "string",
"description": "The city name, e.g. Beijing"
}
},
"required": [
"location"
]
}
}
}
],
"max_tokens": 1024
}'