1// Package groq provides a Fantasy provider for the Groq API.
2package groq
3
4import (
5 "charm.land/fantasy"
6 "charm.land/fantasy/providers/openaicompat"
7)
8
9const (
10 // Name is the provider identifier for Groq.
11 Name = "groq"
12 // BaseURL is the default Groq API base URL.
13 BaseURL = "https://api.groq.com/openai/v1"
14)
15
16// Option configures the Groq provider via OpenAI-compatible options.
17type Option = openaicompat.Option
18
19var (
20 // WithBaseURL is an alias for openaicompat.WithBaseURL.
21 WithBaseURL = openaicompat.WithBaseURL
22 // WithAPIKey is an alias for openaicompat.WithAPIKey.
23 WithAPIKey = openaicompat.WithAPIKey
24 // WithHeaders is an alias for openaicompat.WithHeaders.
25 WithHeaders = openaicompat.WithHeaders
26 // WithHTTPClient is an alias for openaicompat.WithHTTPClient.
27 WithHTTPClient = openaicompat.WithHTTPClient
28 // WithSDKOptions is an alias for openaicompat.WithSDKOptions.
29 WithSDKOptions = openaicompat.WithSDKOptions
30)
31
32// New creates a new Groq provider using OpenAI-compatible transport/options.
33func New(opts ...Option) (fantasy.Provider, error) {
34 options := []Option{
35 openaicompat.WithName(Name),
36 WithBaseURL(BaseURL),
37 }
38 options = append(options, opts...)
39 return openaicompat.New(options...)
40}