feat: tokens usage (#2300)

This commit is contained in:
yetone
2025-06-23 03:13:37 +08:00
committed by GitHub
parent 7daf169228
commit 6830f2d8b9
7 changed files with 131 additions and 41 deletions

View File

@@ -237,6 +237,7 @@ M._defaults = {
endpoint = "https://api.openai.com/v1",
model = "gpt-4o",
timeout = 30000, -- Timeout in milliseconds, increase this for reasoning models
context_window = 128000, -- Number of tokens to send to the model for context
extra_request_body = {
temperature = 0.75,
max_completion_tokens = 16384, -- Increase this to include reasoning tokens (for reasoning models)
@@ -250,6 +251,7 @@ M._defaults = {
proxy = nil, -- [protocol://]host[:port] Use this proxy
allow_insecure = false, -- Allow insecure server connections
timeout = 30000, -- Timeout in milliseconds
context_window = 128000, -- Number of tokens to send to the model for context
extra_request_body = {
temperature = 0.75,
max_tokens = 20480,
@@ -294,6 +296,7 @@ M._defaults = {
endpoint = "https://generativelanguage.googleapis.com/v1beta/models",
model = "gemini-2.0-flash",
timeout = 30000, -- Timeout in milliseconds
context_window = 1048576,
extra_request_body = {
generationConfig = {
temperature = 0.75,