Skip to content

custom @ai-sdk/anthropic provider , context token usage display error #7481

@caozhiyuan

Description

@caozhiyuan

Description

Image

{"type":"message_delta","delta":{"stop_reason":"end_turn","stop_sequence":null},"usage":{"input_tokens":236,"output_tokens":81,"cache_read_input_tokens":12800}}

	"provider": {
		"local": {
			"npm": "@ai-sdk/anthropic",
			"name": "My Local",
			"options": {
				"baseURL": "http://localhost:4141/v1",
				"apiKey": "dummy"
			},
			"models": {
				"gpt-5.2": {
					"name": "gpt-5.2",
					"limit": {
						"context": 200000,
						"output": 64000
					}
				},
				"gpt-5-mini": {
					"name": "gpt-5-mini",
					"limit": {
						"context": 200000,
						"output": 64000
					}
				},
				"claude-sonnet-4.5": {
					"id": "claude-sonnet-4.5",
					"name": "claude-sonnet-4.5",
					"limit": {
						"context": 200000,
						"output": 16000
					},
					"options": {
						"thinking": {
							"type": "enabled",
							"budgetTokens": 15999
						}
					}
				}
			}
		}
	}

Plugins

No response

OpenCode version

1.1.8

Steps to reproduce

  1. ask hi
  2. see context info

Screenshot and/or share link

No response

Operating System

windows 11

Terminal

pwsh

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingwindows

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions