Configuring AI providers and models
FileHold AI features use providers (the AI service, such as Anthropic, Google or Azure OpenAI, plus the credentials to reach it) and models (a specific model offered by a provider, such as Sonnet 5.5). Providers and models are configured through the FileHold REST API. This article is intended for IT staff and explains how to create, verify, update and remove them using the Swagger page, PowerShell and curl.
You must be signed in as a system administrator to create or change providers and models. You also need an API key (or equivalent secret) from each AI vendor you want to use. A provider cannot be created without its secret (except for self-hosted providers such as Ollama, which do not need one).
How providers and models relate
- A provider holds the connection details: type, endpoint URL and credentials.
- A model belongs to exactly one provider (through providerId) and defines the model name sent to the vendor, the file types users can attach and the credit weighting.
- Create the provider first. Use the id returned in the response as the providerId when you create its models.
The endpoints used in this article are:
| Method | Endpoint | Purpose |
|---|---|---|
| GET | /ai/providers | List providers |
| POST | /ai/providers | Create a provider |
| GET / PUT / DELETE | /ai/providers/{id} | Read, update or delete a provider |
| GET | /ai/providers/{id}/limits | Show credit usage and limit |
| GET | /ai/models | List models |
| POST | /ai/models | Create a model |
| GET / PUT / DELETE | /ai/models/{id} | Read, update or delete a model |
| POST | /ai/models/{id}/validate | Test that a model works |
Authentication
All calls require a valid FileHold session ID or token sent as a Bearer token in the Authorization header. The easiest way to get one is from a browser session that is already signed in to FileHold:
- Sign in to FileHold in your browser as a system administrator.
- Open the browser developer tools. In most browsers press F12, or use Ctrl+Shift+I (Cmd+Option+I on a Mac). If neither works, open the browser menu and look for Developer tools, More tools or Web Developer.
- Open the Network tab and refresh the page. Select any request to the FileHold API and look at its request headers for the Authorization: Bearer ... value. The same value is also stored in the fhslid cookie (Application or Storage tab, Cookies).
- Copy the value (without the word Bearer) and use it in the examples below.
The session ID is equivalent to your signed-in session. Treat it like a password and do not share it. It stops working when you sign out or the session expires. If calls start returning 401 Unauthorized, copy a fresh value.
Three ways to make the calls
Swagger page
The FileHold REST API includes an interactive Swagger page, served from the /FH/FileHold/API path of your FileHold web server (for example https://<server>/FH/FileHold/API/swagger).
- Open the Swagger page and click Authorize.
- Paste the session ID or token into the Value box and click Authorize, then Close.
- Expand the ai section, choose an endpoint, click Try it out, enter the JSON body if the endpoint needs one, and click Execute.
PowerShell
The PowerShell examples use Invoke-RestMethod. Set these variables once per session:
$base = "https://<server>/FH/FileHold/API"
$token = "<session ID or token>"
$headers = @{ Authorization = "Bearer $token" }
curl
The curl examples use these placeholders. In Windows PowerShell use curl.exe (plain curl is an alias for Invoke-WebRequest) and replace the \ line continuations with a backtick (`) or put the command on one line.
BASE="https://<server>/FH/FileHold/API" TOKEN="<session ID or token>"
Provider fields
| Field | Description |
|---|---|
| id | Generated by FileHold. Do not send it when creating a provider. |
| displayName | Friendly name shown to users. If empty, the provider type is shown. |
| providerType | One of OpenAI, AzureOpenAI, AzureInference, Google, Ollama, Anthropic, Amazon. Selects how requests and credentials are handled. |
| endpointUrl | Provider endpoint. Leave empty or null if the provider does not need one. |
| apiKey | API key from the vendor. |
| accessKeyId, secretAccessKey | Key ID and secret for providers that use them (for example Amazon). |
| region | Cloud region, if the provider needs one. Empty string if not used. |
| projectId | Project identifier, if the provider scopes requests to a project. Empty string if not used. |
| creditsLimit | Monthly credit cap for the provider. Null means no limit. A per-user limit, if one exists, takes precedence. |
Create a provider
Send POST /ai/providers with a JSON body. The response is the saved provider including its generated id. Note the id, as you need it for the models.
Anthropic Claude
Request body:
{
"displayName": "Anthropic Claude",
"providerType": "Anthropic",
"endpointUrl": "https://api.anthropic.com",
"apiKey": "<your Anthropic API key>",
"region": "",
"projectId": "",
"creditsLimit": null
}
PowerShell:
$body = @{
displayName = "Anthropic Claude"
providerType = "Anthropic"
endpointUrl = "https://api.anthropic.com"
apiKey = "<your Anthropic API key>"
region = ""
projectId = ""
creditsLimit = $null
} | ConvertTo-Json
$provider = Invoke-RestMethod -Method Post -Uri "$base/ai/providers" `
-Headers $headers -ContentType "application/json" -Body $body
$provider.id
curl:
curl -X POST "$BASE/ai/providers" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"displayName":"Anthropic Claude","providerType":"Anthropic","endpointUrl":"https://api.anthropic.com","apiKey":"<your Anthropic API key>","region":"","projectId":"","creditsLimit":null}'
Google Gemini
Google does not need an endpoint URL. Only the API key is required.
{
"displayName": "Google Gemini",
"providerType": "Google",
"endpointUrl": null,
"apiKey": "<your Google AI API key>",
"region": "",
"projectId": "",
"creditsLimit": null
}
PowerShell:
$body = @{
displayName = "Google Gemini"
providerType = "Google"
endpointUrl = $null
apiKey = "<your Google AI API key>"
region = ""
projectId = ""
creditsLimit = $null
} | ConvertTo-Json
Invoke-RestMethod -Method Post -Uri "$base/ai/providers" `
-Headers $headers -ContentType "application/json" -Body $body
curl:
curl -X POST "$BASE/ai/providers" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"displayName":"Google Gemini","providerType":"Google","endpointUrl":null,"apiKey":"<your Google AI API key>","region":"","projectId":"","creditsLimit":null}'
Azure OpenAI
An example configuration for Azure OpenAI uses the provider type OpenAI with the OpenAI-compatible /openai/v1/ endpoint of your Azure AI resource. Replace <resource> with your Azure resource name.
{
"displayName": "Azure OpenAI",
"providerType": "OpenAI",
"endpointUrl": "https://<resource>.services.ai.azure.com/openai/v1/",
"apiKey": "<your Azure key>",
"region": "",
"projectId": "",
"creditsLimit": null
}
PowerShell:
$body = @{
displayName = "Azure OpenAI"
providerType = "OpenAI"
endpointUrl = "https://<resource>.services.ai.azure.com/openai/v1/"
apiKey = "<your Azure key>"
region = ""
projectId = ""
creditsLimit = $null
} | ConvertTo-Json
Invoke-RestMethod -Method Post -Uri "$base/ai/providers" `
-Headers $headers -ContentType "application/json" -Body $body
curl:
curl -X POST "$BASE/ai/providers" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"displayName":"Azure OpenAI","providerType":"OpenAI","endpointUrl":"https://<resource>.services.ai.azure.com/openai/v1/","apiKey":"<your Azure key>","region":"","projectId":"","creditsLimit":null}'
Ollama (self-hosted models)
Models that you host yourself, for example with Ollama, keep documents inside your own network. Use the provider type Ollama and set endpointUrl to the address of the Ollama server (the default port is 11434). Ollama does not need an API key, so only the name, type and endpoint are required.
Use http://localhost:11434 when Ollama runs on the FileHold server itself. If it runs on another machine, use that machine's host name or IP address instead, make sure Ollama is listening on a network address (the OLLAMA_HOST environment variable), and allow the port through any firewall.
{
"displayName": "Ollama",
"providerType": "Ollama",
"endpointUrl": "http://localhost:11434"
}
PowerShell:
$body = @{
displayName = "Ollama"
providerType = "Ollama"
endpointUrl = "http://localhost:11434"
} | ConvertTo-Json
$provider = Invoke-RestMethod -Method Post -Uri "$base/ai/providers" `
-Headers $headers -ContentType "application/json" -Body $body
$provider.id
curl:
curl -X POST "$BASE/ai/providers" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"displayName":"Ollama","providerType":"Ollama","endpointUrl":"http://localhost:11434"}'
List providers
Use this to find provider IDs and confirm what is configured.
Invoke-RestMethod -Uri "$base/ai/providers" -Headers $headers | Format-Table id, displayName, providerType, endpointUrl
curl "$BASE/ai/providers" -H "Authorization: Bearer $TOKEN"
For security, the credential fields (apiKey, accessKeyId, secretAccessKey) are returned empty. This does not mean the secret is missing. Use Test a model to confirm that the saved credentials work.
Model fields
| Field | Description |
|---|---|
| id | Generated by FileHold. Do not send it when creating a model. |
| providerId | The id of the provider that owns this model. |
| name | The exact model name sent to the vendor's API, for example claude-sonnet-5-5. |
| displayName | Name shown to users, for example Sonnet 5.5. |
| canAttachFiles | true if users can attach documents to a conversation with this model. |
| filesExtensions | Semicolon-separated list of allowed file extensions, for example pdf;txt;png. If empty, any extension is allowed. |
| maxAttachedMetadataCount | Maximum number of metadata items that can be attached. Null means no limit. |
| maxAttachedFilesCount | Maximum number of files that can be attached. Null means no limit. |
| maxAttachedContentCount | Maximum total attached content size in bytes. Null means no limit. |
| inputTokenWeight, outputTokenWeight | Multipliers applied to input and output tokens when credits are charged. Null is treated as 1; 0 means those tokens are not charged. Use these to reflect that a larger model costs more than a smaller one. |
| inputContextWindow | Maximum input tokens. Null means no limit is defined. |
| maxOutputTokens | Maximum tokens per response. If null, no limit is sent and the provider applies its own default, which may be lower than the model's maximum. |
Create a model
Send POST /ai/models with a JSON body. Set providerId to the ID of the provider you created. In the examples below, replace 1 with your own provider ID.
Anthropic Claude model
{
"providerId": 1,
"name": "claude-sonnet-5-5",
"displayName": "Sonnet 5.5",
"canAttachFiles": true,
"filesExtensions": "jpg;jpeg;png;webp;pdf;txt",
"maxAttachedMetadataCount": null,
"maxAttachedFilesCount": null,
"maxAttachedContentCount": null,
"inputTokenWeight": 1,
"outputTokenWeight": 1,
"inputContextWindow": null,
"maxOutputTokens": 128000
}
PowerShell:
$body = @{
providerId = 1
name = "claude-sonnet-5-5"
displayName = "Sonnet 5.5"
canAttachFiles = $true
filesExtensions = "jpg;jpeg;png;webp;pdf;txt"
maxAttachedMetadataCount = $null
maxAttachedFilesCount = $null
maxAttachedContentCount = $null
inputTokenWeight = 1
outputTokenWeight = 1
inputContextWindow = $null
maxOutputTokens = 128000
} | ConvertTo-Json
$model = Invoke-RestMethod -Method Post -Uri "$base/ai/models" `
-Headers $headers -ContentType "application/json" -Body $body
$model.id
curl:
curl -X POST "$BASE/ai/models" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"providerId":1,"name":"claude-sonnet-5-5","displayName":"Sonnet 5.5","canAttachFiles":true,"filesExtensions":"jpg;jpeg;png;webp;pdf;txt","maxAttachedMetadataCount":null,"maxAttachedFilesCount":null,"maxAttachedContentCount":null,"inputTokenWeight":1,"outputTokenWeight":1,"inputContextWindow":null,"maxOutputTokens":128000}'
Example models
The following table shows example model configurations. Create each one the same way, changing the values shown. Set providerId to the ID of the matching provider. Unless shown otherwise, the examples use inputTokenWeight and outputTokenWeight of 1 and leave the attachment and context limits null.
These examples are provided for guidance only. FileHold does not regularly validate specific providers or models, and this is not an official list of supported models. Vendors change and retire model names, so confirm the current names with your provider and always use Test a model to check your configuration.
| Provider | name | displayName | filesExtensions | maxOutputTokens |
|---|---|---|---|---|
| Anthropic Claude | claude-haiku-5-5 | Haiku 5.5 | pdf;txt;jpeg;jpg;png;gif;webp | 128000 |
| Anthropic Claude | claude-sonnet-5-5 | Sonnet 5.5 | jpg;jpeg;png;webp;pdf;txt | 128000 |
| Anthropic Claude | claude-opus-5-5 | Opus 5.5 | pdf;txt;png;jpg;jpeg;gif;webp | 128000 |
| Anthropic Claude | claude-fable-5-2 | Fable 5.2 | pdf;txt;jpeg;jpg;png;gif;webp | 128000 |
| Google Gemini | gemini-3.8-flash | Gemini 3.8 Flash | pdf;txt | null |
| Azure OpenAI | gpt-5.4-nano | GPT 5.4 nano | pdf;txt | null |
| Ollama | llama3.1:8b | llama3.1:8b | Attachments off (canAttachFiles is false) | null |
For Azure OpenAI, the name must match the deployment name you created in your Azure resource.
Example for the Gemini model, using the provider ID returned when you created the Google provider (shown here as 2):
$body = @{
providerId = 2
name = "gemini-3.8-flash"
displayName = "Gemini 3.8 Flash"
canAttachFiles = $true
filesExtensions = "pdf;txt"
maxAttachedMetadataCount = $null
maxAttachedFilesCount = $null
maxAttachedContentCount = $null
inputTokenWeight = 1
outputTokenWeight = 1
inputContextWindow = $null
maxOutputTokens = $null
} | ConvertTo-Json
Invoke-RestMethod -Method Post -Uri "$base/ai/models" `
-Headers $headers -ContentType "application/json" -Body $body
curl -X POST "$BASE/ai/models" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"providerId":2,"name":"gemini-3.8-flash","displayName":"Gemini 3.8 Flash","canAttachFiles":true,"filesExtensions":"pdf;txt","maxAttachedMetadataCount":null,"maxAttachedFilesCount":null,"maxAttachedContentCount":null,"inputTokenWeight":1,"outputTokenWeight":1,"inputContextWindow":null,"maxOutputTokens":null}'
Ollama model
Pull the model on the Ollama server first (for example ollama pull llama3.1:8b). Set name to the model name exactly as shown by ollama list, including the tag. Only providerId, name, displayName and canAttachFiles are needed; the other fields use their defaults. In the examples, replace 123 with the ID of your Ollama provider.
{
"providerId": 123,
"name": "llama3.1:8b",
"displayName": "llama3.1:8b",
"canAttachFiles": false
}
PowerShell:
$body = @{
providerId = 123
name = "llama3.1:8b"
displayName = "llama3.1:8b"
canAttachFiles = $false
} | ConvertTo-Json
Invoke-RestMethod -Method Post -Uri "$base/ai/models" `
-Headers $headers -ContentType "application/json" -Body $body
curl:
curl -X POST "$BASE/ai/models" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"providerId":123,"name":"llama3.1:8b","displayName":"llama3.1:8b","canAttachFiles":false}'
The Ollama model is created with file attachments turned off. Because the hardware is yours, you can also set inputTokenWeight and outputTokenWeight to 0 so that use of the model is not charged against credit limits.
Test a model
After creating a model, call POST /ai/models/{id}/validate to confirm that FileHold can reach the provider with the saved credentials. A successful call returns HTTP 200. Any other status usually indicates a wrong endpoint URL, key or model name.
Invoke-RestMethod -Method Post -Uri "$base/ai/models/5/validate" -Headers $headers
curl -X POST "$BASE/ai/models/5/validate" -H "Authorization: Bearer $TOKEN" -i
List models
Invoke-RestMethod -Uri "$base/ai/models" -Headers $headers | Format-Table id, providerId, name, displayName
curl "$BASE/ai/models" -H "Authorization: Bearer $TOKEN"
Update or delete a provider or model
To change an existing provider or model, send PUT /ai/providers/{id} or PUT /ai/models/{id} with the complete JSON object (the same fields as when creating it). A simple approach is to read the object with GET, change the value, and send it back:
$m = Invoke-RestMethod -Uri "$base/ai/models/5" -Headers $headers
$m.maxOutputTokens = 64000
Invoke-RestMethod -Method Put -Uri "$base/ai/models/5" -Headers $headers `
-ContentType "application/json" -Body ($m | ConvertTo-Json)
curl -X PUT "$BASE/ai/models/5" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"id":5,"providerId":1,"name":"claude-haiku-5-5","displayName":"Haiku 5.5","canAttachFiles":true,"filesExtensions":"pdf;txt;jpeg;jpg;png;gif;webp","inputTokenWeight":1,"outputTokenWeight":1,"maxOutputTokens":64000}'
To rotate an API key, send a PUT to /ai/providers/{id} with the new apiKey value. Because credential fields are not returned by GET, always include the secret (and the other provider fields) in the request body.
To remove an item, use DELETE.
Delete a provider's models before deleting the provider. Deleting cannot be undone.
Invoke-RestMethod -Method Delete -Uri "$base/ai/models/5" -Headers $headers Invoke-RestMethod -Method Delete -Uri "$base/ai/providers/1" -Headers $headers
curl -X DELETE "$BASE/ai/models/5" -H "Authorization: Bearer $TOKEN" curl -X DELETE "$BASE/ai/providers/1" -H "Authorization: Bearer $TOKEN"
Check credit usage
If you set creditsLimit on a provider, use GET /ai/providers/{id}/limits to see the credits used, the effective limit and the credits remaining for the current monthly period. The call reports usage for the user making the request.
Invoke-RestMethod -Uri "$base/ai/providers/1/limits" -Headers $headers
curl "$BASE/ai/providers/1/limits" -H "Authorization: Bearer $TOKEN"
Troubleshooting
- 401 Unauthorized: the session ID or token is missing, expired or copied incorrectly. Copy a fresh one (see Authentication).
- 403 Forbidden: the account does not have permission. Sign in as a system administrator.
- Validation fails: check the endpoint URL (including the trailing /openai/v1/ for Azure), the API key, and that name exactly matches the vendor's model name or Azure deployment name.
- Responses are cut short: set maxOutputTokens explicitly. When it is null the provider's own default applies, which may be low.
- Certificate errors from PowerShell or curl: make sure the server's certificate is trusted by the machine running the command.
- Cannot reach the Swagger page: check the server name and that the FileHold web server is reachable from the machine you are using.