Repository navigation
Add FlexAI as an AI Gateway provider - #5830
sundar-flex wants to merge 4 commits into
Conversation
There was a problem hiding this comment.
Your trial has ended. Reactivate Greptile to resume code reviews.
|
@sundar-flex is attempting to deploy a commit to the Helicone Team on Vercel. A member of the Team first needs to authorize it. |
Bugbot is paused — on-demand spend limit reachedBugbot uses usage-based billing for this team and has hit its on-demand spend limit. A team admin can raise the spend limit in the Cursor dashboard, or wait for the next billing cycle to continue. |
FlexAI (https://flex.ai) is an OpenAI-compatible inference provider. This registers it in the gateway registry and adds endpoints for the six models it serves that already have a model definition in the registry. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
FlexAI now serves Llama-3.3-70B-Instruct-FP8 with speculative decoding,
which rejects both parameters with a 400 ("The min_p and logit_bias
sampling parameters are not yet supported with speculative decoding").
Verified live 2026-10-06; the other five FlexAI endpoints still accept
both. Registry snapshot updated to match.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Upstream's vault-key hardening requires every AI Gateway provider to declare its first-party origins (firstPartyOrigins.test.ts).
4c7aa43 to
024a015
Compare
Bugbot is paused — your team has an unpaid invoiceBugbot is paused because your team has an unpaid invoice. Pay it from the billing page in the Cursor dashboard and Bugbot resumes automatically. (requestId: 8bedc825-6029-4d14-a820-3c8ea8481f9c) |
Update FlexAI endpoint pricing to the current published rates (https://flex.ai/pricing): - gpt-oss-120b: $0.05 / $0.25 per 1M (was $0.03 / $0.17) - llama-3.3-70b-instruct: $0.22 / $0.50 (was $0.135 / $0.40) - qwen3-coder-30b-a3b-instruct: output $0.28 (was $0.26) - mistral-nemo: input $0.023 (was $0.019) Cached input stays at the 0.15x multiplier, which matches the published cached-input rate. Registry snapshot regenerated. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Bugbot is paused — your team has an unpaid invoiceBugbot is paused because your team has an unpaid invoice. Pay it from the billing page in the Cursor dashboard and Bugbot resumes automatically. (requestId: 54009ad1-3542-42e6-b5ad-6997b0685aee) |
Adds FlexAI (https://flex.ai) as an AI Gateway provider, following
INTEGRATE_PROVIDER_TO_GATEWAY.md.FlexAI is an OpenAI-compatible inference provider serving open-weight models. This PR registers the provider and adds endpoints for the six models FlexAI serves that already have a model definition in this registry — no new authors or model families, so nothing in the catalogue had to be invented.
Provider
https://api.flex.ai/→v1/chat/completionsAuthorization: Bearer <key>(auth: "api-key", no override needed)ptbEnabled: falseon every endpoint — BYOK onlyEndpoints added
Every value below was measured against the live API on 2026-10-02, not copied from a listing.
providerModelIdgpt-oss-120b:flexaigpt-oss-120bgpt-oss-20b:flexaigpt-oss-20bllama-3.1-8b-instruct:flexaiMeta-Llama-3.1-8B-Instruct-FP8llama-3.3-70b-instruct:flexaiLlama-3.3-70B-Instruct-FP8mistral-nemo:flexaiMistral-Nemo-Instruct-2407-FP8qwen3-coder-30b-a3b-instruct:flexaiQwen3-Coder-30B-A3B-Instruct-FP8How the values were verified
Prices come from FlexAI's own
GET /v1/models(pricing.input_per_mtok/output_per_mtok), and were then reconciled against billed cost on a live completion:gpt-oss-120b:prompt_tokens: 74, of whichcached_tokens: 64; reportedupstream_inference_prompt_cost: 5.9e-07. Hand-computed with cached tokens insideprompt_tokensand billed at the published cached rate:(74−64)×3e-8 + 64×4.5e-9 = 5.88e-07. ✅Llama-3.3-70B-Instruct-FP8:prompt_tokens: 42,cached_tokens: 16, reported3.83e-06.(42−16)×1.35e-7 + 16×2.03e-8 = 3.835e-06. ✅That reconciliation establishes two things the price table alone doesn't: cached tokens are counted inside
prompt_tokens(so the registry's cache handling is correct), and the published cached rate is 0.15 × input on every model — hencecacheMultipliers: { cachedInput: 0.15 }on each endpoint.Context / max output.
/v1/modelsreportsmax_output_lengthequal tocontext_lengthon every row, which on its own would be an unverified claim, so the ceiling was probed directly. The API rejectsmax_tokensstrictly greater than the context window ("max_tokens=131073 cannot be greater than the model's maximum context length of 131072 tokens"), somaxCompletionTokensis set equal tocontextLength, which is the measured limit.supportedParametersis the intersection of FlexAI's per-modelsupported_parameterswith this repo'sStandardParameterunion. The one exception:Llama-3.3-70B-Instruct-FP8omitsmin_pandlogit_bias. FlexAI serves it with speculative decoding, which rejects both with a 400 even though/v1/modelslists them (verified live 2026-10-06).One correction worth flagging: FlexAI's
/v1/modelsmetadata does not listtool_useforMistral-Nemo-Instruct-2407-FP8, but the deployment emits a well-formedget_weathertool call on two independent live requests (finish_reason: "tool_calls"). The measurement is what's declared here, andtools/tool_choiceare included for it.Two things were deliberately left out rather than guessed:
rateLimits— FlexAI publishes a per-account request-rate limit, not the per-modeltpm/tpdshape this field wants, so declaring numbers here would be fiction.Qwen3-30B-A3B-Thinking-2507is served by FlexAI but is not mapped onto this registry'sqwen3-30b-a3b(41k context, non-thinking Instruct weights) — a different model, so it is omitted rather than mis-attached.Registration points touched
Found by grepping an existing comparable provider (
canopywave,deepinfra) repo-wide and diffing the commit that added Canopy Wave (#5292):packages/cost/models/providers/flexai.ts— provider classpackages/cost/models/providers/index.ts— import, registry entry,ResponsesAPIEnabledProviders(chat-completions-only group;BaseProvider.buildRequestBodyalready maps RESPONSES → chat completions)packages/cost/models/providers/priorities.tspackages/cost/providers/mappings.ts— URL pattern,providersNames, provider rowpackages/cost/models/provider-helpers.ts—heliconeProviderToModelProviderName,dbProviderToProviderpackages/cost/usage/getUsageProcessor.ts— OpenAI usage processorweb/data/providers.ts+web/public/assets/home/providers/flexai.webp(512×512, from FlexAI's brand mark)worker/test/setup.tsprovider-key fixtures (both BYOK and Helicone-key blocks)worker/test/ai-gateway/registry-{openai,meta-llama,mistralai,alibaba}.spec.tspackages/__tests__/cost/__snapshots__/registrySnapshots.test.ts.snap— regenerated withnpx jest --updateSnapshot(step 9 of the guide)Checks run
Baseline measured on untouched
mainin the same install, then re-run on this branch.mainnpx vitest run test/ai-gateway/registry-{openai,meta-llama,mistralai,alibaba}.spec.ts(worker)registry-mistralaialone re-run after the tool-call fix: 101 passed)npx jest __tests__/(packages)npx tsc --noEmit(worker)Snapshot delta is exactly what you'd expect:
totalProviders 21 → 22,totalEndpoints 329 → 335,{ provider: "flexai", modelCount: 6 }.Not verified
The gateway was not exercised end-to-end against the live FlexAI API — the registry and worker test suites use mocked upstreams, and I have no Helicone deployment to route a real request through. Everything above the transport (URL construction, auth header shape, prices, context, parameters, tool calls) was measured directly against
api.flex.ai.Happy to adjust naming, priority, or the endpoint set.
🤖 Generated with Claude Code