Skip to main content
Kimi Code CLI can use GoModel as an OpenAI-compatible provider. You configure the GoModel base URL, a dedicated managed API key, and at least one model in Kimi’s ~/.kimi/config.toml file. Flow: Kimi Code CLI -> GoModel -> upstream model provider

You do not need an api.json URL

Kimi’s Custom registry (api.json) option imports a models.dev-shaped provider catalog. It is optional and is not the normal OpenAI-compatible setup path. GoModel exposes its model catalog at /v1/models, but that response uses the OpenAI model-list format rather than Kimi’s custom-registry format. Do not paste http://localhost:8080/v1/models into Kimi’s api.json prompt. Exit that prompt and use the direct configuration below instead.
If you searched for pi.json, the file name shown by Kimi is api.json. Neither file is required for this setup.

Before you start

  • Install Kimi Code CLI.
  • Choose a GoModel master key for gateway administration, for example change-me.
  • Make sure GoModel has an upstream credential for the model you want to use.

1. Run GoModel

Start GoModel with a master key and at least one upstream provider. This example uses OpenAI:
GOMODEL_MASTER_KEY is the gateway’s bootstrap and administrator credential. Do not put it in Kimi’s persistent configuration. OPENAI_API_KEY belongs to GoModel and is used only for the upstream request.

2. Create a dedicated Kimi API key

Open the GoModel dashboard at http://localhost:8080/admin/dashboard and sign in with GOMODEL_MASTER_KEY. Go to API Keys -> Create API Key, then:
  1. Name the key kimi-code.
  2. Set User Path to /agents/kimi.
  3. Leave Dashboard access disabled.
  4. Create the key and copy the sk_gom_... value. It is shown only once.
The bound user path gives Kimi its own usage and audit scope. Managed keys bind directly to a user path, while model restrictions are configured separately as gateway-wide model access policies. If you use those policies, allow only the selectors Kimi needs for /agents/kimi.
Use this managed key in Kimi, not GOMODEL_MASTER_KEY. A managed key without dashboard access can call model endpoints but cannot read audit logs, create keys, or change gateway settings. The master key bypasses that restriction.

3. Choose a model

List the models visible through GoModel:
This guide uses openai/gpt-5-mini, with a 400,000-token context window and a 128,000-token output limit. Prefer a provider-qualified ID from this response so GoModel routes the request to the intended provider.

4. Configure Kimi Code CLI

Open ~/.kimi/config.toml and add:
The alias gomodel/gpt-5-mini is local to Kimi. The model value is the exact selector Kimi sends to GoModel.
Kimi does not automatically read ordinary provider credentials such as OPENAI_API_KEY from your shell for persistent providers. In this file, api_key must contain the dedicated GoModel managed key, not the master key or an upstream provider key. Restrict access with chmod 600 ~/.kimi/config.toml.
Use the context_window value returned by GoModel as max_context_size when you configure a different model. The thinking capability and default_thinking = true match the reasoning model used here. Adjust Kimi’s capabilities to match another model. If GoModel runs on another host, replace localhost:8080. Keep /v1 in the base URL; do not append /chat/completions.

5. Validate the setup

Check the installed Kimi version:
Then run a small prompt:
The expected model response is:
You can also verify tool calling:
The final model response should be:

6. Check the traffic in GoModel

Open the GoModel dashboard audit logs: http://localhost:8080/admin/dashboard/audit Use the audit trail to confirm that Kimi is sending streaming requests to POST /v1/chat/completions and that GoModel is routing them to the selected provider. Sign in with the master key or a separate managed key that has dashboard access; the Kimi key intentionally cannot open this page.

Troubleshooting

Kimi asks for an api.json URL

You selected Kimi’s custom-registry import flow. Cancel it and edit ~/.kimi/config.toml as shown above. GoModel does not need a registry endpoint for Kimi to work.

401 Unauthorized

Make sure Kimi’s api_key matches the active sk_gom_... managed key created for Kimi. Do not put the master key or upstream provider key in Kimi’s config.

reasoning_effort is rejected

Use a model that accepts reasoning effort, declare the thinking capability, and enable default_thinking, as in the tested example. Kimi CLI 1.49.0 sends an explicit reasoning_effort value through openai_legacy; non-reasoning models can reject it.

Model not found

Copy the exact model ID from /v1/models. If more than one provider exposes the same model, use the provider-qualified ID, such as openai/gpt-5-mini.

References

Validated on August 8, 2026

This guide was validated against:
  • a local GoModel instance on http://localhost:8080
  • Kimi Code CLI 1.49.0
  • openai/gpt-5-mini through GoModel’s OpenAI-compatible Chat Completions API
Local validation confirmed:
  • Kimi accepted the documented TOML configuration with a dedicated managed key that had /agents/kimi as its user path and no dashboard access
  • kimi --quiet -p returned ok through Kimi Code CLI -> GoModel -> OpenAI
  • Kimi invoked its Shell tool and returned tool-ok through the same route
  • the Kimi key could list and call models but received 403 from the admin API
  • no GoModel application change or api.json endpoint was required
Last modified on August 8, 2026