feat: add FriendliAI provider with auto-sync from serverless API - #871
Open
Lee-Si-Yoon wants to merge 3 commits into
Open
feat: add FriendliAI provider with auto-sync from serverless API#871Lee-Si-Yoon wants to merge 3 commits into
Lee-Si-Yoon wants to merge 3 commits into
Conversation
Adds general/friendli.json and pricing/friendli.json generated from the FriendliAI serverless API (https://api.friendli.ai/serverless/v1/models). - general/friendli.json: model capabilities (max_tokens, tools, image) with Friendli-specific params (reasoning controls: chat_template_kwargs, parse_reasoning, include_reasoning) - pricing/friendli.json: per-model pricing (USD/token → cents/token ×100) including cache_read_input_token where available - scripts/sync-friendli-models.js: fetches the live model list and regenerates both JSON files; supports --dry-run; retries on 503 - README.md: add FriendliAI to the providers list Companion to gateway PR #1756 (provider registration as 'friendli').
Replace the placeholder params with proper OpenAI-compatible params from the Friendli OpenAPI spec (ServerlessChatCompletionBody): - default: max_tokens, temperature, top_p, top_k, frequency_penalty, presence_penalty, repetition_penalty, n, stop, stream - tool-capable models: tool_choice + response_format (json_object/json_schema) Friendli-specific reasoning controls (chat_template_kwargs, parse_reasoning, include_reasoning, reasoning_effort, reasoning_budget) are handled by the gateway provider adapter (PR #1756), not the models repo general config. Source: https://github.com/friendliai/friendli-openapi
- max_tokens: per-model maxValue from API max_completion_tokens (163K-1M), no global maxValue 4096 - temperature/top_k/repetition_penalty/n: defaultValue from API default_params, no fabricated minValue/maxValue - top_p (0-1), frequency_penalty (-2..2), presence_penalty (-2..2), min_p (0-1): ranges from Friendli OpenAPI spec descriptions - Added min_p param (present in API default_params, documented in spec)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds FriendliAI as a new provider, with an automated sync script that fetches model metadata from the Friendli serverless API.
Companion to gateway PR #1756 which registers the
friendliprovider in the gateway.Changes
general/friendli.json— Model capabilities (max_tokens, tools/image support) with Friendli-specific params:chat_template_kwargs,parse_reasoning,include_reasoning(reasoning controls for models like GLM-5.2)pricing/friendli.json— Per-model pricing (USD/token → cents/token ×100), includingcache_read_input_tokenwhere availablescripts/sync-friendli-models.js— Fetcheshttps://api.friendli.ai/serverless/v1/modelsand regenerates both JSON files. Supports--dry-run, retries on 503README.md— Added FriendliAI to the providers listscripts/README.md— Documented the new sync scriptPricing Unit Conversion
The Friendli API returns prices in USD/token. This repo stores prices in cents/token, so the script multiplies by 100:
zai-org/GLM-5.2inputzai-org/GLM-5.2outputzai-org/GLM-5.2cache readVerification
npm run lint— passesnpx prettier --check— all files formattedpython3 scripts/check_duplicate_keys.py— no duplicate keysnode scripts/sync-friendli-models.js— generates valid JSON from live APInode scripts/sync-friendli-models.js --dry-run— preview worksCurrently Synced Models (6)
deepseek-ai/DeepSeek-V3.2google/gemma-4-31B-itLGAI-EXAONE/K-EXAONE-236B-A23BMiniMaxAI/MiniMax-M2.5zai-org/GLM-5.1zai-org/GLM-5.2Usage