DEV Community

Nagiport
Nagiport

Posted on

Setting Up the OpenAI-Compatible Nagiport API in OpenCode

Nagiport API is an OpenAI-compatible API that lets you use multiple models through a single API key and a single endpoint. This guide shows how to set it up in OpenCode, from registration and issuing an API key to the opencode.json configuration, model limits, and pricing.

All prices and plan details below are from the official pricing page: https://nagiport.com/ja/pricing/

1. Register and issue an API key

  1. Open the Nagiport console at https://app.nagiport.com/auth/sign-in and sign up with your email address.
  2. Verify your email address using the verification email.
  3. Choose a plan and complete payment (see the pricing section below). You apply for a plan directly from the plan card on the pricing page — click "このプランで申し込む" on the plan you want.
  4. In the console, issue an API key. Copy it right away: the key is shown only once. Treat it like a password and never share it or commit it to a repository.

There are no extra charges beyond your plan's allowance. If you use up your allowance, usage stops; the service does not bill you for overuse.

2. Configure OpenCode with opencode.json

Create or edit opencode.json in your project (or in your OpenCode config directory) and add Nagiport as an OpenAI-compatible provider. Set the API key as an environment variable, for example NAGIPORT_API_KEY, and set baseURL to the OpenAI-compatible endpoint shown in the Nagiport console after you issue your key. Use the exact model ID shown in the console for the model you want.

{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "nagiport": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "Nagiport API",
      "options": {
        "baseURL": "<the OpenAI-compatible endpoint shown in the Nagiport console>",
        "apiKey": "{env:NAGIPORT_API_KEY}"
      },
      "models": {
        "glm-5.3-flash-abliterated": {
          "name": "GLM 5.3 Flash Abliterated",
          "limit": {
            "context": 262144,
            "output": 131072
          }
        }
      }
    }
  }
}
Enter fullscreen mode Exit fullscreen mode

Then start OpenCode and select the Nagiport model. If the model does not appear, check that the API key is set, that baseURL matches the console, and that the model ID is exactly as shown in the console.

3. Model limits: GLM example

For GLM 5.3 Flash Abliterated, the limits are:

  • Output limit: 131,072 tokens
  • Context limit: 262,144 tokens

Keep these limits in mind for long coding sessions: a large context window helps with big codebases, but very long outputs should be split into smaller steps.

4. Pricing

Prices below are per 1 million tokens, tax included (JPY), from the official pricing page.

Plans

Plan Monthly fee (tax incl.) Allowance
Starter ¥3,000 (approx. $18.75) ¥3,000
Standard ¥6,000 (approx. $37.50) ¥6,000
Pro ¥9,000 (approx. $56.25) ¥9,000

All plans include all 4 models, the same per-token rates, a cache discount, and the OpenAI-compatible API. The plan fee is used as your usage allowance, and there are no extra charges beyond the cap.

Per-token rates (per 1M tokens, tax incl.)

Model Input Cached input Output
DeepSeek V4.1 Flash 1017 Fast ¥4 ¥0.75 ¥30
Kimi K3.1 Pro ¥140 ¥60 ¥950
Qwen3.8 27B Abliterated ¥200 ¥25 ¥900
GLM 5.3 Flash Abliterated ¥50 ¥10 ¥200

Input starts at ¥4 per 1 million tokens, so the cheapest model is a good fit for everyday coding assistance in OpenCode, while the other models are available for heavier tasks through the same key.

Rollover

If you do not use up your allowance, the unused part rolls over to the next month. Rolled-over allowance is consumed first, and it cannot be rolled over again to the month after next.

5. Apply from the pricing page

You can apply directly from the pricing page (https://nagiport.com/ja/pricing/): choose a plan card and click "このプランで申し込む". That takes you to the console, where you complete payment and issue your API key.

Summary

  1. Sign up in the Nagiport console, verify your email, choose a plan, and issue an API key.
  2. Add Nagiport as an OpenAI-compatible provider in opencode.json, using the endpoint and model ID shown in the console.
  3. Pick a model that fits your task and budget — input starts at ¥4 per 1M tokens, and unused allowance rolls over to the next month.

Happy coding with OpenCode and Nagiport API!

Top comments (0)