Skip to content

Add Replicate.com provider support#652

Draft
Copilot wants to merge 3 commits intomainfrom
copilot/add-replicate-api-provider
Draft

Add Replicate.com provider support#652
Copilot wants to merge 3 commits intomainfrom
copilot/add-replicate-api-provider

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Dec 26, 2025

The @ai-sdk/replicate package only supports image models, not language models (vercel/ai#4918). This PR implements a custom Replicate provider that directly uses Replicate's HTTP API with streaming support.

Changes

  • src/replicate.ts - New custom ReplicateLanguageModel implementing AI SDK's LanguageModelV2 interface

    • SSE streaming with polling fallback
    • Chat message formatting to Replicate's prompt format
    • Model parameters: temperature, max_new_tokens, top_p, top_k, stop_sequences
  • src/llms.ts - Use custom provider instead of @ai-sdk/replicate

  • package.json - Add "Replicate" to provider enum

Usage

Provider: Replicate
Model: deepseek-ai/deepseek-r1
       anthropic/claude-3.7-sonnet
       meta/llama-3-70b-instruct

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • googlechromelabs.github.io
    • Triggering command: /usr/local/bin/node /usr/local/bin/node install.mjs (dns block)
  • https://storage.googleapis.com/chrome-for-testing-public/143.0.7499.42/linux64/chrome-linux64.zip
    • Triggering command: /usr/local/bin/node /usr/local/bin/node install.mjs (http block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>add provider replicate.com</issue_title>
<issue_description>### Describe the feature

hi
Can add new API provider.

https://replicate.com/collections/language-models

there is many models like
https://replicate.com/deepseek-ai/deepseek-r1/api
and
https://replicate.com/anthropic/claude-3.7-sonnet</issue_description>

<agent_instructions>write a custom replicate provider in our own code, refer the links mentioned in this issue for its docs</agent_instructions>

Comments on the Issue (you are @copilot in this section)

@feiskyer this doesn't work yet due to https://github.com/vercel/ai/issues/4918

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits December 26, 2025 14:24
…mentation

Co-authored-by: feiskyer <676637+feiskyer@users.noreply.github.com>
Co-authored-by: feiskyer <676637+feiskyer@users.noreply.github.com>
Copilot AI changed the title [WIP] Add new API provider replicate.com Add Replicate.com provider support Dec 26, 2025
Copilot AI requested a review from feiskyer December 26, 2025 14:30
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.

add provider replicate.com

2 participants