deepseek_api 0.0.1 copy "deepseek_api: ^0.0.1" to clipboard
deepseek_api: ^0.0.1 copied to clipboard

A Flutter package for integrating with DeepSeek's API. Supports chat completions, model management, and streaming.

= DeepSeek API Flutter Package :badge-version: https://img.shields.io/pub/v/deepseek_api :badge-license: https://img.shields.io/badge/License-MIT-yellow.svg

image:{badge-version}[Pub Version, link=https://pub.dev/packages/deepseek_api] image:{badge-license}[License: MIT, link=https://opensource.org/licenses/MIT]

A modern Flutter package for seamless integration with DeepSeek's powerful AI APIs. Supports all major features including chat completions, model management, and streaming.

== Installation

Add to your pubspec.yaml:

[source,yaml] #

dependencies: deepseek_api: ^0.1.0 #

Run: [source,bash] #

flutter pub get #

== Initialization

[source,dart] #

import 'package:deepseek_api/deepseek_api.dart';

final deepseek = DeepSeekClient( apiKey: 'your-api-key', // Optional: baseUrl: 'https://api.deepseek.com/v1' (default) ); #

link:https://platform.deepseek.com/api-keys[🔗 Get API Key] | link:https://www.deepseek.com/pricing[💵 Pricing Details]

== Quick Start

=== Basic Chat Completion

[source,dart] #

final response = await deepseek.createChatCompletion( ChatCompletionRequest( model: 'deepseek-chat', messages: [ ChatMessage( role: 'user', content: 'Explain quantum computing in 50 words' ) ], temperature: 0.7, maxTokens: 100, ), );

print(response.choices.first.message.content); #

=== Streaming Responses

[source,dart] #

final response = await deepseek.createChatCompletion( ChatCompletionRequest( model: 'deepseek-chat', messages: [/* your messages */], stream: true, ), );

// Handle stream using Dio's response stream #

== Supported Models

=== Latest Models (2024)

[cols="1,2,1", options="header"] |=== | Model ID | Description | Best For | deepseek-chat | General purpose chat model | Everyday conversations | deepseek-coder | Code-focused model | Programming assistance | deepseek-math | Advanced mathematical reasoning | Complex calculations | deepseek-chat-pro | Premium chat model | Enterprise applications |===

link:https://platform.deepseek.com/docs/models[🔍 Full Model List] | link:https://status.deepseek.com[🔄 Model Updates]

== Parameters Reference

=== ChatCompletionRequest

[cols="1,1,1,3", options="header"] |=== | Parameter | Type | Default | Description | model | String | Required | The model ID to use | messages | List | Required | Conversation history as ChatMessage objects | temperature | double? | 1.0 | Creativity control (0.0-2.0) | maxTokens | int? | null | Maximum number of tokens to generate | topP | double? | 1.0 | Nucleus sampling threshold (0.0-1.0) | frequencyPenalty | double? | 0.0 | Penalize new tokens based on frequency (-2.0 to 2.0) | presencePenalty | double? | 0.0 | Penalize new tokens based on presence (-2.0 to 2.0) | stop | List? | null | Up to 4 sequences where the API will stop generating | stream | bool? | false | Whether to stream back partial progress | user | String? | null | Unique identifier for end-user |===

== Advanced Features

=== Model Management

[source,dart] #

// List all available models final models = await deepseek.listModels(); print(models.data.map((m) => m.id).join(', ')); #

=== Error Handling

[source,dart] #

try { // API call } on RateLimitException catch (e) { print('Slow down! ${e.message}'); } on ApiException catch (e) { print('API Error: ${e.message}'); } on NetworkException { print('Check your internet connection'); } #

=== Custom Configuration

[source,dart] #

final customDio = Dio() ..interceptors.add(LogInterceptor());

final client = DeepSeekClient( apiKey: 'your-key', baseUrl: 'https://api.deepseek.com/v2', // Custom endpoint dio: customDio, // Inject custom Dio client ); #

== API Resources

  • link:https://platform.deepseek.com/docs[Official Documentation]
  • link:https://status.deepseek.com[API Status Dashboard]
  • link:https://www.deepseek.com/pricing-calculator[Pricing Calculator]
  • link:https://platform.deepseek.com/docs/rate-limits[Rate Limits Guide]

== Contributing

We welcome contributions! Please:

  1. Fork the repository
  2. Create your feature branch
  3. Submit a PR with tests

link:https://github.com/your/repo/issues[Report Issues] | link:https://github.com/your/repo[View Source]

== License

MIT License - See link:https://github.com/your/repo/blob/main/LICENSE[LICENSE] for details


Disclaimer: This package is not officially affiliated with DeepSeek. Always refer to the link:https://platform.deepseek.com/docs[official API documentation] for the most accurate information.

12
likes
0
points
82
downloads

Publisher

unverified uploader

Weekly Downloads

A Flutter package for integrating with DeepSeek's API. Supports chat completions, model management, and streaming.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

dio, flutter, json_annotation

More

Packages that depend on deepseek_api