Create Chat
Create a new chat instance to interact with AI models.Constructor
Parameters
ChatConfig
required
Configuration object for the chat instance
string
required
Your API key for authentication
string
default:"gpt-3.5-turbo"
The AI model to use for chat completions
number
default:"1000"
Maximum number of tokens in the response
number
default:"0.7"
Controls randomness in responses (0-1)
number
default:"30000"
Request timeout in milliseconds
string
Custom base URL for the API endpoint
Response
Returns aChat instance that can be used to send messages and stream responses.
Example
Available Models
The 0G AI SDK connects to models running on the 0G decentralized compute network:Error Handling
The constructor will throw an error if:- No API key is provided and
ZG_API_KEYenvironment variable is not set - Invalid configuration parameters are passed