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

ParameterTypeRequiredDescriptionExample
promptstringThe input text/message to send to the AI model"Explain quantum computing"
providerstringAI provider to use for the request"neuroswitch", "openai", "claude"
max_tokensintegerMaximum number of tokens in the response500, 1000, 4000
temperaturefloatControls randomness in the response0.0, 0.7, 1.0
streambooleanEnable streaming responsetrue, 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

ParameterTypeDescriptionConstraints
top_pfloatNucleus sampling parameterRange: 0.0 to 1.0
frequency_penaltyfloatPenalty for frequent tokensRange: -2.0 to 2.0
presence_penaltyfloatPenalty for new tokensRange: -2.0 to 2.0
stoparraySequences where API stops generatingMax 4 sequences
seedintegerRandom seed for reproducible resultsAny 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

ParameterTypeDescriptionConstraints
filesarrayArray of files to process (images, PDFs)Max 10 files, 20MB each
files[].typestringFile type specificationSupported formats only
files[].datastringBase64 encoded file contentBase64 with data URI scheme
files[].urlstringURL 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

ParameterTypeDescriptionExample
preferencesobjectNeuroSwitch routing preferences{"priority": "quality", "domain_hint": "code"}
preferences.prioritystringOptimization priority"speed", "quality", "cost"
preferences.domain_hintstringDomain classification hint"code", "creative", "analysis"
cachebooleanEnable response cachingtrue, 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

Related Resources