Skip to content

fix: Agnes/LongCat OpenAI-only capabilities - #92

Merged
Patel230 merged 18 commits into
mainfrom
fix/concentrate-payg-plan
Jul 30, 2026
Merged

fix: Agnes/LongCat OpenAI-only capabilities#92
Patel230 merged 18 commits into
mainfrom
fix/concentrate-payg-plan

Conversation

@Patel230

Copy link
Copy Markdown
Contributor

Complete changes for Agnes and LongCat AI provider OpenAI-only routing

Patel230 and others added 18 commits July 29, 2026 22:25
…trate

- Add Strict field to responsesTool struct, set strict: true on all tools
- Add normalizeToolParams to inject additionalProperties: false for object schemas
- Restructure responsesTool to flat format (name/description/parameters at top level)
- Add Store field to responsesRequest
- Expand response types with Status, Error, IncompleteDetails
- Add bufio import for SSE reader

Per Concentrate API docs: strict mode requires additionalProperties: false.
Previously required CONCENTRATE_FETCH_PRICING=true env var, which
meant most users saw "free" for all models. Now pricing is fetched
by default and cached for 24 hours. Falls back gracefully to no
pricing if API key is unavailable.
Map all Concentrate API fields from ChatOptions to responsesRequest:
- include, routing, max_tool_calls, context_management
- safety_identifier, background, truncation, conversation

Per: https://concentrate.ai/docs/api-reference/endpoint/request-parameters
Revert manual go.mod edits; workspace handles replacement.
- Register Agnes in provider registry (ChatPreference: 25, free tier)
- Add FetchAgnes live fetcher calling /v1/models
- Add AGNES_API_KEY credential mapping
- Add Agnes fields to ProviderConfig
- Update tests for 24 providers (was 23)
- Agnes is free with RPM limits, no per-token pricing

Base URL: https://apihub.agnes-ai.com/v1
Previously only Concentrate got special treatment for unknown function-calling
capability. Now all providers with unknown capabilities (like Agnes AI free
tier) are assumed to support tools. Better to try and fail than block models
from being used. Only explicit unsupported blocks a model.

Updates test to reflect new behavior: unknown = assumed supported.
- Add agnes-direct case in providerForDeployment switch
- Add Agnes to OpenAICompatibleRuntimeProfiles and RuntimeProviderProfiles
- Add ProviderAgnes constant
- Reuses OpenAI adapter (OpenAICompat) for Agnes OpenAI-compatible API
- Base URL: https://apihub.agnes-ai.com/v1

Fixes no route configured error when selecting Agnes models.
- Add OmitMaxTokens compat flag to skip max_tokens for pre-deduction providers
- Add AgnesCompat config with OmitMaxTokens=true to match curl behavior
- Register AgnesCompat in init() for OpenAI-compatible providers
- Guard max_tokens in buildRequestBase by OmitMaxTokens check
- Switch agnes-direct deployment from OpenAICompat to AgnesCompat
- Mark Agnes pricing as unknown (PricingUnknown) instead of free (pre-deduction)
- Fix tests for new pricing sentinel behavior
- Add agnesProviderStages with anthropic-direct fallback when both are configured
- Add agnes-direct to deploymentOwnerProviderID
- Add insufficient_user_quota/pre-deduction patterns to ShouldTryNextDeployment
  so Agnes balance errors trigger fallback to Anthropic
LongCat AI provides LongCat-2.0 model with 1M token context.
Supports both Token Pack and Pay-As-You-Go plans via same endpoint.
Endpoint: https://api.longcat.chat/openai/v1
Uses OpenAICompat config. Added live model fetcher, routing, and profiles.
LongCat supports both OpenAI and Anthropic API formats. If the
OpenAI-compatible endpoint fails, fall back to the Anthropic endpoint
at https://api.longcat.chat/anthropic/v1/messages
LongCat should only fall back between its own OpenAI and Anthropic
endpoints, not to OpenRouter.
Reorder all provider SortOrder values to alphabetical by DisplayName.
Fixes duplicate SortOrder values that were introduced during renumbering.
Drop cross-provider and longcat-anthropic fallbacks, map longcat-direct
credentials, and enrich official context/tools/vision/thinking metadata
from provider docs when /models omits it.

Co-authored-by: Cursor <cursoragent@cursor.com>
@Patel230
Patel230 merged commit 502726d into main Jul 30, 2026
16 checks passed
@Patel230
Patel230 deleted the fix/concentrate-payg-plan branch July 30, 2026 17:05
Patel230 added a commit that referenced this pull request Jul 30, 2026
* feat: strict mode compliance and tool schema normalization for Concentrate

