zai.go

 1// Package zai provides a Fantasy provider for the Z.ai Coding PaaS API.
 2package zai
 3
 4import (
 5	"charm.land/fantasy"
 6	"charm.land/fantasy/providers/openaicompat"
 7)
 8
 9const (
10	// Name is the provider identifier for Z.ai.
11	Name = "zai"
12	// BaseURL is the default Z.ai Coding PaaS API base URL.
13	BaseURL = "https://api.z.ai/api/coding/paas/v4"
14)
15
16// Option configures the Z.ai provider via OpenAI-compatible options.
17type Option = openaicompat.Option
18
19// New creates a new Z.ai provider using OpenAI-compatible transport/options.
20func New(opts ...Option) (fantasy.Provider, error) {
21	options := []Option{
22		openaicompat.WithName(Name),
23		openaicompat.WithBaseURL(BaseURL),
24	}
25	options = append(options, opts...)
26	return openaicompat.New(options...)
27}