Skip to content

AI/ML API as a cloud provider preset - #1

Open
Lookoff-AIMLAPI wants to merge 3 commits into
mainfrom
feat/aimlapi-provider
Open

Lookoff-AIMLAPI wants to merge 3 commits into
mainfrom
feat/aimlapi-provider

Conversation

@Lookoff-AIMLAPI

Copy link
Copy Markdown
Member

Adds AI/ML API to AutoClip as one more CloudPreset, the same shape the existing deepseek / seed / kimi / glm / grok presets use.

What lands

  • aimlapi preset: base URL, default model openai/gpt-6-luna, its own aimlapi_api_key setting — wired through the settings page, the first-run wizard, the CLI (--provider aimlapi), autoclip providers, env fallbacks (API_AIMLAPI_API_KEY / AIMLAPI_API_KEY) and the eight locale catalogues.
  • Attribution headers (X-AIMLAPI-Source: agent/autoclip, HTTP-Referer, X-Title) on requests to the gateway, gated on the exact hostname api.aimlapi.com so OpenRouter / Ollama / vLLM never receive them.
  • A model catalogue that filters the live /models list by type: the gateway returns 958 entries of which 367 are chat models, and the id alone does not say which is which.

A real bug this surfaced. The connectivity probe asked for max_tokens=1, which reasoning models cannot finish, so the settings page reported "connection failed" for a perfectly good key. Measured 2026-09-23: openai/gpt-6-luna 400s at 1 token and answers at 16; claude-sonnet-5, gemini-3.8-flash and deepseek-v4-pro answer at 1. The probe now asks for 256.

Verification. Live against the gateway: the request lands on api.aimlapi.com/v1/chat/completions carrying the attribution headers, the completion comes back, the dropdown resolves to 342 chat models with the curated ones first, and --provider aimlapi --api-key reports available: true. Backend suite 282 passed / 4 skipped; frontend typecheck, lint and i18n tests clean. The attribution test was proven to fail with the wiring removed.

Open item. AIMLAPI_PARTNER_ID ships empty, with a test asserting empty-or-well-formed. An unknown partner id is accepted and silently dropped upstream, so a placeholder would look identical to a working one. One string edit once the id is minted.

AI/ML API is an OpenAI-compatible aggregation gateway: one key reaches
300+ chat models (GPT, Claude, Gemini, Qwen, DeepSeek, Kimi, GLM, Grok),
which is the same shape as the existing deepseek / seed / kimi / glm /
grok presets — so it lands as one more CloudPreset rather than a new
provider class.

What this adds:

- `aimlapi` cloud preset (base_url + default model + its own api key
  setting), wired through the settings page, the first-run wizard, the
  CLI (`--provider aimlapi`) and `autoclip providers`.
- Attribution headers (`X-AIMLAPI-Source`, `HTTP-Referer`, `X-Title`) on
  requests to the gateway, gated on the exact hostname `api.aimlapi.com`
  so OpenRouter / Ollama / vLLM never receive them.
- A model catalogue that filters the live `/models` list by `type`:
  the gateway returns 958 entries of which 367 are chat models, and the
  id alone does not say which is which.

Also fixes a connectivity-test bug this surfaced: the probe asked for
`max_tokens=1`, which reasoning models cannot finish, so the settings
page reported "connection failed" for a perfectly good key. Measured
2026-09-23: openai/gpt-6-luna 400s at 1 token and answers at 16;
claude-sonnet-5, gemini-3.8-flash and deepseek-v4-pro answer at 1.
The probe now asks for 256.

Verified against the live gateway: the request lands on
api.aimlapi.com/v1/chat/completions carrying the attribution headers,
the completion comes back, and the model dropdown resolves to 342 chat
models with the curated ones first. Backend suite: 282 passed.
Registered as partnerName `autoclip`. The constant shipped empty because an
unknown partner id is accepted and silently dropped upstream, which is
indistinguishable from one that works; the test asserted empty-or-well-formed
and now takes its other branch. Verified on the wire: the completion request
carries X-AIMLAPI-Partner-ID alongside the source, referer and title.
The gateway shipped two flagships after this branch was written: openai/gpt-6.1-sol
(2026-09-29) and anthropic/claude-sonnet-5.5 (2026-09-28), both measured on
2026-10-01 as text+image with tool calls. They replace their predecessors in the
starter list rather than lengthening it; gpt-6-luna stays the default, since the
work here is long subtitles and it is the cheap 1.05M-context option.

The live /models list is unaffected either way: it is fetched and merged on top
of this list whenever a key is present.
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