API Parameters
Complete reference for all API parameters, types, constraints, and usage examples. Fine-tune your AI requests for optimal results.
Core Parameters
Essential parameters for all requests
Advanced Options
Fine-tuning and control parameters
File Parameters
Image and document processing
NeuroSwitch
Intelligent routing options
Core Parameters
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
prompt | string | The input text/message to send to the AI model | "Explain quantum computing" | |
provider | string | — | AI provider to use for the request | "neuroswitch", "openai", "claude" |
max_tokens | integer | — | Maximum number of tokens in the response | 500, 1000, 4000 |
temperature | float | — | Controls randomness in the response | 0.0, 0.7, 1.0 |
stream | boolean | — | Enable streaming response | true, false |
Example Request
Basic Request
{ "prompt": "Explain machine learning", "provider": "neuroswitch", "max_tokens": 500, "temperature": 0.7 }
Advanced Request
{ "prompt": "Write a creative story", "provider": "neuroswitch", "max_tokens": 1000, "temperature": 0.9, "top_p": 0.95, "frequency_penalty": 0.5, "stop": ["THE END"], "preferences": { "priority": "quality", "domain_hint": "creative" } }
Advanced Parameters
Parameter | Type | Description | Constraints |
---|---|---|---|
top_p | float | Nucleus sampling parameter | Range: 0.0 to 1.0 |
frequency_penalty | float | Penalty for frequent tokens | Range: -2.0 to 2.0 |
presence_penalty | float | Penalty for new tokens | Range: -2.0 to 2.0 |
stop | array | Sequences where API stops generating | Max 4 sequences |
seed | integer | Random seed for reproducible results | Any positive integer |
Parameter Interaction
Temperature and top_p both control randomness. Use one or the other, not both. Higher values increase creativity but may reduce coherence.
File Upload Parameters
Parameter | Type | Description | Constraints |
---|---|---|---|
files | array | Array of files to process (images, PDFs) | Max 10 files, 20MB each |
files[].type | string | File type specification | Supported formats only |
files[].data | string | Base64 encoded file content | Base64 with data URI scheme |
files[].url | string | URL to file (alternative to data) | Publicly accessible URL |
File Upload Example
{ "prompt": "Analyze this chart and summarize the trends", "provider": "neuroswitch", "files": [ { "type": "image", "data": "data:image/jpeg;base64,/9j/4AAQSkZJRg...", "filename": "sales_chart.jpg" } ], "max_tokens": 1000 }
NeuroSwitch Parameters
Parameter | Type | Description | Example |
---|---|---|---|
preferences | object | NeuroSwitch routing preferences | {"priority": "quality", "domain_hint": "code"} |
preferences.priority | string | Optimization priority | "speed", "quality", "cost" |
preferences.domain_hint | string | Domain classification hint | "code", "creative", "analysis" |
cache | boolean | Enable response caching | true, false |
NeuroSwitch Optimization
NeuroSwitch analyzes your prompt and automatically selects the best model. Use preferences to guide routing decisions for specialized use cases.
Parameter Validation
Common Validation Errors
400: Missing Required Parameter
The 'prompt' parameter is required for all requests
422: Invalid Parameter Value
Parameter value is outside acceptable range
413: Request Too Large
Prompt or files exceed maximum size limits
Validation Tips
Validate parameter types before sending
Check constraints for numeric parameters
Use JSON schema validation in your code
Test with edge cases and boundary values