AI_APICallError: ak is not exist: xxx #718

Closed
opened 2026-02-16 17:28:01 -05:00 by yindo · 7 comments
Owner

Originally created by @lili21 on GitHub (Jul 15, 2025).

Originally assigned to: @thdxr on GitHub.

I am trying to use a custom provider, and here is my config

{
  "$schema": "https://opencode.ai/config.json",
  "theme": "opencode",
  "provider": {
    "openapi": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "openapi",
      "options": {
        "baseURL": "https://custom-provider.example.com",
        "apiKey": "xxx"
      },
      "models": {
        "Doubao-Seed-1.6": {
          "name": "Doubao-Seed-1.6"
        }
      }
    }
  },
  "model": "openapi/Doubao-Seed-1.6",
  "autoshare": false,
  "autoupdate": true
}
Originally created by @lili21 on GitHub (Jul 15, 2025). Originally assigned to: @thdxr on GitHub. I am trying to use a custom provider, and here is my config ```json { "$schema": "https://opencode.ai/config.json", "theme": "opencode", "provider": { "openapi": { "npm": "@ai-sdk/openai-compatible", "name": "openapi", "options": { "baseURL": "https://custom-provider.example.com", "apiKey": "xxx" }, "models": { "Doubao-Seed-1.6": { "name": "Doubao-Seed-1.6" } } } }, "model": "openapi/Doubao-Seed-1.6", "autoshare": false, "autoupdate": true } ```
yindo closed this issue 2026-02-16 17:28:01 -05:00
Author
Owner

@thdxr commented on GitHub (Jul 16, 2025):

not enough info here

@thdxr commented on GitHub (Jul 16, 2025): not enough info here
Author
Owner

@lili21 commented on GitHub (Jul 23, 2025):

Below are parts of the logs

