Skip to content

Conversation

@minpeter
Copy link

@minpeter minpeter commented Jan 12, 2026

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

- Add FriendliAI detection in variants() to return empty object
  (variants defined via config/models.dev instead of reasoningEffort)
- Add providerOptions() handling with parse_reasoning flag for
  backward compatibility with pre-Dec 2025 models
- Add schema() sanitization for Friendli structured output constraints
  (minLength, maxLength, format, composition keywords per docs)
@github-actions
Copy link
Contributor

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@minpeter
Copy link
Author

Related PR: anomalyco/models.dev#632 (models.dev - adds variants schema and FriendliAI model data)

@github-actions
Copy link
Contributor

The following comment was made by an LLM, it may be inaccurate:

No duplicate PRs found

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant