# DeepSeek Fill-in-the-Middle (FIM) via Locus x402

> DeepSeek Fill-in-the-Middle (FIM) via Locus x402 is a paid API for AI agents from deepseek.x402.paywithlocus.com, paid per call via x402, $0.001/call, status unknown (last checked 2026-09-14).

Completes code between a given prefix and suffix using DeepSeek's fill-in-the-middle capability, paid per-call via x402 micropayment protocol.

## Facts

- Endpoint: POST https://deepseek.x402.paywithlocus.com/deepseek/fim
- Price: $0.001/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-14
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/deepseek-fill-in-the-middle-fim-via-locus-x402-6280d759
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_rb_72llHbGD0-8cXbdFOU

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability deepseek-fill-in-the-middle-fim-via-locus-x402-6280d759 -d '<json body>'
```

Example prompt: 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.

## When to prefer this

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.

## Known failure modes

- 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

## How this service works

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.

## Output

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.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "model": {
   "type": "string"
  },
  "prompt": {
   "type": "string"
  },
  "suffix": {
   "type": "string"
  },
  "max_tokens": {
   "type": "number"
  },
  "temperature": {
   "type": "number"
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "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
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/deepseek-fill-in-the-middle-fim-via-locus-x402-6280d759/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from deepseek.x402.paywithlocus.com](https://www.zero.xyz/host/deepseek.x402.paywithlocus.com/llms.txt)
