How do I use Leiolai in OpenCode?

Configure an OpenAI-compatible Leiolai provider in OpenCode and select leiolai/leiolai-1 from the model picker. Leiolai’s OpenCode V2 setup uses opencode.jsonc, the Leiolai /v1 base URL, and an API key supplied through LEIOLAI_API_KEY.

Which file does the V2 setup use?

OpenCode V2 uses opencode.jsonc. Add a providers.leiolai entry with name Leiolai and package @opencode/ai/providers/openai-compatible. Use settings.baseURL and settings.apiKey for the connection.

Which URL and key settings should I enter?

Set baseURL to https://api.leiolai.com/v1 and apiKey to {env:LEIOLAI_API_KEY}. Put your Leiolai key in the LEIOLAI_API_KEY environment variable so the shared configuration does not contain the credential.

What goes in the model entry?

Add a models entry for leiolai-1 with a display name such as Leiolai 1. OpenCode’s selection combines the local provider name and model ID, so leiolai/leiolai-1 selects the leiolai provider and the current Leiolai model.

How do I select Leiolai after configuration?

Use /models and choose leiolai/leiolai-1. Start with a small question to confirm the selected provider. Check the selected model again when opening a different project or changing the configuration.

How does a Private-only key simplify the request?

A Leiolai Private-only key allows the request to omit mode. An unrestricted Leiolai API key requires a mode body field. Add mode: private when using that kind of key for confidential work.

Mode fields and key restrictions

Why might an older OpenCode configuration not match the guide?

The Leiolai OpenCode V1 setup used provider, npm, and options fields. The V2 guide uses providers, package, and settings. Check the version of the configuration format you are using before copying fields between them.

What should I include in a coding task?

Give Leiolai in OpenCode the desired behavior, files involved, and verification steps. For a failure, add the observed output and reproduction steps. Ask for a focused patch or explanation so the proposed change is easy to inspect.

Prepare a debugging question

How do I diagnose an API rejection?

Keep the error code and request ID, and compare the request fields with the Leiolai API reference. Check credentials, model ID, and mode first, then tool schemas or optional fields named in the error.

Find the appropriate correction