- Add Strict field to responsesTool struct, set strict: true on all tools
- Add normalizeToolParams to inject additionalProperties: false for object schemas
- Restructure responsesTool to flat format (name/description/parameters at top level)
- Add Store field to responsesRequest
- Expand response types with Status, Error, IncompleteDetails
- Add bufio import for SSE reader

Per Concentrate API docs: strict mode requires additionalProperties: false.

* fix: fetch Concentrate pricing by default instead of opt-in

Previously required CONCENTRATE_FETCH_PRICING=true env var, which
meant most users saw "free" for all models. Now pricing is fetched
by default and cached for 24 hours. Falls back gracefully to no
pricing if API key is unavailable.

* feat: implement Concentrate Responses API extended parameters

Map all Concentrate API fields from ChatOptions to responsesRequest:
- include, routing, max_tool_calls, context_management
- safety_identifier, background, truncation, conversation

Per: https://concentrate.ai/docs/api-reference/endpoint/request-parameters

* fix: restore go.mod after workspace testing

Revert manual go.mod edits; workspace handles replacement.

* feat: add Agnes AI as free OpenAI-compatible provider

- Register Agnes in provider registry (ChatPreference: 25, free tier)
- Add FetchAgnes live fetcher calling /v1/models
- Add AGNES_API_KEY credential mapping
- Add Agnes fields to ProviderConfig
- Update tests for 24 providers (was 23)
- Agnes is free with RPM limits, no per-token pricing

Base URL: https://apihub.agnes-ai.com/v1

* fix: treat unknown capabilities as supported for all providers

Previously only Concentrate got special treatment for unknown function-calling
capability. Now all providers with unknown capabilities (like Agnes AI free
tier) are assumed to support tools. Better to try and fail than block models
from being used. Only explicit unsupported blocks a model.

Updates test to reflect new behavior: unknown = assumed supported.

* fix: add Agnes deployment routing and runtime profile

- Add agnes-direct case in providerForDeployment switch
- Add Agnes to OpenAICompatibleRuntimeProfiles and RuntimeProviderProfiles
- Add ProviderAgnes constant
- Reuses OpenAI adapter (OpenAICompat) for Agnes OpenAI-compatible API
- Base URL: https://apihub.agnes-ai.com/v1

Fixes no route configured error when selecting Agnes models.

* feat: add Agnes AI provider with OmitMaxTokens compat fix

- Add OmitMaxTokens compat flag to skip max_tokens for pre-deduction providers
- Add AgnesCompat config with OmitMaxTokens=true to match curl behavior
- Register AgnesCompat in init() for OpenAI-compatible providers
- Guard max_tokens in buildRequestBase by OmitMaxTokens check
- Switch agnes-direct deployment from OpenAICompat to AgnesCompat
- Mark Agnes pricing as unknown (PricingUnknown) instead of free (pre-deduction)
- Fix tests for new pricing sentinel behavior

* feat: add Agnes-to-Anthropic fallback routing

- Add agnesProviderStages with anthropic-direct fallback when both are configured
- Add agnes-direct to deploymentOwnerProviderID
- Add insufficient_user_quota/pre-deduction patterns to ShouldTryNextDeployment
  so Agnes balance errors trigger fallback to Anthropic

* feat: add LongCat AI provider (OpenAI-compatible endpoint)

LongCat AI provides LongCat-2.0 model with 1M token context.
Supports both Token Pack and Pay-As-You-Go plans via same endpoint.
Endpoint: https://api.longcat.chat/openai/v1
Uses OpenAICompat config. Added live model fetcher, routing, and profiles.

* feat: add longcat-anthropic fallback deployment

LongCat supports both OpenAI and Anthropic API formats. If the
OpenAI-compatible endpoint fails, fall back to the Anthropic endpoint
at https://api.longcat.chat/anthropic/v1/messages

* fix: remove OpenRouter fallback from LongCat routing

LongCat should only fall back between its own OpenAI and Anthropic
endpoints, not to OpenRouter.

* fix: alphabetical SortOrder values for all providers

Reorder all provider SortOrder values to alphabetical by DisplayName.
Fixes duplicate SortOrder values that were introduced during renumbering.

* fix: keep Agnes and LongCat OpenAI-only with full live capabilities

Drop cross-provider and longcat-anthropic fallbacks, map longcat-direct
credentials, and enrich official context/tools/vision/thinking metadata
from provider docs when /models omits it.

* fix: complete changes for Agnes/LongCat OpenAI-only capabilities

* fix: remove invalid ChatOptions field accesses in concentrate adapter and update credential resolve test

* fix: resolve golangci-lint issues for gocritic nilValReturn and unused transportError

* style: format test_helpers_test.go with gofumpt

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant