[GH-ISSUE #71] TypeError: Cannot read properties of undefined (reading 'input_tokens') when using Claude Code with Kiro Auth #58

Closed
opened 2026-02-27 07:17:44 +03:00 by kerem · 2 comments
Owner

Originally created by @dustt112313 on GitHub (Nov 8, 2025).
Original GitHub issue: https://github.com/justlovemaki/AIClient-2-API/issues/71

I’m currently using Claude Code connected through Kiro Auth as the model provider. However, when running /context, the CLI throws the following error:

TypeError: Cannot read properties of undefined (reading 'input_tokens')

It seems the API responses from the Kiro Auth gateway do not include the usage.input_tokens field, which Claude Code depends on for tracking context usage and triggering automatic compaction.

As a result:

The /context command fails with the above TypeError.
Auto-compact doesn’t activate when the context window fills up.
I must manually start a new Claude Code session to reset the context window.

Originally created by @dustt112313 on GitHub (Nov 8, 2025). Original GitHub issue: https://github.com/justlovemaki/AIClient-2-API/issues/71 I’m currently using Claude Code connected through Kiro Auth as the model provider. However, when running /context, the CLI throws the following error: **TypeError: Cannot read properties of undefined (reading 'input_tokens')** It seems the API responses from the Kiro Auth gateway do not include the usage.input_tokens field, which Claude Code depends on for tracking context usage and triggering automatic compaction. As a result: The /context command fails with the above TypeError. Auto-compact doesn’t activate when the context window fills up. I must manually start a new Claude Code session to reset the context window.
kerem closed this issue 2026-02-27 07:17:44 +03:00
Author
Owner

@justlovemaki commented on GitHub (Nov 9, 2025):

排查后发现是,kiro报错导致返回值没有input_tokens,报错原因是传参缺少必要参数。/context 执行第二次或第三次就有正常返回值了。

<!-- gh-comment-id:3508250326 --> @justlovemaki commented on GitHub (Nov 9, 2025): 排查后发现是,kiro报错导致返回值没有input_tokens,报错原因是传参缺少必要参数。/context 执行第二次或第三次就有正常返回值了。
Author
Owner

@dustt112313 commented on GitHub (Nov 9, 2025):

thank man

<!-- gh-comment-id:3508446470 --> @dustt112313 commented on GitHub (Nov 9, 2025): thank man
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/AIClient-2-API-justlovemaki#58
No description provided.