The chat completions API is stateless — the model has no memory between requests. To have a multi-turn conversation, you maintain a messages array on your side and send the full history with each request.
Each message has a role and content:
"system"— sets the model's behavior and personality. Typically the first message in the array."user"— the human's input."assistant"— the model's previous responses. You include these so the model has context of what it already said.
Here's what a multi-turn conversation looks like in practice:
# First request
curl https://api.blockchain.info/ai/api/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $JUNE_API_KEY" \
-d '{
"model": "blockchain/june",
"messages": [
{ "role": "system", "content": "You are a helpful assistant." },
{ "role": "user", "content": "What is Bitcoin?" }
]
}'
# Second request — include the assistant's reply and the next question
curl https://api.blockchain.info/ai/api/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $JUNE_API_KEY" \
-d '{
"model": "blockchain/june",
"messages": [
{ "role": "system", "content": "You are a helpful assistant." },
{ "role": "user", "content": "What is Bitcoin?" },
{ "role": "assistant", "content": "Bitcoin is a decentralized digital currency..." },
{ "role": "user", "content": "How does mining work?" }
]
}'For the full chat completions specification, see the OpenAI API reference — June's API is fully compatible.