### Advanced Custom / Enterprise Setup Source: https://flowdown.ai/docs/documents/models/cloud_models_setup Guide for setting up custom or enterprise cloud model integrations, including key fields and verification steps. ```APIDOC ## Advanced: Custom / Enterprise Setup For private deployments or bespoke gateways. Connect only trusted endpoints—misconfigurations can leak data or incur costs. * **Create**: **Settings → Models → + → Cloud Model → Empty Model**. Edit inline or export `.fdmodel`, tweak externally, then re-import. * **Key fields** (unused fields can be empty strings/collections): Key| Purpose ---|--- `endpoint`| Inference URL such as `/v1/chat/completions` or `/v1/responses`; must match `response_format`. `response_format`| `chatCompletions` or `responses`, aligned with the endpoint. `model_identifier`| Model name sent to the provider. `model_list_endpoint`| List endpoint (defaults to `$INFERENCE_ENDPOINT$/../../models`) for **Select from Server**. `token` / `headers`| Auth info; custom headers can override the default `Authorization: Bearer ...`. `body_fields`| JSON string merged into the request body—use it for reasoning toggles, budgets, sampling keys, modalities, etc. `capabilities` / `context` / `name` / `comment`| Declare capabilities, context window, display name, and notes to drive UI toggles and trimming. * **Verify & audit**: after saving, run `⋯ → Verify model`; audit calls in **Settings → Support → Logs**. Remove/disable unused configs to avoid accidental calls. ``` -------------------------------- ### Fetching Latest Templates Source: https://flowdown.ai/docs/documents/models/cloud_models_setup Instructions on how to fetch the latest cloud model templates, including free options like pollinations.ai. ```APIDOC ## Fetch the latest templates 1. Open **Settings → Models**. 2. Tap the **+** in the top-right corner. 3. Under **Cloud Model**, pick **pollinations.ai (free)** to fetch the latest anonymous text models with the correct endpoint and context, or choose **Empty Model** to start from scratch. 4. To reuse saved profiles, select **Import Model → Import from File** and load an exported `.fdmodel` or `.plist`. ``` -------------------------------- ### Connecting a Cloud Model Provider Source: https://flowdown.ai/docs/documents/models/cloud_models_setup Detailed steps for connecting a cloud model provider, including setting the endpoint, model identifier, authentication, and custom body fields. ```APIDOC ## Connect your provider 1. Create a blank profile or open an existing one. 2. Enter the full inference URL (for example, `https://api.example.com/v1/chat/completions` or `/v1/responses`). FlowDown auto-detects and sets **Content Format**; switch it manually if detection is wrong. 3. Set the model identifier. Tap the field to **Select from Server**, which calls the model list endpoint (defaults to `$INFERENCE_ENDPOINT$/../../models`; adjust if your provider uses a different path). 4. Provide your provider credential/workgroup token (sent as a Bearer **Authorization** header) and any required headers. Custom headers can override Authorization for special auth schemes. 5. Add JSON in **Body Fields**. The quick menu inserts reasoning toggles (`enable_thinking` / `reasoning` with budgets), sampling parameters, input/output modalities, or provider flags. 6. Toggle capabilities (Tool, Vision, Audio, Developer role), set context length and nickname, then save. ``` -------------------------------- ### Initialize Model Exchange Key Pair and Request Builder (Swift) Source: https://flowdown.ai/docs/documents/architecture/model_exchange Initializes a new key pair for encryption and signing, and sets up the request builder for the Model Exchange Protocol. This requires the FlowDownModelExchange framework and uses a custom URL scheme for callbacks. ```swift import FlowDownModelExchange // Generate a new key pair for encryption and signing let keyPair = ModelExchangeKeyPair() // Initialize the request builder let builder = ModelExchangeRequestBuilder( callbackScheme: "my-app-scheme", // Your app's URL scheme keyPair: keyPair ) ``` -------------------------------- ### Request Models from FlowDown using Signed URL (Swift) Source: https://flowdown.ai/docs/documents/architecture/model_exchange Creates a signed URL to request models from FlowDown, specifying session details, app information, desired capabilities, and whether multiple models can be selected. The generated URL is then opened to launch FlowDown. ```swift func requestModels() { do { // Create a signed request URL let request = try builder.makeExchangeURL( session: UUID().uuidString, appName: "My Awesome App", reason: "To assist with coding tasks", capabilities: [.audio, .developerRole], // Filter needed models multipleSelection: false ) // Open FlowDown UIApplication.shared.open(request.url) } catch { print("Failed to build request: \(error)") } } ``` -------------------------------- ### Handle FlowDown Callback URL (Swift) Source: https://flowdown.ai/docs/documents/architecture/model_exchange Processes the callback URL received from FlowDown after a model exchange attempt. It parses query parameters to determine the stage of the operation (completed or cancelled) and calls appropriate handler functions. ```swift func handleCallback(url: URL) { guard let components = URLComponents(url: url, resolvingAgainstBaseURL: false), let queryItems = components.queryItems else { return } let params = Dictionary(uniqueKeysWithValues: queryItems.map { ($0.name, $0.value ?? "") }) // Check the stage if params["stage"] == "completed" { handleCompletion(params: params) } else if params["stage"] == "cancelled" { print("User cancelled the operation") } } ``` -------------------------------- ### Decrypt Model Payload from FlowDown Response (Swift) Source: https://flowdown.ai/docs/documents/architecture/model_exchange Decodes and decrypts the encrypted payload received from FlowDown upon successful model exchange. It uses the `ModelExchangeEncryptedPayload` and `ModelExchangeCrypto` classes with the previously generated key pair to obtain the model data, typically in Property List format. ```swift func handleCompletion(params: [String: String]) { guard let payloadString = params["payload"], let sessionID = params["session"] else { return } do { // 1. Decode the encrypted payload wrapper let encryptedPayload = try ModelExchangeEncryptedPayload.decode(from: payloadString) // 2. Decrypt the data using your key pair let decryptedData = try ModelExchangeCrypto.decrypt( encryptedPayload, with: keyPair ) // 3. Parse the model data (usually a Property List) let models = try PropertyListSerialization.propertyList( from: decryptedData, options: [], format: nil ) print("Received models: \(models)") } catch { print("Decryption failed: \(error)") } } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.