{"uid":"cap_rb_72llHbGD0-8cXbdFOU","slug":"deepseek-fill-in-the-middle-fim-via-locus-x402-6280d759","name":"DeepSeek Fill-in-the-Middle (FIM) via Locus x402","description":"Frontier AI models — DeepSeek-V3 for fast chat and code, DeepSeek-R1 for deep chain-of-thought reasoning. OpenAI-compatible API format. Among the most capable and cost-efficient models available.","url":"https://deepseek.x402.paywithlocus.com/deepseek/fim","method":"POST","headers":{},"bodySchema":{"type":"object","properties":{"model":{"type":"string"},"prompt":{"type":"string"},"suffix":{"type":"string"},"max_tokens":{"type":"number"},"temperature":{"type":"number"}}},"responseSchema":{"type":"json","example":{"data":{},"payment":{"scheme":"exact","settledUsdc":"0.001000","authorizedMaxUsdc":"0.001000"},"request":{"id":"00000000-0000-4000-8000-000000000000","statusUrl":"/requests/00000000-0000-4000-8000-000000000000"},"success":true}},"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.001","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"probe","requiresHandshake":false,"reviewCount":0,"rating":{"score":"0.00","successRate":"0.00","reviews":0,"stars":null,"state":"unrated"},"availabilityStatus":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.001/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.001","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.001","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_glPKCwoSKODby99xY8TEn","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.001","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Completes code between a given prefix and suffix using DeepSeek's fill-in-the-middle capability, paid per-call via x402 micropayment protocol.","exampleAgentPrompt":"Use DeepSeek FIM to fill in the missing code between my prefix 'def calculate_total(items):' and my suffix 'return total' — generate up to 256 tokens at temperature 0.7.","exampleUseCases":[{"title":"Autocomplete function body from signature","prompt":"I have a Python function that starts with 'def parse_config(filepath):' and ends with 'return config_dict' — use DeepSeek FIM to fill in the implementation, up to 200 tokens."},{"title":"Fill missing SQL query logic","prompt":"I've got the beginning of a SQL query 'SELECT user_id, SUM(amount) FROM orders WHERE' and the end 'GROUP BY user_id HAVING SUM(amount) > 1000' — can you use DeepSeek to fill in what goes in between, max 128 tokens?"},{"title":"Complete React component JSX block","prompt":"My React component starts with 'const Card = ({ title, body }) => { return (' and closes with ');};' — use DeepSeek FIM to generate the JSX markup in between, up to 300 tokens at default temperature."}],"resultDescription":"Returns a JSON object containing the completed code (in the data field), payment details showing settled and authorized USDC amounts, a unique request ID, and a status URL for tracking the request. The filled-in code appears between the supplied prompt prefix and suffix.","failureModes":["Missing or invalid model name (must be 'deepseek-v4-pro') causes request rejection","max_tokens not provided or exceeds 384000 limit causes authorization failure","Insufficient USDC balance or payment failure via x402 protocol blocks execution","Empty or malformed prompt/suffix fields may result in poor or no completion","Rate limiting or upstream DeepSeek API unavailability causes 5xx errors"],"whenToPreferThis":"Choose this endpoint when you need fill-in-the-middle (FIM) code completion — inserting code between a known prefix and suffix — using DeepSeek's frontier model, paid per-call with no subscription via the x402 micropayment protocol. Prefer it over chat-style code generation when you have both surrounding context (prefix and suffix) and need precise code infill rather than open-ended generation. It's ideal for agentic coding workflows, editor-like autocomplete, and pay-as-you-go usage patterns.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-09-14T18:40:52.840Z","isFirstParty":false}