Learn how to structure inputs and understand outputs when working with model responses.
Freddy accepts flexible input formats ranging from simple text strings to complex multi-modal arrays with roles, images, audio, and files. The API automatically handles conversation context, content type detection, and proper formatting.
Inputs are always provided as an array of structured items:
{
"model": "gpt-4o",
"inputs": [
{
"role": "system",
"content": "You are a helpful geography expert"
},
{
"role": "user",
"content": "What is the capital of France?"
}
]
}High-priority instructions that guide the model's behavior throughout the conversation.
When to use:
- Set behavior guidelines
- Define expertise or persona
- Provide important constraints
- Give formatting instructions
Example:
{
"role": "system",
"content": "You are a Python expert. Always include code examples. Be concise."
}End-user messages, questions, and instructions.
When to use:
- User questions
- Task descriptions
- Follow-up messages
- Most conversation inputs
Example:
{
"role": "user",
"content": "How do I sort a list in Python?"
}Previous model responses, used for conversation history or few-shot examples.
When to use:
- Conversation history
- Few-shot examples
- Guiding response style
Example:
{
"role": "assistant",
"content": "You can use the sorted() function or .sort() method."
}{
"role": "user",
"content": "First paragraph" },
{ "text": "Second paragraph"
}By file ID:
{
"role": "user",
"content": "What's in this image?",
"images": [
{ "fileId": "file_abc123" }
]
}By URL:
{
"role": "user",
"content": "Describe this image",
"images": [
{ "url": "https://example.com/image.jpg" }
]
}{
"role": "user",
"content": "Transcribe this audio",
"audio": [
{ "fileId": "file_audio123" }
]
}{
"role": "user",
"content": "Summarize this PDF",
"files": [
{ "fileId": "file_doc123" }
]
}Combine multiple content types:
{
"role": "user",
"content": "Compare these two images",
"images": [
{ "fileId": "file_img1" },
{ "fileId": "file_img2" }
]
}const response = await fetch('/v1/model/response', {
method: 'POST',
body: JSON.stringify({
model: 'gpt-4o',
inputs: [
{
role: 'system',
texts: [{ text: 'You are a helpful coding assistant' }]
},
{
role: 'user',
texts: [{ text: 'Write a function to reverse a string' }]
}
]
})
});conversation = [
{'role': 'user', 'texts': [{'text': 'Hello'}]},
{'role': 'assistant', 'texts': [{'text': 'Hi! How can I help?'}]},
{'role': 'user', 'texts': [{'text': 'Tell me about Python'}]}
]
response = requests.post(
'https://api.aitronos.com/v1/model/response',
json={'model': 'gpt-4o', 'inputs': conversation}
){
"model": "gpt-4o",
"inputs": [
{
"role": "system",
"content": "Classify sentiment as positive, negative, or neutral"
},
{
"role": "user",
"content": "I love this product!"
},
{
"role": "assistant",
"content": "Sentiment: positive"
},
{
"role": "user",
"content": "This is terrible."
},
{
"role": "assistant",
"content": "Sentiment: negative"
},
{
"role": "user",
"content": "The package arrived today."
}
]
}{
"model": "gpt-4o",
"inputs": [
{
"role": "user",
"content": "Describe this image in detail",
"images": [{ "fileId": "file_abc123" }]
}
]
}{
"id": "resp_67ccd2bed1ec8190",
"object": "response",
"created_at": 1741476542,
"status": "completed",
"model": "gpt-4o",
"output": [
{
"type": "message",
"id": "msg_67ccd2bf17f0",
"role": "assistant",
"content": [
{
"type": "output_text",
"text": "The capital of France is Paris.",
"annotations": []
}
]
}
],
"usage": {
"input_tokens": 15,
"output_tokens": 8,
"total_tokens": 23
}
}{
"output": [
{
"type": "tool_call",
"tool_name": "web_search",
"query": "latest AI news",
"result": "Recent developments include..."
},
{
"type": "message",
"role": "assistant",
"content": [
{
"type": "output_text",
"text": "Based on recent news, here's what's happening in AI..."
}
]
}
]
}# Good - clear separation
inputs = [
{'role': 'system', 'texts': [{'text': 'Be concise'}]},
{'role': 'user', 'texts': [{'text': 'Explain AI'}]}
]
# Bad - mixing in user message
inputs = [{
'role': 'user',
'texts': [{'text': 'Be concise. Explain AI'}]
}]// Good - preserves context
const messages = [...previousMessages, newMessage];
const response = await sendMessage(messages);
// Bad - loses context
const response = await sendMessage(newMessage);