aaif-goose / aaif-goose/goose

Estimate costs through canonical provider aliases

Ouverte
#11,786 5 commentaires 0 réactions 1 personne assignée Assignée à @bioinfornatics Voir sur GitHub
Langage dominant
Rust
Étoiles
54.2k
Forks
6.2k
Merge moyen
3 j 2 h
PR mergées (30 j)
262

Description

**What problem would this solve?**

Goose can receive usage tokens without receiving a provider-reported cost. In that case, provider aliases and hosting providers may fail to resolve public pricing even when the underlying model is known.

Two concrete cases are:

- ChatGPT Codex serves OpenAI GPT models, but its Goose provider ID does not match the OpenAI catalog namespace.
- Azure Foundry deployments can use custom deployment names and host models from OpenAI, Anthropic, DeepSeek, Mistral, Meta, Microsoft, and other publishers. Pricing must use deployment metadata's underlying model rather than assuming every Azure model is OpenAI.

**What would a good outcome look like?**

When a provider does not report cost, Goose should calculate a clearly identified public-price estimate from the canonical model catalog:

- `chatgpt_codex/gpt-*` resolves through the OpenAI catalog.
- Azure Foundry project deployments retain their deployment alias on the wire but use the discovered underlying model for pricing and capabilities.
- Recognizable resource and MaaS model names resolve through controlled canonical publisher inference.
- Open-weight models with zero publisher rates use a non-zero host catalog rate when one exists.
- Unknown or ambiguous models remain unpriced instead of receiving an arbitrary estimate.
- Provider-reported cost remains authoritative.
- The legacy and state-machine agent loops behave identically.

**Possible approaches**

- Add `chatgpt_codex` as a canonical alias for `openai`.
- Reuse Azure Foundry deployment metadata already returned by `/deployments` and carry its underlying `modelName` in `ProviderUsage.model`.
- Keep one shared cost-resolution helper for both agent loops.
- Add a regression matrix for OpenAI, Anthropic, DeepSeek, Mistral, Meta/open-weight, Microsoft Phi, and unknown models.
- Describe fallback values as public estimates rather than invoices.

**Additional context**

A candidate implementation is available on [`bioinfornatics:feat/adaptive-default-cost-estimates`](https://github.com/bioinfornatics/goose/tree/feat/adaptive-default-cost-estimates), commit [`741edd9c5`](https://github.com/bioinfornatics/goose/commit/741edd9c5).

Validation completed:

- `cargo build --release -p goose-cli`
- `cargo fmt --check`
- `cargo clippy --all-targets -- -D warnings`
- 16 canonical-model tests
- 22 Azure Foundry tests
- 16 canonical-cost tests
- independent reviews by `gpt-5.6-sol`, `claude-sonnet-5`, and `DeepSeek-V4-Flash`, all returning ACCEPT

- [x] I have verified this does not duplicate an existing feature request

Please add this issue to the [Goose Issues board](https://github.com/orgs/aaif-goose/projects/1) and move it to **Ready** if the scope is approved. The upstream PR will be opened only after that gate.

Guide de contribution

Ouvrir le guide de contribution

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.