Skip to content

feat(wavespeed): add WaveSpeedAI as an OpenAI-compatible LLM provider#34620

Open
devin-ai-integration[bot] wants to merge 3 commits into
litellm_internal_stagingfrom
litellm_wavespeed_provider
Open

feat(wavespeed): add WaveSpeedAI as an OpenAI-compatible LLM provider#34620
devin-ai-integration[bot] wants to merge 3 commits into
litellm_internal_stagingfrom
litellm_wavespeed_provider

Conversation

@devin-ai-integration

@devin-ai-integration devin-ai-integration Bot commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

TLDR

Problem this solves:

  • WaveSpeedAI needed manual custom-endpoint config
  • No model discovery or cost tracking for it

How it solves it:

  • Registers wavespeed as a JSON-configured OpenAI-compatible provider
  • Adds all 92 WaveSpeed LLM models to the cost map

Relevant issues

Partially addresses #34618 (LLM API half; media generation is not covered)

Linear ticket

Pre-Submission checklist

  • I have added meaningful tests
  • My PR passes all CI/CD checks (e.g., lint, format, unit tests)
  • My PR's scope is as isolated as possible; it only solves 1 specific problem
  • I have received a Greptile Confidence Score of at least 4/5 before requesting a maintainer review

Delays in PR merge?

If you're seeing a delay in your PR being merged, ping the LiteLLM Team on Slack (#pr-review).

Screenshots / Proof of Fix

Not captured yet; I don't have a WaveSpeedAI API key, so no live call was made. Once a WAVESPEED_API_KEY is available the proof is

export WAVESPEED_API_KEY=...
curl http://localhost:4000/v1/chat/completions -H "Authorization: Bearer sk-1234" \
  -H "Content-Type: application/json" \
  -d '{"model": "wavespeed/anthropic/claude-opus-4.8", "messages": [{"role": "user", "content": "hi"}]}'

with a proxy config entry of model: wavespeed/anthropic/claude-opus-4.8, then checking the spend log at http://localhost:4000/ui/?page=logs shows a non-zero cost computed from the new cost map entry

Type

🆕 New Feature

Changes

WaveSpeedAI's LLM service is an OpenAI-compatible gateway at https://llm.wavespeed.ai/v1 that also natively exposes /v1/responses and Anthropic /v1/messages, so it fits the existing JSON provider registry rather than needing a Python config class; providers.json gains a wavespeed entry declaring those three endpoints, WAVESPEED_API_KEY, and WAVESPEED_API_BASE, and the usual registration points (LlmProviders, openai_compatible_providers, openai_compatible_endpoints, api-base autodetection in get_llm_provider, provider_endpoints_support.json) are updated to match

WaveSpeed model ids already carry an upstream provider prefix (anthropic/claude-opus-4.8), so a route reads wavespeed/anthropic/claude-opus-4.8 and only the leading wavespeed/ may be stripped; there's a test pinning that, since this is where the OpenRouter-style double-prefix bug would show up

The 92 cost map entries were generated from WaveSpeed's public catalog at https://llm.wavespeed.ai/v1/models, which publishes context windows, per-token prices, cache prices and per-model supported_parameters; those map to max_input_tokens / max_output_tokens, input_cost_per_token / output_cost_per_token, cache_read_input_token_cost / cache_creation_input_token_cost (plus cache_creation_input_token_cost_above_1hr for the Claude 1h cache tier), and the supports_function_calling / supports_tool_choice / supports_response_schema / supports_reasoning / supports_web_search flags. Models with tiered long-context pricing (Qwen, Gemini, MiniMax) get input_cost_per_token_above_256k_tokens-style keys derived from the catalog's conditional_prices, so a 300k-token Qwen 3.6 Flash request bills at the long-context rate

The catalog publishes no vision, pdf, adaptive-thinking or sampling-param flags, so those four are inherited from the canonical cost map entry for the same underlying model when one exists (wavespeed/anthropic/claude-fable-5 picks up supports_adaptive_thinking: true and supports_sampling_params: false from claude-fable-5, which the repo's cross-variant consistency tests require); models with no canonical counterpart simply omit them rather than being guessed from the name. Media generation (/v1/predictions, the Replicate-style async submit/poll API in the issue) is a separate surface and isn't part of this PR

Final Attestation

  • The tests check the right things, including the edge cases, and regressions in the respective real-world customer use-cases are not possible after this PR

Link to Devin session: https://app.devin.ai/sessions/e43399c20a854c7c90fc003efacc40f7

@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@greptile-apps

greptile-apps Bot commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

Adds WaveSpeedAI as a JSON-configured OpenAI-compatible provider, including provider resolution, Chat Completions, Responses and Messages endpoint registration, model pricing and capability metadata, and focused provider and cost-calculation tests

Confidence Score: 5/5

The PR appears safe to merge; the new provider follows the existing JSON-configured OpenAI-compatible integration paths without an identified actionable defect

Provider resolution, enum and registry wiring, endpoint configuration, model-prefix preservation, and pricing fields are coordinated, and the specialized pricing keys are supported by the existing generic cost-calculation path

Important Files Changed

Filename Overview
litellm/llms/openai_like/providers.json Registers WaveSpeedAI through the existing JSON provider framework with the expected credentials, base URL, and supported API surfaces
litellm/litellm_core_utils/get_llm_provider_logic.py Adds API-base autodetection for WaveSpeedAI while preserving the established provider-prefix resolution behavior
litellm/constants.py Adds WaveSpeedAI to the OpenAI-compatible endpoint and provider registries
litellm/types/utils.py Adds the WaveSpeedAI provider identifier to the central provider enum
model_prices_and_context_window.json Adds WaveSpeed model pricing, context limits, conditional pricing tiers, and capability metadata using fields consumed by the existing cost calculator
litellm/model_prices_and_context_window_backup.json Mirrors the WaveSpeed model metadata in the local backup cost map
provider_endpoints_support.json Advertises the three API surfaces declared by the WaveSpeed JSON provider configuration
tests/test_litellm/llms/openai_like/test_wavespeed_provider.py Covers provider registration, prefix preservation, environment resolution, endpoint URL generation, model capabilities, standard cost calculation, and long-context pricing

Reviews (1): Last reviewed commit: "feat(wavespeed): add WaveSpeedAI as an O..." | Re-trigger Greptile

@codecov

codecov Bot commented Jul 25, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@codspeed-hq

codspeed-hq Bot commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 31 untouched benchmarks


Comparing litellm_wavespeed_provider (c6eec29) with litellm_internal_staging (b9b27c2)

Open in CodSpeed

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