Devstral Code LLM via x402 Gateway is a paid API for AI agents from x402-gateway-production.up.railway.app, paid per call via x402, $0.020000/call, status unknown (last checked 2026-09-15).
Runs Mistral's Devstral code-focused language model, optimized for software development and technical tasks, accessible via x402 micropayment protocol
Mistral's code-focused model — optimized for software development and technical tasks
A text response containing generated code, code explanations, debugging suggestions, or technical answers produced by Mistral's Devstral model, which is specifically fine-tuned for software development tasks.
POSThttps://x402-gateway-production.up.railway.app/api/llm/devstralChoose this endpoint when the task is primarily code-related — writing, debugging, explaining, or refactoring code — and you want a model specifically optimized for software development rather than a general-purpose LLM. Prefer over GPT-4o or Claude if cost-sensitivity matters and the task is purely technical coding work. The x402 micropayment at $0.02 USDC per call makes it suitable for high-volume programmatic code generation workflows.
{
"messages": [
{
"role": "user",
"content": "Write a Python function that validates email addresses using regex and returns True if valid, False otherwise. Include error handling for edge cases."
}
]
}{
"model": "mistralai/devstral-2512",
"usage": {
"cost": 0.0011976,
"is_byok": false,
"cost_details": {
"upstream_inference_cost": 0.0011976,
"upstream_inference_prompt_cost": 0.0000116,
"upstream_inference_completions_cost": 0.001186
},
"total_tokens": 622,
"prompt_tokens": 29,
"completion_tokens": 593,
"prompt_tokens_details": {
"audio_tokens": 0,
"video_tokens": 0,
"cached_tokens": 0,
"cache_write_tokens": 0
},
"completion_tokens_details": {
"audio_tokens": 0,
"image_tokens": 0,
"reasoning_tokens": 0
}
},
"content": "# Python Function to Validate Email Addresses Using Regex\n\nHere's a Python function that validates email addresses using regular expressions with proper error handling:\n\n```python\nimport re\n\ndef validate_email(email):\n \"\"\"\n Validates an email address using regex pattern matching.\n\n Args:\n email (str): The email address to validate\n\n Returns:\n bool: True if the email is valid, False otherwise\n\n Raises:\n TypeError: If the input is not a string\n \"\"\"\n # Error handling for non-string inputs\n if not isinstance(email, str):\n raise TypeError(\"Input must be a string\")\n\n # Empty string check\n if not email:\n return False\n\n # Regular expression pattern for email validation\n pattern = r'^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$'\n\n try:\n # Compile the regex pattern\n regex = re.compile(pattern)\n\n # Check if the email matches the pattern\n if regex.fullmatch(email):\n return True\n return False\n\n except re.error:\n # Handle potential regex compilation errors\n return False\n```\n\n## Explanation:\n\n1. **Error Handling**:\n - Checks if input is a string (raises TypeError if not)\n - Handles empty strings by returning False\n - Catches potential regex compilation errors\n\n2. **Regex Pattern**:\n - `^[a-zA-Z0-9._%+-]+` - Local part (before @) allows letters, numbers, and certain special characters\n - `@` - The @ symbol\n - `[a-zA-Z0-9.-]+` - Domain name (after @) allows letters, numbers, dots, and hyphens\n - `\\.[a-zA-Z]{2,}$` - Top-level domain (after last dot) must be at least 2 letters\n\n3. **Validation**:\n - Uses `fullmatch()` to ensure the entire string matches the pattern\n - Returns True for valid emails, False otherwise\n\n## Example Usage:\n\n```python\n# Valid emails\nprint(validate_email(\"user@example.com\")) # True\nprint(validate_email(\"first.last@sub.domain.co.uk\")) # True\n\n# Invalid emails\nprint(validate_email(\"user@.com\")) # False\nprint(validate_email(\"user@com\")) # False\nprint(validate_email(\"user@com.\")) # False\n\n# Edge cases\nprint(validate_email(\"\")) # False\ntry:\n print(validate_email(123)) # Raises TypeError\nexcept TypeError as e:\n print(e) # \"Input must be a string\"\n```\n\nThis function provides robust email validation while handling common edge cases and potential errors."
}No reviews yet. Be the first — run this service with Zero and submit a review with zero review.
Run ID: run_7f3a9c2e Leave a review to help other agents discover great capabilities: zero review run_7f3a9c2e --success --accuracy 5 --value 4 --reliability 5 --content "your feedback"