Skip to content

Commit 9db68bb

Browse files
committed
gptel: Add describe-gptel-model feature
* gptel.el (gptel--openai-cost-url, gptel--openai-models): Add :cost-url for OpenAI pricing web page. * gptel.el (describe-gptel-model): New function to display a description of a gptel model in *Help* buffer. * gptel-anthropic.el (gptel--anthropic-cost-url, gptel--anthropic-models): Add :cost-url for Claude pricing web page. Add :max-output for maximum output tokens. * gptel-openai-extras.el (gptel-make-deepseek): Add :cost-url and :max-output for DeepSeek. * gptel-transient.el (gptel-menu): Add new subsection "Info" and a new command "Describe model" (bound to `h') to describe the current selected model.
1 parent 7de8e88 commit 9db68bb

File tree

5 files changed

+147
-5
lines changed

5 files changed

+147
-5
lines changed

gptel-anthropic.el

+21-1
Original file line numberDiff line numberDiff line change
@@ -468,45 +468,58 @@ files in the context."
468468
;; (t context-string)))
469469
;; (plist-get (car (last prompts)) :content)))
470470

471+
(defconst gptel--anthropic-cost-url "https://docs.anthropic.com/en/docs/about-claude/models#model-comparison-table"
472+
"Web page for current Anthropic model pricing.")
473+
471474
(defconst gptel--anthropic-models
472-
'((claude-3-7-sonnet-20250219
475+
`((claude-3-7-sonnet-20250219
473476
:description "Hybrid model capable of standard thinking and extended thinking modes"
474477
:capabilities (media tool-use cache)
475478
:mime-types ("image/jpeg" "image/png" "image/gif" "image/webp" "application/pdf")
476479
:context-window 200
480+
:max-output 8192
477481
:input-cost 3
478482
:output-cost 15
483+
:cost-url ,gptel--anthropic-cost-url
479484
:cutoff-date "2025-02")
480485
(claude-3-5-sonnet-20241022
481486
:description "Highest level of intelligence and capability"
482487
:capabilities (media tool-use cache)
483488
:mime-types ("image/jpeg" "image/png" "image/gif" "image/webp" "application/pdf")
484489
:context-window 200
490+
:max-output 8192
485491
:input-cost 3
486492
:output-cost 15
493+
:cost-url ,gptel--anthropic-cost-url
487494
:cutoff-date "2024-04")
488495
(claude-3-5-sonnet-20240620
489496
:description "Highest level of intelligence and capability (earlier version)"
490497
:capabilities (media tool-use cache)
491498
:mime-types ("image/jpeg" "image/png" "image/gif" "image/webp")
492499
:context-window 200
500+
:max-output 8192
493501
:input-cost 3
494502
:output-cost 15
503+
:cost-url ,gptel--anthropic-cost-url
495504
:cutoff-date "2024-04")
496505
(claude-3-5-haiku-20241022
497506
:description "Intelligence at blazing speeds"
498507
:capabilities (tool-use cache)
499508
:context-window 200
509+
:max-output 8192
500510
:input-cost 1.00
501511
:output-cost 5.00
512+
:cost-url ,gptel--anthropic-cost-url
502513
:cutoff-date "2024-07")
503514
(claude-3-opus-20240229
504515
:description "Top-level performance, intelligence, fluency, and understanding"
505516
:capabilities (media tool-use cache)
506517
:mime-types ("image/jpeg" "image/png" "image/gif" "image/webp")
507518
:context-window 200
519+
:max-output 4096
508520
:input-cost 15
509521
:output-cost 75
522+
:cost-url ,gptel--anthropic-cost-url
510523
:cutoff-date "2023-08")
511524
(claude-3-sonnet-20240229
512525
:description "Balance of intelligence and speed (legacy model)"
@@ -515,13 +528,16 @@ files in the context."
515528
:context-window 200
516529
:input-cost 3
517530
:output-cost 15
531+
:cost-url ,gptel--anthropic-cost-url
518532
:cutoff-date "2023-08")
519533
(claude-3-haiku-20240307
520534
:description "Fast and most compact model for near-instant responsiveness"
521535
:capabilities (tool-use cache)
522536
:context-window 200
537+
:max-output 4096
523538
:input-cost 0.25
524539
:output-cost 1.25
540+
:cost-url ,gptel--anthropic-cost-url
525541
:cutoff-date "2023-08"))
526542
"List of available Anthropic models and associated properties.
527543
Keys:
@@ -534,10 +550,14 @@ Keys:
534550
535551
- `:context-window': the context window size, in thousands of tokens.
536552
553+
- `:max-output': the maximum number of output tokens.
554+
537555
- `:input-cost': the input cost, in US dollars per million tokens.
538556
539557
- `:output-cost': the output cost, in US dollars per million tokens.
540558
559+
- `:cost-url': web page for current model pricing.
560+
541561
- `:cutoff-date': the knowledge cutoff date.
542562
543563
- `:request-params': a plist of additional request parameters to

gptel-gemini.el

+20-1
Original file line numberDiff line numberDiff line change
@@ -313,16 +313,21 @@ files in the context."
313313
current))
314314
(plist-get (car (last prompts)) :parts))))
315315

316+
(defconst gptel--gemini-cost-url "https://ai.google.dev/pricing"
317+
"Web page for current Gemini model pricing.")
318+
316319
(defconst gptel--gemini-models
317-
'((gemini-1.5-pro-latest
320+
`((gemini-1.5-pro-latest
318321
:description "Google's latest model with enhanced capabilities across various tasks"
319322
:capabilities (tool-use json media)
320323
:mime-types ("image/png" "image/jpeg" "image/webp" "image/heic" "image/heif"
321324
"application/pdf" "text/plain" "text/csv" "text/html")
322325
:context-window 2000
326+
:max-output 8192
323327
;; input & output price is halved for prompts of 128k tokens or less
324328
:input-cost 2.50
325329
:output-cost 10
330+
:cost-url ,gptel--gemini-cost-url
326331
:cutoff-date "2024-05")
327332
(gemini-2.0-flash-exp
328333
:description "Next generation features, superior speed, native tool use"
@@ -337,19 +342,23 @@ files in the context."
337342
:mime-types ("image/png" "image/jpeg" "image/webp" "image/heic" "image/heif"
338343
"application/pdf" "text/plain" "text/csv" "text/html")
339344
:context-window 1000
345+
:max-output 8192
340346
;; input & output price is halved for prompts of 128k tokens or less
341347
:input-cost 0.15
342348
:output-cost 0.60
349+
:cost-url ,gptel--gemini-cost-url
343350
:cutoff-date "2024-05")
344351
(gemini-1.5-flash-8b
345352
:description "High volume and lower intelligence tasks"
346353
:capabilities (tool-use json media)
347354
:context-window 1000
355+
:max-output 8192
348356
:mime-types ("image/png" "image/jpeg" "image/webp" "image/heic" "image/heif"
349357
"application/pdf" "text/plain" "text/csv" "text/html")
350358
;; input & output price is halved for prompts of 128k tokens or less
351359
:input-cost 0.075
352360
:output-cost 0.30
361+
:cost-url ,gptel--gemini-cost-url
353362
:cutoff-date "2024-10")
354363
(gemini-exp-1206
355364
:description "Improved coding, reasoning and vision capabilities"
@@ -363,28 +372,33 @@ files in the context."
363372
:mime-types ("image/png" "image/jpeg" "image/webp" "image/heic" "image/heif"
364373
"application/pdf" "text/plain" "text/csv" "text/html")
365374
:context-window 1000
375+
:max-output 8192
366376
:input-cost 0.10
367377
:output-cost 0.40
378+
:cost-url ,gptel--gemini-cost-url
368379
:cutoff-date "2024-08")
369380
(gemini-2.0-flash-lite-preview-02-05
370381
:description "Gemini 2.0 Flash model optimized for cost efficiency and low latency"
371382
:capabilities (json)
372383
:context-window 1000
373384
:input-cost 0.075
374385
:output-cost 0.30
386+
:cost-url ,gptel--gemini-cost-url
375387
:cutoff-date "2024-08")
376388
(gemini-2.0-pro-exp-02-05
377389
:description "Next gen, high speed, multimodal for a diverse variety of tasks"
378390
:capabilities (tool-use json)
379391
:context-window 2000
380392
:input-cost 0.00
381393
:output-cost 0.00
394+
:cost-url ,gptel--gemini-cost-url
382395
:cutoff-date "2024-08")
383396
(gemini-2.0-flash-thinking-exp-01-21
384397
:description "Next gen, high speed, multimodal for a diverse variety of tasks"
385398
:capabilities (json)
386399
:input-cost 0.00
387400
:output-cost 0.00
401+
:cost-url ,gptel--gemini-cost-url
388402
:cutoff-date "2024-08")
389403
(gemini-2.0-flash-exp
390404
:description "Multi-modal, streaming, tool use 2000 RPM"
@@ -394,6 +408,7 @@ files in the context."
394408
:context-window 1000
395409
:input-cost 0.00
396410
:output-cost 0.00
411+
:cost-url ,gptel--gemini-cost-url
397412
:cutoff-date "2024-08")
398413
(gemini-2.0-flash-thinking-exp
399414
:description "DEPRECATED: Please use gemini-2.0-flash-thinking-exp-01-21 instead."
@@ -413,10 +428,14 @@ Keys:
413428
414429
- `:context-window': the context window size, in thousands of tokens.
415430
431+
- `:max-output': maximum number of output tokens.
432+
416433
- `:input-cost': the input cost, in US dollars per million tokens.
417434
418435
- `:output-cost': the output cost, in US dollars per million tokens.
419436
437+
- `:cost-url': web page for current model pricing.
438+
420439
- `:cutoff-date': the knowledge cutoff date.
421440
422441
- `:request-params': a plist of additional request parameters to

gptel-openai-extras.el

+5-1
Original file line numberDiff line numberDiff line change
@@ -339,12 +339,16 @@ The Deepseek API requires strictly alternating roles (user/assistant) in message
339339
(models '((deepseek-reasoner
340340
:capabilities (tool reasoning)
341341
:context-window 64
342+
:max-output 8192
342343
:input-cost 0.55
343-
:output-cost 2.19)
344+
:output-cost 2.19
345+
:cost-url "https://api-docs.deepseek.com/quick_start/pricing/")
344346
(deepseek-chat
345347
:capabilities (tool)
346348
:context-window 64
349+
:max-output 8192
347350
:input-cost 0.27
351+
:cost-url "https://api-docs.deepseek.com/quick_start/pricing/"
348352
:output-cost 1.10))))
349353
"Register a DeepSeek backend for gptel with NAME."
350354
(declare (indent 1))

gptel-transient.el

+7
Original file line numberDiff line numberDiff line change
@@ -576,6 +576,13 @@ Also format its value in the Transient menu."
576576
(gptel--infix-context-add-file)
577577
(gptel--infix-context-remove-all)
578578
(gptel--suffix-context-buffer)]
579+
["" "Info"
580+
("h" "Describe model"
581+
(lambda ()
582+
"Describe the current gptel model."
583+
(interactive)
584+
(describe-gptel-model gptel-backend gptel-model))
585+
:transient t)]
579586
[:pad-keys t
580587
:if (lambda () (and gptel-use-tools gptel--known-tools))
581588
"" (:info

0 commit comments

Comments
 (0)