INFO  2025-07-24T03:35:33 +0ms service=app name=mode registering service
ERROR 2025-07-24T03:35:34 +533ms service=installation message=API rate limit exceeded for 63.216.146.178. (But here's the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.) documentation_url=https://docs.github.com/rest/overview/resources-in-the-rest-api#rate-limiting GitHub API error
INFO  2025-07-24T03:35:34 +132ms service=server method=GET path=/config request

...

INFO  2025-07-24T03:36:08 +1465ms service=bus type=storage.write publishing
INFO  2025-07-24T03:36:08 +0ms service=bus type=message.part.updated publishing
INFO  2025-07-24T03:36:08 +0ms service=session session=ses_7c57f7cb4ffeJSVhDSCReojG6k type=error part
ERROR 2025-07-24T03:36:08 +1ms service=session session=ses_7c57f7cb4ffeJSVhDSCReojG6k error=AI_APICallError: ak not exist: B4jwK
INFO  2025-07-24T03:36:08 +0ms service=bus type=session.error publishing
INFO  2025-07-24T03:36:08 +1ms service=bus type=storage.write publishing
INFO  2025-07-24T03:36:08 +0ms service=bus type=message.updated publishing
INFO  2025-07-24T03:36:08 +0ms service=session session=ses_7c57f7cb4ffeJSVhDSCReojG6k sessionID=ses_7c57f7cb4ffeJSVhDSCReojG6k unlocking
INFO  2025-07-24T03:36:08 +0ms service=bus type=session.idle publishing
INFO  2025-07-24T03:36:08 +0ms service=server duration=10667 response
INFO  2025-07-24T03:36:08 +1ms service=server method=POST path=/log request
INFO  2025-07-24T03:36:08 +0ms service=tui message=msg_83a808e10001cHB70NilfZ7MRg part=prt_83a80ad04001dLa2TAXe5uJFtV message part updated
INFO  2025-07-24T03:36:08 +0ms service=server duration=0 response
INFO  2025-07-24T03:36:08 +0ms service=server method=POST path=/log request
DEBUG 2025-07-24T03:36:08 +0ms service=tui messageCount=2 timeTakenMs=0 messages.renderView
INFO  2025-07-24T03:36:08 +0ms service=server duration=0 response
INFO  2025-07-24T03:36:08 +1ms service=server method=POST path=/log request
ERROR 2025-07-24T03:36:08 +0ms service=tui message=AI_APICallError: ak not exist: B4jwK name=UnknownError Server error
INFO  2025-07-24T03:36:08 +0ms service=server duration=0 response
INFO  2025-07-24T03:36:08 +4ms service=server method=POST path=/log request
DEBUG 2025-07-24T03:36:08 +0ms service=tui messageCount=2 timeTakenMs=0 messages.renderView
INFO  2025-07-24T03:36:08 +0ms service=server duration=0 response

hope it is useful.

@lili21 commented on GitHub (Jul 23, 2025): Below are parts of the logs ```bash INFO 2025-07-24T03:35:33 +0ms service=app name=mode registering service ERROR 2025-07-24T03:35:34 +533ms service=installation message=API rate limit exceeded for 63.216.146.178. (But here's the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.) documentation_url=https://docs.github.com/rest/overview/resources-in-the-rest-api#rate-limiting GitHub API error INFO 2025-07-24T03:35:34 +132ms service=server method=GET path=/config request ... INFO 2025-07-24T03:36:08 +1465ms service=bus type=storage.write publishing INFO 2025-07-24T03:36:08 +0ms service=bus type=message.part.updated publishing INFO 2025-07-24T03:36:08 +0ms service=session session=ses_7c57f7cb4ffeJSVhDSCReojG6k type=error part ERROR 2025-07-24T03:36:08 +1ms service=session session=ses_7c57f7cb4ffeJSVhDSCReojG6k error=AI_APICallError: ak not exist: B4jwK INFO 2025-07-24T03:36:08 +0ms service=bus type=session.error publishing INFO 2025-07-24T03:36:08 +1ms service=bus type=storage.write publishing INFO 2025-07-24T03:36:08 +0ms service=bus type=message.updated publishing INFO 2025-07-24T03:36:08 +0ms service=session session=ses_7c57f7cb4ffeJSVhDSCReojG6k sessionID=ses_7c57f7cb4ffeJSVhDSCReojG6k unlocking INFO 2025-07-24T03:36:08 +0ms service=bus type=session.idle publishing INFO 2025-07-24T03:36:08 +0ms service=server duration=10667 response INFO 2025-07-24T03:36:08 +1ms service=server method=POST path=/log request INFO 2025-07-24T03:36:08 +0ms service=tui message=msg_83a808e10001cHB70NilfZ7MRg part=prt_83a80ad04001dLa2TAXe5uJFtV message part updated INFO 2025-07-24T03:36:08 +0ms service=server duration=0 response INFO 2025-07-24T03:36:08 +0ms service=server method=POST path=/log request DEBUG 2025-07-24T03:36:08 +0ms service=tui messageCount=2 timeTakenMs=0 messages.renderView INFO 2025-07-24T03:36:08 +0ms service=server duration=0 response INFO 2025-07-24T03:36:08 +1ms service=server method=POST path=/log request ERROR 2025-07-24T03:36:08 +0ms service=tui message=AI_APICallError: ak not exist: B4jwK name=UnknownError Server error INFO 2025-07-24T03:36:08 +0ms service=server duration=0 response INFO 2025-07-24T03:36:08 +4ms service=server method=POST path=/log request DEBUG 2025-07-24T03:36:08 +0ms service=tui messageCount=2 timeTakenMs=0 messages.renderView INFO 2025-07-24T03:36:08 +0ms service=server duration=0 response ``` hope it is useful.
Author
Owner

@lili21 commented on GitHub (Jul 23, 2025):

the provider I am using require the apiKey in request url. something like

httsp://the-provider.com/api?ak=B4jwKxxxxxxxxxx

@lili21 commented on GitHub (Jul 23, 2025): the provider I am using require the apiKey in request url. something like `httsp://the-provider.com/api?ak=B4jwKxxxxxxxxxx`
Author
Owner

@lili21 commented on GitHub (Jul 23, 2025):

Image

I can call the provider using aisdk with this code.

@lili21 commented on GitHub (Jul 23, 2025): <img width="1736" height="550" alt="Image" src="https://github.com/user-attachments/assets/e88bb7f9-dbae-45f9-a187-5cbf84309b73" /> I can call the provider using aisdk with this code.
Author
Owner

@lili21 commented on GitHub (Aug 12, 2025):

It would be nice if I can config the fetch function through opencode.json

@lili21 commented on GitHub (Aug 12, 2025): It would be nice if I can config the fetch function through opencode.json
Author
Owner

@lili21 commented on GitHub (Aug 20, 2025):

okay, after some dig in. I found the reason. the provider I am using is not fully openai compatible.

currenty, the model request url will be something like https://myprovider-example.com/openapi?ak=xxxxxx/chat/completions, which is not correct. the correct one is https://myprovider-example.com/openapi?ak=xxxxxx.

@lili21 commented on GitHub (Aug 20, 2025): okay, after some dig in. I found the reason. the provider I am using is not fully openai compatible. currenty, the model request url will be something like `https://myprovider-example.com/openapi?ak=xxxxxx/chat/completions`, which is not correct. the correct one is `https://myprovider-example.com/openapi?ak=xxxxxx`.
Author
Owner

@rekram1-node commented on GitHub (Dec 27, 2025):

[automated] Closing due to 90+ days of inactivity. Feel free to reopen if you still need this!

@rekram1-node commented on GitHub (Dec 27, 2025): [automated] Closing due to 90+ days of inactivity. Feel free to reopen if you still need this!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#718