Skip to content

List available LLM providers, retrieve supported authentication methods, and complete OAuth authorization flows for connecting providers to a workspace.

GET /api/v1/workspaces/{workspaceID}/providers

Section titled “GET /api/v1/workspaces/{workspaceID}/providers”

Get a list of all available AI providers, including both available and connected ones. Returns the full provider catalog, the default model mapping, and which providers are currently connected in the workspace.

NameInTypeRequiredDescription
workspaceIDpathstringYesWorkspace identifier
{
"all": [
{
"name": "Anthropic",
"env": ["ANTHROPIC_API_KEY"],
"id": "anthropic",
"npm": "@ai-sdk/anthropic",
"api": "https://api.anthropic.com",
"models": {}
},
{
"name": "OpenAI",
"env": ["OPENAI_API_KEY"],
"id": "openai",
"npm": "@ai-sdk/openai",
"api": "https://api.openai.com/v1",
"models": {}
}
],
"default": {
"anthropic": "claude-sonnet-4-20250514",
"openai": "gpt-4o"
},
"connected": ["anthropic"]
}
const providers = await client.agent.providers.list({
workspaceID: "ws_01HXYZABCDEF"
});

GET /api/v1/workspaces/{workspaceID}/providers/auth

Section titled “GET /api/v1/workspaces/{workspaceID}/providers/auth”

Retrieve the available authentication methods for all AI providers. Returns a map keyed by provider ID, where each value is an array of supported auth methods (OAuth, API key, etc.).

NameInTypeRequiredDescription
workspaceIDpathstringYesWorkspace identifier
{
"anthropic": [
{ "type": "api", "label": "API Key" }
],
"openai": [
{ "type": "api", "label": "API Key" }
],
"google": [
{ "type": "oauth", "label": "Google OAuth" },
{ "type": "api", "label": "API Key" }
]
}
const methods = await client.agent.providers.getAuthMethods({
workspaceID: "ws_01HXYZABCDEF"
});

POST /api/v1/workspaces/{workspaceID}/providers/{providerID}/oauth/authorize

Section titled “POST /api/v1/workspaces/{workspaceID}/providers/{providerID}/oauth/authorize”

Initiate OAuth authorization for a specific AI provider. Returns the authorization URL the user should be redirected to, the method used (auto or code), and any user-facing instructions.

NameInTypeRequiredDescription
providerIDpathstringYesProvider ID
workspaceIDpathstringYesWorkspace identifier
NameTypeRequiredDescription
methodnumberYesAuth method index
{
"method": 0
}
{
"url": "https://accounts.google.com/o/oauth2/v2/auth?client_id=1234567890&redirect_uri=https%3A%2F%2Fhoody.com%2Fcallback&scope=openid+email+profile&response_type=code",
"method": "auto",
"instructions": "Visit the URL to grant access. You will be redirected back automatically."
}
const auth = await client.agent.providers.authorizeOAuth({
workspaceID: "ws_01HXYZABCDEF",
providerID: "google",
data: {
method: 0
}
});

POST /api/v1/workspaces/{workspaceID}/providers/{providerID}/oauth/callback

Section titled “POST /api/v1/workspaces/{workspaceID}/providers/{providerID}/oauth/callback”

Handle the OAuth callback from a provider after the user completes authorization. Exchanges the authorization code for an access token and connects the provider to the workspace.

NameInTypeRequiredDescription
providerIDpathstringYesProvider ID
workspaceIDpathstringYesWorkspace identifier
NameTypeRequiredDescription
methodnumberYesAuth method index
codestringNoOAuth authorization code
{
"method": 0,
"code": "4/0AQlEd8xCjYYSAMPLE_CODE_HERE"
}
true
const connected = await client.agent.providers.callbackOAuth({
workspaceID: "ws_01HXYZABCDEF",
providerID: "google",
data: {
method: 0,
code: "4/0AQlEd8xCjYYSAMPLE_CODE_HERE"
}
});