[PR #7987] feat(provider): add FriendliAI provider support #12585

Closed
opened 2026-02-16 18:17:29 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/7987

State: closed
Merged: No


Summary

Add native support for FriendliAI as an OpenAI-compatible provider with proper handling of Friendli-specific features.

Changes

transform.ts

  1. variants() - Returns empty object for Friendli provider

    • Friendli uses chat_template_kwargs instead of reasoningEffort
    • Variants are defined explicitly via config or models.dev
  2. providerOptions() - Adds Friendli-specific provider options

    • Strips unsupported thinking option
    • Injects parse_reasoning: true for backward compatibility with pre-Dec 2025 models
  3. schema() - Sanitizes JSON Schema for Friendli constraints

    • Removes unsupported properties: minLength, maxLength (string), minimum/maximum (number only)
    • Filters unsupported formats (only uuid, date-time, date, time allowed)
    • Removes maxItems, clamps minItems > 1 to 1
    • Removes unsupported composition: allOf, oneOf, not (only anyOf supported)
    • Removes additionalProperties
    • Based on: https://friendli.ai/docs/guides/structured-outputs

Related

  • models.dev PR: (will be linked after creation)

Testing

Tested with local build against FriendliAI serverless endpoints:

  • Qwen3-32B with --variant off/on
  • K-EXAONE-236B-A23B with --variant off/on
  • GLM-4.6 with --variant off/on
**Original Pull Request:** https://github.com/anomalyco/opencode/pull/7987 **State:** closed **Merged:** No --- ## Summary Add native support for [FriendliAI](https://friendli.ai) as an OpenAI-compatible provider with proper handling of Friendli-specific features. ## Changes ### `transform.ts` 1. **`variants()`** - Returns empty object for Friendli provider - Friendli uses `chat_template_kwargs` instead of `reasoningEffort` - Variants are defined explicitly via config or models.dev 2. **`providerOptions()`** - Adds Friendli-specific provider options - Strips unsupported `thinking` option - Injects `parse_reasoning: true` for backward compatibility with pre-Dec 2025 models 3. **`schema()`** - Sanitizes JSON Schema for Friendli constraints - Removes unsupported properties: `minLength`, `maxLength` (string), `minimum`/`maximum` (number only) - Filters unsupported formats (only `uuid`, `date-time`, `date`, `time` allowed) - Removes `maxItems`, clamps `minItems` > 1 to 1 - Removes unsupported composition: `allOf`, `oneOf`, `not` (only `anyOf` supported) - Removes `additionalProperties` - Based on: https://friendli.ai/docs/guides/structured-outputs ## Related - **models.dev PR**: (will be linked after creation) ## Testing Tested with local build against FriendliAI serverless endpoints: - ✅ Qwen3-32B with `--variant off/on` - ✅ K-EXAONE-236B-A23B with `--variant off/on` - ✅ GLM-4.6 with `--variant off/on`
yindo added the pull-request label 2026-02-16 18:17:29 -05:00
yindo closed this issue 2026-02-16 18:17:29 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#12585