cloudwego / cloudwego/eino-ext

ark: Responses API messages do not expose model name via ark.GetModelName

Open
#941 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
811
Forks
368
Avg merge
16h 22m
Merged PRs (30d)
13

Description

### Component

`components/model/ark`

### Problem

When using the Ark ChatModel with the Responses API enabled, the returned `schema.Message` does not expose the resolved model name via `ark.GetModelName(message)`.

The Chat Completions path does expose it, so application code that records per-call model usage has to handle the two APIs differently.

Observed behavior:

- Chat Completions API: `ark.GetModelName(message)` returns a value such as `doubao-seed-2-0-lite`.
- Responses API: `ark.GetModelName(message)` returns an empty string.
- Responses API callback output can contain `CallbackOutput.Extra["model_name"]` after #627, so the model name is available in callback metadata, but not on the returned message itself.

### Why this matters

For systems that aggregate token usage or model attribution from `schema.Message` metadata, switching Ark to Responses API silently loses the model identity. This makes Responses API less compatible with the Chat Completions adapter behavior.

The endpoint id is not a sufficient replacement because endpoint id and resolved model name have different semantics. Users may know only the endpoint id they configured, while billing/observability often needs the actual resolved model name.

### Expected behavior

`ark.GetModelName(message)` should return the resolved model name for Responses API responses as well, matching the Chat Completions path when the provider response contains model information.

If the intended design is that Responses API only exposes model name through callback extra, it would be helpful to document this difference explicitly.

### Current workaround

Read model name from callback output first, for example:

```go
modelName := ark.GetModelName(callbackOutput.Message)
if modelName == "" && callbackOutput.Extra != nil {
if v, ok := callbackOutput.Extra["model_name"].(string); ok {
modelName = v
}
}
```

This works for callback-based usage after #627, but code paths that only receive the final `schema.Message` still cannot recover the model name consistently.

Contributor guide

Open the contributing guide

Research direction

Start in components/model/ark and compare how the Chat Completions and Responses API paths populate model information on the returned schema.Message. Check the callback metadata behavior described after #627, then verify that ark.GetModelName returns the resolved model name for Responses API responses as well, or document the intended difference.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
ai, backend-api-design
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.