Skip to main content
TrueFoundry allows you to connect and user models from providers like OpenAI, Anthropic, AWS Bedrock, Google Vertex AI, and many others providers from a single place. Once Added, these models can be used in truefoundry AI gateway and your applications. The models are saved as a provider Integrations in truefoundry. The group of models are saved as a provider account. You can add multiple models to a single provider account, the models in the same provider account are called integrations.
Replace YOUR_CONTROL_PLANE_URL with your actual TrueFoundry control plane URL and YOUR_API_KEY with your API key throughout this guide.

API Overview

Here is the curl command example to add a model as a provider account:
curl -X PUT "YOUR_CONTROL_PLANE_URL/api/svc/v1/apply" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "manifest": {
      "type": "provider-account/openai",
      "name": "my-openai-account",
      "auth_data": {
        "type": "openai-api-key",
        "api_key": "sk-..."
      },
      "integrations": [
        {
          "type": "openai-model",
          "name": "gpt-4",
          "model_name": "gpt-4",
          "model_type": "chat"
        }
      ]
    },
    "dryRun": false
  }'

Request Schema

The Apply API accepts a TrueFoundryApplyRequest object with the following structure:
manifest
ModelProviderAccount | ModelManifest | ArtifactManifest | Service | ...
required
The manifest object defining the resource to be created or updated. For model provider accounts, this should be a ModelProviderAccount object.
dryRun
boolean
default:"false"
When set to true, performs a dry run without actually creating or updating the resource. Useful for validation.

ModelProviderAccount Schema

For creating model provider accounts, the manifest should be a ModelProviderAccount object. This is a union type that can be one of any of the following provider account types: Supported Provider Account Types: Common Fields for All Provider Accounts:
type
string
required
The provider account type (e.g., “provider-account/openai”, “provider-account/anthropic”, etc.)
name
string
required
Name of the provider account. Must be 3-32 characters, lowercase alphanumeric with hyphens, cannot start with a number.
auth_data
object
required
Authentication data specific to the provider (API keys, credentials, etc.)
integrations
array
required
List of model integrations available through this provider account
collaborators
array
Optional list of users who have access to this provider account

Response Schema

{
  "id": "provider-account-123",
  "name": "my-openai-account",
  "fqn": "tenant-name/openai/my-openai-account",
  "provider": "openai",
  "manifest": {
    "type": "provider-account/openai",
    "name": "my-openai-account",
    "auth_data": {
      "type": "openai-api-key",
      "api_key": "sk-..."
    }
  },
  "integrations": [
    {
      "id": "integration-456",
      "name": "gpt-4",
      "fqn": "tenant-name/openai/my-openai-account/model/gpt-4",
      "type": "model",
      "manifest": {
        "type": "openai-model",
        "name": "gpt-4",
        "model_name": "gpt-4",
        "model_type": "chat"
      },
      "providerAccountFqn": "tenant-name/openai/my-openai-account",
      "createdBySubject": {
        "subjectSlug": "user@example.com"
      },
      "createdAt": "2024-01-15T10:30:00Z",
      "updatedAt": "2024-01-15T10:30:00Z"
    }
  ],
  "createdBySubject": {
    "subjectSlug": "user@example.com"
  },
  "createdAt": "2024-01-15T10:30:00Z",
  "updatedAt": "2024-01-15T10:30:00Z",
  "action": "CREATE"
}

Response Fields

id
string
Unique identifier for the provider account.
name
string
Name of the provider account.
fqn
string
Fully qualified name of the provider account (tenant/provider/name).
provider
string
The provider type (e.g., “openai”, “anthropic”, “aws-bedrock”).
manifest
object
The provider account manifest that was applied, excluding integrations.
integrations
array
List of provider integrations (models) associated with this account.
createdBySubject
object
Information about the user who created the provider account.
createdAt
string
Timestamp when the provider account was created.
updatedAt
string
Timestamp when the provider account was last updated.
action
string
The action performed: “CREATE” for new resources, “UPDATE” for existing ones.

Provider Account Examples

Error Handling

The API may return various error responses. Common scenarios include:
  • 400 Bad Request: Invalid manifest structure or missing required fields
  • 401 Unauthorized: Invalid or missing API key
  • 403 Forbidden: Insufficient permissions for the operation
  • 404 Not Found: Provider account not found
  • 409 Conflict: Provider account with the same name already exists
  • 422 Unprocessable Entity: Invalid provider credentials or configuration
I