{"uid":"cap_qPOOEXmHn9yda4guwu_X3","slug":"x402-gateway-production-up-railway-app-b30700f6","name":"DeepSeek Chat LLM via x402 Gateway","description":"DeepSeek's flagship chat model — strong open-source reasoning and coding at low cost","url":"https://x402-gateway-production.up.railway.app/api/llm/deepseek?utm_source=zero.xyz","method":"POST","headers":{},"bodySchema":{"type":"object","$schema":"https://json-schema.org/draft/2020-12/schema","required":["input"],"properties":{"input":{"type":"object","required":["type","bodyType","body","method"],"properties":{"body":{"type":"object","required":["messages"],"properties":{"seed":{"type":"integer","description":"Model-supported seed; see /docs/llm-capabilities.md."},"stop":{"oneOf":[{"type":"string"},{"type":"array","items":{"type":"string"},"maxItems":4}],"description":"Model-supported stop; see /docs/llm-capabilities.md."},"min_p":{"type":"number","description":"Model-supported min_p; see /docs/llm-capabilities.md."},"tools":{"type":"array","items":{"type":"object","required":["function"],"properties":{"type":{"enum":["function"],"type":"string"},"function":{"type":"object","properties":{"name":{"type":"string"},"strict":{"type":"boolean"},"parameters":{"type":"object"},"description":{"type":"string"}}}}},"description":"Client-executed function definitions; return results using role=tool and tool_call_id."},"top_k":{"type":"integer","description":"Model-supported top_k; see /docs/llm-capabilities.md."},"top_p":{"type":"number","description":"Model-supported top_p; see /docs/llm-capabilities.md."},"stream":{"type":"boolean","description":"Return live OpenAI-compatible SSE after payment settlement."},"messages":{"type":"array","items":{"type":"object","anyOf":[{"required":["content"]},{"required":["tool_calls"]}],"required":["role"],"properties":{"name":{"type":"string"},"role":{"enum":["system","developer","user","assistant","tool"],"type":"string"},"content":{"oneOf":[{"type":"string"},{"type":"null"},{"type":"array","items":{"type":"object","required":["type"],"properties":{"type":{"enum":["text"],"type":"string"}},"additionalProperties":true},"maxItems":100,"minItems":1}]},"refusal":{"type":["string","null"]},"reasoning":{"type":"string"},"tool_calls":{"type":"array","items":{"type":"object"}},"annotations":{"type":"array","items":{"type":"object"}},"tool_call_id":{"type":"string"},"cache_control":{"type":"object"},"reasoning_details":{"type":"array","items":{"type":"object"}}},"additionalProperties":false},"maxItems":100,"minItems":1,"description":"Text or model-supported multimodal messages; assistant tool calls may have null content"},"logit_bias":{"type":"object","description":"Model-supported logit_bias; see /docs/llm-capabilities.md."},"max_tokens":{"type":"integer","example":1024,"description":"Total output budget, including reasoning. Use this or max_completion_tokens."},"temperature":{"type":"number","description":"Model-supported temperature; see /docs/llm-capabilities.md."},"tool_choice":{"oneOf":[{"enum":["auto","none","required"],"type":"string"},{"type":"object"}],"description":"Model-supported tool_choice; see /docs/llm-capabilities.md."},"stream_options":{"type":"object","description":"Optional include_usage boolean; usage is always requested upstream."},"response_format":{"type":"object","description":"Model-supported response_format; see /docs/llm-capabilities.md."},"presence_penalty":{"type":"number","description":"Model-supported presence_penalty; see /docs/llm-capabilities.md."},"frequency_penalty":{"type":"number","description":"Model-supported frequency_penalty; see /docs/llm-capabilities.md."},"repetition_penalty":{"type":"number","description":"Model-supported repetition_penalty; see /docs/llm-capabilities.md."},"max_completion_tokens":{"type":"integer","description":"Alias for total output budget; bounded by model maxOutputTokens."}},"additionalProperties":false},"type":{"type":"string","const":"http"},"method":{"enum":["POST"],"type":"string"},"bodyType":{"enum":["json","form-data","text"],"type":"string"}},"additionalProperties":false},"output":{"type":"object","required":["type"],"properties":{"type":{"type":"string"},"example":{"type":"object","required":["choices","content"],"properties":{"model":{"type":"string"},"usage":{"type":"object","description":"Provider token and usage accounting, when returned."},"choices":{"type":"array","items":{"type":"object","properties":{"index":{"type":"integer"},"message":{"type":"object","properties":{"role":{"type":"string"},"content":{"type":["string","null"]},"tool_calls":{"type":"array","items":{"type":"object"}}}},"finish_reason":{"type":["string","null"]}}}},"content":{"type":"string","description":"Convenience copy of the first assistant message's text."}}}}}}},"responseSchema":null,"example":{"request":{"messages":[{"role":"user","content":"Write a Python function that parses a CSV file and returns a list of dictionaries, with error handling for missing or malformed rows."}]},"response":{"model":"deepseek/deepseek-chat-v3","usage":{"cost":0.0005612754,"is_byok":false,"cost_details":{"upstream_inference_cost":0.0005612754,"upstream_inference_prompt_cost":0.000006006,"upstream_inference_completions_cost":0.0005552694},"total_tokens":724,"prompt_tokens":30,"completion_tokens":694,"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 Parse CSV File into List of Dictionaries\n\nHere's a robust Python function that parses a CSV file and returns a list of dictionaries, with comprehensive error handling:\n\n```python\nimport csv\nfrom typing import List, Dict, Optional\n\ndef parse_csv_to_dicts(file_path: str, \n                      delimiter: str = ',',\n                      skip_errors: bool = True) -> List[Dict[str, str]]:\n    \"\"\"\n    Parses a CSV file and returns a list of dictionaries.\n    \n    Args:\n        file_path: Path to the CSV file\n        delimiter: Character used to separate fields (default: ',')\n        skip_errors: Whether to skip malformed rows (True) or raise exception (False)\n    \n    Returns:\n        List of dictionaries where keys are column headers and values are row values\n    \n    Raises:\n        FileNotFoundError: If the file doesn't exist\n        csv.Error: If skip_errors=False and a CSV parsing error occurs\n    \"\"\"\n    result = []\n    \n    try:\n        with open(file_path, mode='r', encoding='utf-8') as csv_file:\n            reader = csv.DictReader(csv_file, delimiter=delimiter)\n            \n            for row_number, row in enumerate(reader, start=1):\n                try:\n                    # Skip empty rows\n                    if not any(row.values()):\n                        continue\n                        \n                    # Convert empty strings to None for consistency\n                    processed_row = {\n                        key: value if value != '' else None\n                        for key, value in row.items()\n                    }\n                    \n                    result.append(processed_row)\n                    \n                except Exception as e:\n                    if not skip_errors:\n                        raise csv.Error(f\"Error processing row {row_number}: {str(e)}\")\n                    # Otherwise silently skip the error row\n                    \n    except FileNotFoundError:\n        raise FileNotFoundError(f\"The file {file_path} does not exist\")\n    except csv.Error as e:\n        raise csv.Error(f\"CSV parsing error: {str(e)}\")\n    except Exception as e:\n        raise Exception(f\"Unexpected error: {str(e)}\")\n    \n    return result\n```\n\n## Features\n\n1. **Error Handling**:\n   - Handles missing files\n   - Handles malformed CSV rows\n   - Option to skip errors or raise exceptions\n\n2. **Data Processing**:\n   - Uses first row as dictionary keys (headers)\n   - Converts empty strings to `None` for consistency\n   - Skips completely empty rows\n\n3. **Flexibility**:\n   - Customizable delimiter (works with TSV files too)\n   - Type hints for better code documentation\n\n## Usage Example\n\n```python\ntry:\n    data = parse_csv_to_dicts('data.csv')\n    for row in data:\n        print(row)\nexcept Exception as e:\n    print(f\"Error processing file: {e}\")\n```\n\n## Alternative Version (Strict Typing)\n\nFor Python 3.9+ with stricter typing:\n\n```python\nfrom typing import List, Dict, Union, Optional\n\ndef parse_csv_to_dicts(file_path: str, \n                      delimiter: str = ',',\n                      skip_errors: bool = True) -> List[Dict[str, Optional[str]]]:\n    # ... (same implementation as above)\n```\n\nThis version makes it clear that dictionary values can be either strings or None."}},"exampleRequest":{"messages":[{"role":"user","content":"Write a Python function that parses a CSV file and returns a list of dictionaries, with error handling for missing or malformed rows."}]},"tags":["x402"],"displayCostAmount":"0.005000","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"settled","requiresHandshake":false,"reviewCount":1,"rating":{"score":"1.00","successRate":"1.00","reviews":1,"stars":"5.0","state":"rated"},"availabilityStatus":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.005000/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.005","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.005","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_wZ_E_JaEGa5A_JvVd6Ljd","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.005","costPer":"request","priority":0,"asset":null,"unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Sends a prompt to DeepSeek's flagship chat model and returns a text completion, optimized for reasoning and coding tasks at low cost.","exampleAgentPrompt":"Ask DeepSeek to write me a Python function that parses a CSV file and returns a list of dictionaries, with error handling for missing or malformed rows.","exampleUseCases":[{"title":"Low-cost bulk code review automation","prompt":"Use DeepSeek to review this Python function I wrote and suggest optimizations for performance and readability. Then generate a refactored version with inline comments explaining each change."},{"title":"Reasoning through complex system design","prompt":"Walk me through the architecture for a distributed caching layer using DeepSeek. I need it to explain trade-offs between Redis and Memcached, then provide pseudocode for implementing consistent hashing."},{"title":"High-volume customer question answering","prompt":"Have DeepSeek answer these 50 technical support questions from our users about API rate limiting and error handling. Return structured responses so I can review and publish the top answers to our FAQ."}],"resultDescription":"Returns a text completion from DeepSeek's flagship chat model, which may include reasoning, code, or natural language responses based on the input prompt.","failureModes":["Invalid or missing prompt returns a 400 error","Payment failure or insufficient USDC balance blocks the request","Model overload or rate limiting returns a 429 or 503 error","Malformed request body causes a 422 validation error","Context length exceeded if prompt is too long"],"whenToPreferThis":"Choose this endpoint when you need strong open-source reasoning or coding capabilities at a very low cost ($0.005 per call). Ideal for high-volume agentic tasks, software engineering assistance, or when you want DeepSeek's model specifically over OpenAI or Mistral alternatives available on the same gateway.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":3,"lastUsedAt":"2026-08-19T22:59:46.573Z","lastSuccessfullyRanAt":"2026-08-19T22:59:46.573Z","lastHealthCheckAt":"2026-10-11T00:42:07.703Z","isFirstParty":false,"canonicalSlug":"x402-gateway-production-up-railway-app-b30700f6"}