Quickstart: ask a model a question
Send your first message to a model from the command line, and see the units it used.
This quickstart asks a model a question with curl, then reads the answer and its usage with jq.
Before you begin
Set up your environment, so AI_API_KEY and AI_URL are set.
Ask a question
Send a message
curl -s "$AI_URL/chat/completions" \ -H "Authorization: Bearer $AI_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "openai/gpt-oss-20b", "messages": [ { "role": "user", "content": "In one sentence, what is Dar es Salaam known for?" } ] }' > answer.jsonRead the answer
jq -r '.choices[0].message.content' answer.jsonSee what it used
jq '.usage' answer.jsonprompt_tokensandcompletion_tokensare the tokens the model read and wrote, andunitsis the AI units the call used.
What’s next
- Use OpenAI’s SDKs to call models from your app.
- Stream answers to show them as they are written.
- Track usage and set limits before you go live.
Last updated