Skip to main content

Model Endpoints API

DeepWiki provides a flexible provider-based model selection system that supports multiple LLM providers. This documentation covers the model-related API endpoints and how to work with different model providers.

Overview

DeepWiki’s model provider system allows you to choose from various AI model providers including:
  • Google - Gemini models
  • OpenAI - GPT models
  • OpenRouter - Access to multiple model providers through a unified API
  • Azure OpenAI - Azure-hosted OpenAI models
  • Ollama - Locally running open-source models
  • AWS Bedrock - Amazon’s managed AI models
  • DashScope - Alibaba’s AI models
Each provider offers different models with specific capabilities and pricing. The system is designed to be extensible, allowing service providers to add custom models as needed.

Authentication

Before using any model provider, you need to configure the appropriate API keys as environment variables:

Endpoints

Get Model Configuration

Retrieves the available model providers and their supported models.

Response

Example Requests

cURL:
Python:
JavaScript:

Using Models in Chat Completions

The model selection is integrated into the chat completions endpoint. You specify the provider and model when making requests.

Request Body

Parameters

ParameterTypeRequiredDescription
repo_urlstringYesURL of the repository to analyze
messagesarrayYesArray of chat messages
providerstringNoModel provider ID (default: “google”)
modelstringNoModel ID for the specified provider (uses provider’s default if not specified)
languagestringNoLanguage for content generation (default: “en”)
tokenstringNoPersonal access token for private repositories
typestringNoRepository type: “github”, “gitlab”, or “bitbucket” (default: “github”)

Example Requests

cURL with Google Gemini:
Python with OpenAI:
JavaScript with OpenRouter:

Model Provider Details

Google (Gemini)

Default provider with fast and capable models. Available Models:
  • gemini-2.0-flash - Fast, efficient model (default)
  • gemini-2.5-flash-preview-05-20 - Preview of upcoming flash model
  • gemini-2.5-pro-preview-03-25 - Preview of pro model
Configuration:

OpenAI

Industry-standard GPT models. Available Models:
  • gpt-4o - Latest GPT-4 model (default)
  • gpt-4.1 - Updated GPT-4 version
  • o1 - Reasoning model
  • o3 - Advanced model
  • o4-mini - Smaller, faster model
Configuration:

OpenRouter

Access multiple model providers through a unified API. Available Models:
  • openai/gpt-4o - OpenAI GPT-4 (default)
  • deepseek/deepseek-r1 - DeepSeek reasoning model
  • anthropic/claude-3.7-sonnet - Claude 3.7 Sonnet
  • anthropic/claude-3.5-sonnet - Claude 3.5 Sonnet
  • And many more…
Configuration:

Azure OpenAI

Azure-hosted OpenAI models with enterprise features. Available Models:
  • gpt-4o - GPT-4 on Azure (default)
  • gpt-4 - Standard GPT-4
  • gpt-35-turbo - GPT-3.5 Turbo
  • gpt-4-turbo - GPT-4 Turbo
Configuration:
Note: Requires Azure OpenAI endpoint and API version configuration.

Ollama

Run models locally for privacy and cost efficiency. Available Models:
  • qwen3:1.7b - Small, fast model (default)
  • llama3:8b - Llama 3 8B model
  • qwen3:8b - Qwen 3 8B model
Configuration:
Note: Requires Ollama to be running locally or accessible via OLLAMA_HOST.

AWS Bedrock

Amazon’s managed AI service. Available Models:
  • anthropic.claude-3-sonnet-20240229-v1:0 - Claude 3 Sonnet (default)
  • anthropic.claude-3-haiku-20240307-v1:0 - Claude 3 Haiku
  • anthropic.claude-3-opus-20240229-v1:0 - Claude 3 Opus
  • amazon.titan-text-express-v1 - Amazon Titan
  • cohere.command-r-v1:0 - Cohere Command R
  • ai21.j2-ultra-v1 - AI21 Jurassic
Configuration:

DashScope

Alibaba’s AI models. Available Models:
  • qwen-plus - Qwen Plus (default)
  • qwen-turbo - Qwen Turbo
  • deepseek-r1 - DeepSeek R1
Configuration:

Custom Models

Providers that support custom models (where supportsCustomModel: true) allow you to specify model IDs not listed in the predefined options. This is useful for:
  • Newly released models
  • Fine-tuned models
  • Private or custom deployments
Example with custom model:

Error Handling

The API returns standard HTTP status codes and error messages.

Common Errors

400 Bad Request:
401 Unauthorized:
404 Not Found:
500 Internal Server Error:

Error Handling Examples

Python:
JavaScript:

Rate Limiting

Rate limiting depends on the model provider being used:
  • Google Gemini: Subject to Google AI Studio quotas
  • OpenAI: Based on your OpenAI tier and usage
  • OpenRouter: Depends on the specific model and your OpenRouter credits
  • Azure OpenAI: Based on your Azure deployment quotas
  • Ollama: Limited by local hardware resources
  • AWS Bedrock: Subject to AWS service quotas
  • DashScope: Based on Alibaba Cloud quotas
It’s recommended to implement retry logic with exponential backoff for production applications.

Best Practices

  1. Model Selection: Choose models based on your specific needs:
    • Use faster models (e.g., gemini-2.0-flash, gpt-4o-mini) for simple queries
    • Use more capable models (e.g., gpt-4o, claude-3.5-sonnet) for complex analysis
  2. Error Handling: Always implement proper error handling for API calls
  3. Streaming: The chat endpoint supports streaming responses for better user experience
  4. Caching: DeepWiki automatically caches wiki generation results to improve performance
  5. Security: Never expose API keys in client-side code; use environment variables
  6. Cost Optimization: Monitor usage and costs, especially with premium models

Configuration Files

DeepWiki uses JSON configuration files to manage model settings:
  • api/config/generator.json - Model provider configurations
  • api/config/embedder.json - Embedding model settings
  • api/config/repo.json - Repository processing settings
You can customize these files or use the DEEPWIKI_CONFIG_DIR environment variable to specify a custom configuration directory.