Skip to main content
Registers an external AI service provider in the cluster. A single, unified AI-provider registry holds providers of different types and keeps one default per type:
  • embedding — supplies an endpoint for ai_embed. The semantic-context module uses an OpenAI-compatible /v1/embeddings endpoint for CONTEXT UPSERT and query_text searches.
  • chat — supplies a chat completion endpoint for ai_complete and other chat functions.
The provider object — including the api_key property — is persisted on the FE metadata journal and image, so cluster restarts and upgrades retain the credential. There is no fe.conf knob for these settings.
CAUTION Anyone with read access to the FE meta image / BDB journal directory can read provider api_key values; protect those files with filesystem permissions.
For SQL AI functions, both openai and dashscope Providers support HTTP and HTTPS with or without an API key. A nonempty key produces an Authorization: Bearer ... header. URL format, control-character, DNS, and address validation still apply. Use a trusted endpoint and data approved for transmission. Set a default with SET <provider_name> AS DEFAULT AI PROVIDER. If the corresponding default is absent, FE rejects implicit Provider calls, including EXPLAIN. Each execution plan captures its selected Provider configuration. ALTER and default changes affect newly planned queries; each prepared EXECUTE replans against current metadata.

Privileges

Creating or managing providers requires SYSTEM OPERATE. Calling a provider through an AI function requires both the AI function privilege and USAGE on that AI PROVIDER. Creating a provider does not automatically grant usage to ordinary users.

Syntax

Parameters

PROPERTIES

SQL AI function endpoints

For Alibaba Cloud Model Studio (Bailian), use openai with /compatible-mode/v1/... endpoints and dashscope with native endpoints. For dashscope, set endpoint to the full native URL for the operation. Its path must match the Provider TYPE. Overriding model in SQL still sends requests to the configured endpoint. See the supported inputs by endpoint and the Model Studio multimodal embedding API.

Examples

Register an embedding provider and make it the default for the embedding type:
The following example registers a chat Provider using the native Model Studio multimodal generation endpoint.

See also