Meldport

OpenCode: model API costs and setup

OpenCode documents custom OpenAI-compatible providers using the Chat Completions adapter. Configure the provider and model explicitly rather than assuming model discovery.

Custom Chat Completions configuration. Documentation checked 2026-11-06.

Reference release: OpenCode 1.19.5. Inspect the pinned release. A reference release is distinct from a verified installed-client run; use the validation steps below for your exact model and mode.

Protocol and setup checks

Steps below are per vendor documentation. Read the official OpenCode documentation.

  1. Create a dedicated API key in the Meldport console and put it in MELDPORT_API_KEY in your local environment.
  2. Merge the example below into opencode.json. Select the exact published model ID shown in the example, or replace both model entries with another catalog ID.
  3. Open OpenCode, select the configured model with /models, then validate one short response, streaming, and one tool round trip. Review usage before increasing context or output limits.

Configuration example

This uses one currently published tool-capable model as an illustration, not a quality ranking. The output cap is an example starting budget. Review settings for your task.

{
  "$schema": "https://opencode.ai/config.json",
  "model": "meldport/meldport/deepseek-v4.1-flash",
  "provider": {
    "meldport": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "Meldport",
      "options": {
        "baseURL": "https://dev-api.meldport.com/v1",
        "apiKey": "{env:MELDPORT_API_KEY}"
      },
      "models": {
        "meldport/deepseek-v4.1-flash": {
          "name": "DeepSeek V4.1 Flash",
          "limit": {
            "context": 1000000,
            "output": 512
          }
        }
      }
    }
  }
}

Verified request in OpenCode

On 6 November 2026, OpenCode 1.19.5 used the custom Chat Completions adapter with meldport/deepseek-v4.1-flash. It sent two authenticated streaming requests for one prompt and displayed text from a local test endpoint. This check covers fixture text and stream handling. Check actual request counts and Usage before estimating what an agent prompt costs in production.

Troubleshoot one request at a time

  • For 401 or a scope refusal, check the dedicated key, environment, email verification and inference permission. Do not expose the key in logs.
  • For a missing model or endpoint, compare the full published API ID and the base URL ending in /v1. A request to /v1/responses or /v1/messages is a protocol mismatch, not proof that the key is wrong.
  • For a free allowance or wallet refusal, check the shared pool and both fallback permissions. Another free model uses the same pool.
  • For 429, inspect the reported limit and Retry-After. Reduce parallel agent turns and apply bounded delays instead of an unlimited retry loop.
  • After a timeout, interrupted stream or reconciliation status, inspect Usage and the request reference before resending. Provider work and charges can continue after the client disconnects. No automatic refund or universally safe retry is promised.

Use non-sensitive test content and a read-only task first. A text answer alone does not validate streaming, tool argument decoding, matching tool-result IDs, image inputs or every feature of the agent. Compare the bounded non-streaming n8n workflow when you only need one HTTP request.

Calculate cost before comparing savings

For DeepSeek V4.1 Flash, verified on 2026-11-06, the listed uncached rates are $0.045 input and $0.18 output per million tokens. An illustrative 100,000 input plus 10,000 output tokens costs $0.006300, before minimum charges, caching, retries, and any other fees. This does not establish that the model works with OpenCode.

Repeat the calculation using the same token counts and model at another provider. Savings exist only when that comparable total is higher. A lower rate does not establish equal quality, latency, or fewer retries.

Compare current token prices, review Meldport's API contract, and plan a task budget.

After checking the documented setup and your budget, create a dedicated Meldport API key in your account. Paid IDs require their corresponding funding; eligible free aliases use the shared allowance and optional wallet fallback. Validate the integration before committing to a workload.