Providers, Models, And Provider Keys
Configure upstream provider access and model catalog entries.
Providers, Models, And Provider Keys
Providers and models define where gateway traffic goes.
Provider
A provider represents an upstream service within an organisation.
Fields:
type:OPENAI,ANTHROPIC,GOOGLE,AZURE_OPENAI,VLLM, orCUSTOM.name: human-readable label.baseUrl: upstream base URL.timeoutMs: optional request timeout override.config: provider-specific JSON.enabled: whether the provider can be used.organisationId: tenant owner.
There is a uniqueness rule for provider type per organisation.
Provider API Key
A provider API key is the upstream secret used by the gateway.
Fields:
providerIdnamekeykeyPreviewrevoked
The UI encrypts the provider key in the browser before persistence. The server decrypts it in memory only when an upstream call needs it.
Provider Key Encryption
Encryption envelope:
{
"v": 1,
"alg": "RSA-OAEP-256/A256GCM",
"keyId": "provider-key-rsa-20260324",
"wrappedKey": "...",
"iv": "...",
"ciphertext": "..."
}Flow:
- Browser imports the configured RSA public key.
- Browser creates a random AES-256-GCM key.
- Browser encrypts the provider key with AES-GCM.
- Browser wraps the AES key with RSA-OAEP SHA-256.
- UI stores the JSON envelope in
ProviderApiKey.key. - UI stores a masked
keyPreview. - Gateway loads model/provider-key metadata.
- Gateway decrypts the envelope with the private key immediately before upstream use.
- Gateway caches plaintext in memory briefly, keyed by provider-key ID, key ID, and update timestamp.
Legacy plaintext rows are accepted by the gateway during rollout, but new keys should be encrypted.
Model
A model is the organisation-facing catalog entry used by API keys and requests.
Fields:
name: the model name clients send to Odock.slug: the upstream provider model name.type:chat,reasoning,image,embeddings,audio,moderation,transcription, ortts.capabilities:vision,reasoning, and/ortool_use.providerId: provider mapping.providerApiKeyId: upstream credential mapping.config: model-specific JSON.pricing: billing JSON.policies: rate-limit/IP policy JSON.organisationId: tenant owner.
The model name is unique inside an organisation. The gateway can rewrite the inbound model name to the upstream slug before calling the provider.
Model Access
API keys do not automatically get access to every model.
ApiKeyModelAccess grants:
- one API key,
- one model.
The gateway checks the grant after decoding the request and before applying provider config. If an API key has model access records, the request model must be in the allowed set.
Provider Selection At Runtime
The gateway resolves provider settings like this:
- Authenticate the Odock API key.
- Decode the model requested by the client.
- Check model access for that key.
- Load the model by organisation and name.
- Ensure the provider exists and is enabled.
- Map provider type to runtime provider name.
- Apply provider base URL and timeout.
- Resolve provider API key, decrypting if needed.
- Rewrite the upstream model if
slugdiffers fromname. - Call the provider or smart router.
Pricing
Model pricing is stored as JSON on the model row and used by the usage billing calculator.
Supported pricing shape:
{
"input": {
"text_cost_per_1k_tokens": 0.005,
"image_cost_per_1k_tokens": 0,
"audio_cost_per_1k_tokens": 0,
"video_cost_per_1k_tokens": 0,
"reasoning_cost_per_1k_tokens": 0
},
"output": {
"text_cost_per_1k_tokens": 0.015,
"reasoning_cost_per_1k_tokens": 0.015
},
"cached_input_discount_percent": 50,
"tools": {
"definition_cost_per_1k_tokens": 0,
"input_cost_per_1k_tokens": 0,
"output_cost_per_1k_tokens": 0
},
"embeddings_cost_per_1k_tokens": 0
}Costs are computed in integer nanos USD to avoid floating-point drift.
Setup Checklist
- Create the provider.
- Create at least one provider API key.
- Create a model with a user-facing
nameand upstreamslug. - Assign the provider and provider key to the model.
- Add pricing if budgets, invoices, or cost tracking matter.
- Add policies if this model needs custom rate limits.
- Grant API key model access.
- Test with the playground or a direct gateway request.