Skip to content

feat: add cheapaimodel as an OpenAI-compatible provider alias - #4764

Draft
nicho810 wants to merge 1 commit into
docker:mainfrom
nicho810:feat/cheapaimodel-provider
Draft

nicho810 wants to merge 1 commit into
docker:mainfrom
nicho810:feat/cheapaimodel-provider

Conversation

@nicho810

@nicho810 nicho810 commented Oct 29, 2026 •

Copy link
Copy Markdown

Summary

  • add cheapaimodel as a built-in OpenAI-compatible provider alias (cheapaimodel, base URL https://api.cheapaimodel.ai/v1), in the same shape as the Runcrate and Atlas Cloud aliases
  • discover CHEAPAIMODEL_API_KEY for automatic model selection and credential forwarding, with deepseek-v4-1-flash as the default model
  • merge consecutive system messages, like the other open-model host aliases
  • document inline and named-model configuration, add an example recipe, and list the provider in navigation, the alias table, the provider lists and the schema description

cheapaimodel is a pay-per-token API gateway for open-weight models (DeepSeek, GLM, Kimi) and Grok, billed from a prepaid USD balance, through an OpenAI-compatible Chat Completions API. I work on cheapaimodel. It is not in models.dev yet (anomalyco/models.dev#11684 is open), so it gets the same exemptions as runcrate and atlascloud in TestProviderIDsMatchEmbeddedCatalog and modelsDevAbsentProviders, and the docs page says that no catalog metadata is imported. Since #4755 the alias is a single entry in pkg/model/provider/catalog/providers.json, placed after runcrate.

The docs page also notes that kimi-k3 only accepts temperature 0.6 or 1 and top_p 0.95, and which models take image input (users opt in with capabilities, since there is no catalog metadata).

Testing

  • go vet ./pkg/model/provider/... ./pkg/config/...: clean
  • go test ./pkg/model/provider/... ./pkg/config/... ./cmd/root/...: all 33 packages pass, including TestOpenAIAliasProvider_EndToEndRequest/cheapaimodel, TestProviderIDsMatchEmbeddedCatalog/cheapaimodel, TestAliases_MergeConsecutiveSystemMessages/cheapaimodel, TestAutoModelConfig/cheapaimodel_provider and the three example checks for examples/cheapaimodel.yaml
  • Live, 2026-10-29, with a real key and a binary built from this branch: docker-agent run --exec with cheapaimodel/<model> returns the expected reply for deepseek-v4-1-flash, glm-5.3, glm-5.3-flash, kimi-k3 and grok-4.7. With a filesystem toolset, all five call read_file and answer from the result; deepseek-v4-1-flash sometimes streams its last text in the same chunk as finish_reason and usage, which the runtime drops today, fixed separately in fix(runtime): keep text and reasoning streamed in the terminal chunk #4765.

Signed-off-by: Nicho Deng <nicho810d@gmail.com>
@nicho810
nicho810 force-pushed the feat/cheapaimodel-provider branch from 63a38bc to efa303f Compare October 29, 2026 13:49
@aheritier aheritier added area/config For configuration parsing, YAML, environment variables area/docs Documentation changes area/models LLM model integrations and model providers area/providers For features/issues/fixes related to LLM providers (Bedrock, LiteLLM, Qwen, custom, etc.) area/providers/openai For features/issues/fixes related to the usage of OpenAI models kind/feat PR adds a new feature (maps to feat:). Use on PRs only. status/needs-signed-commits Some commits in the PR are signed with a valid SSH/GPG key labels Oct 29, 2026
@aheritier

Copy link
Copy Markdown
Collaborator

👋 Some commits in this PR are not signed and verified by GitHub. Please sign your commits with a GPG or SSH key registered in your GitHub account, then force-push.

Commits that are not verified: efa303f

See GitHub's guide on signing commits for setup instructions. I've added status/needs-signed-commits; it will be removed automatically once every commit in this PR carries a valid GitHub-verified signature.

@aheritier

Copy link
Copy Markdown
Collaborator

👋 Some commits in this PR are not signed and verified by GitHub. Please sign your commits with a GPG or SSH key registered in your GitHub account, then force-push.\n\nCommits that are not verified: efa303f\n\nSee GitHub’s guide on signing commits for setup instructions. I’ve added status/needs-signed-commits; it will be removed automatically once every commit in this PR carries a valid GitHub-verified signature.

@aheritier
aheritier requested a balanced review from Copilot October 29, 2026 22:31
@aheritier
aheritier marked this pull request as draft October 29, 2026 22:31

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues block the cheapaimodel provider addition.

No open issues 🎉

What changed in this PR

Adds cheapaimodel as a built-in OpenAI-compatible provider through the centralized provider catalog, reusing existing alias handling without introducing a new client implementation.

Changes:

  • Configures the endpoint, CHEAPAIMODEL_API_KEY discovery, default model, and consecutive system-message merging.
  • Extends alias and automatic-selection tests, with exemptions for models absent from models.dev.
  • Adds configuration examples, provider documentation, navigation, and schema-description updates.
File Description
pkg/​model/​provider/​openai/​system_message_merge_test.go Tests system-message merging for the alias.
pkg/​model/​provider/​openai_alias_providers_test.go Adds shared alias request and compatibility coverage.
pkg/​model/​provider/​catalog/​providers.json Registers the endpoint, credentials, default model, and merge behavior.
pkg/​model/​provider/​catalog_test.go Exempts the provider from models.dev catalog matching.
pkg/​config/​examples_test.go Allows example models absent from models.dev.
pkg/​config/​auto_test.go Tests credential discovery and automatic model selection.
examples/​README.md Lists the new provider recipe.
examples/​cheapaimodel.yaml Adds a named-model assistant example with tools.
docs/​providers/​overview/​index.md Lists the provider and its authentication variable.
docs/​providers/​cheapaimodel/​index.md Documents setup, models, parameter restrictions, and attachment capabilities.
docs/​data/​nav.yml Adds provider navigation.
docs/​configuration/​models/​index.md Includes the alias in provider and custom-header documentation.
agent-schema.json Adds the alias to the provider description.

Review effort: Balanced

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/config For configuration parsing, YAML, environment variables area/docs Documentation changes area/models LLM model integrations and model providers area/providers/openai For features/issues/fixes related to the usage of OpenAI models area/providers For features/issues/fixes related to LLM providers (Bedrock, LiteLLM, Qwen, custom, etc.) kind/feat PR adds a new feature (maps to feat:). Use on PRs only. status/needs-signed-commits Some commits in the PR are signed with a valid SSH/GPG key

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants