Skip to main content
Dify is an open-source LLM application development platform that enables you to quickly build AI applications. Through APIYI, you can use various mainstream AI models in Dify.

Quick Integration

1. Get API Key

Visit APIYI Console to get your API key.

2. Configure Model Provider

  1. Log in to Dify platform
  2. Click username > Settings
  3. Select “Model Provider” - choose OpenAI-API-compatible
  4. Select configuration method based on model type
Dify-OpenAI-API-compatible

Configuration for All Models Including GPT, Claude, Gemini

  • Model Type: Select LLM type (first column, image omitted)
  • Model Name: Must enter the standard model name, not arbitrary
    • Example: Enter gemini-2.5-flash instead of Gemini 2.5 Flash
  • Model Display Name: Can be anything for easy identification, such as Gemini 2.5 Flash
  • API Key: Enter APIYI key
  • API endpoint URL: https://api.apiyi.com/v1
  • Model name in API endpoint: Use standard name like gemini-2.5-flash
Dify Model Addition Step 2 Model configuration has many parameters to update based on actual situation: Note: Dify’s model configuration interface is not up to date, for example, the default context length of 4096 is quite small. For specific context length of each large model, refer to official documentation (Resource Navigation section in this documentation center) Dify Model Addition Step 3 More parameters available Dify Model Addition Step 4

Core Features

Chat Assistant

Create intelligent chat assistants:
  1. Select “Chat Assistant” template
  2. Configure system prompt:
  1. Select appropriate model (e.g., GPT-4)
  2. Adjust parameters:
    • Temperature: 0.7 (balance creativity and accuracy)
    • Max Output: 2000 tokens

Workflow Application

Build complex AI workflows:

Knowledge Base Q&A

Integrate document knowledge base:
  1. Create knowledge base
  2. Upload documents (PDF, Word, Markdown)
  3. Select embedding model: text-embedding-ada-002
  4. Reference knowledge base in application
  5. Configure retrieval parameters:
    • Retrieval count: 3-5 segments
    • Similarity threshold: 0.7
    • Reranking: Enabled

Application Types

1. Chat Assistant

2. Document Analysis

3. Code Assistant

Advanced Features

API Integration

Dify applications can be called via API:

Batch Processing

Process large amounts of data:
  1. Prepare CSV file
  2. Create batch task
  3. Configure processing template
  4. Execute batch task
  5. Export results

Multimodal Application

Supports mixed text and image processing:

Model Selection Strategy

Selection by Scenario

Cost Optimization

Best Practices

1. Prompt Optimization

2. Workflow Design

3. Monitoring and Optimization

Regular checks:
  • User satisfaction feedback
  • Response time statistics
  • Cost usage
  • Error rate analysis

4. Version Management

  • Regularly backup application configuration
  • Test new versions before release
  • Keep multiple versions for rollback

Troubleshooting

Common Issues

Model Call Failure

  • Check API key correctness
  • Confirm sufficient account balance
  • Verify network connection

Poor Response Quality

  • Optimize prompt design
  • Adjust model parameters
  • Add context information

Performance Issues

  • Select faster models
  • Reduce output length limits
  • Enable caching

Performance Optimization

Deployment Recommendations

Production Environment

Security Configuration

  • Use environment variables to store sensitive information
  • Enable HTTPS access
  • Set access control
  • Regularly update dependencies

Monitoring Setup

Need more help? Please check the Detailed Integration Documentation.