From aad5100b8081fa6279ea2510502c44dccf3abab4 Mon Sep 17 00:00:00 2001 From: HavenDV Date: Wed, 13 Nov 2024 16:28:54 +0400 Subject: [PATCH] test: Updated replicate.json. --- .github/workflows/main.yml | 2 +- AutoSDK.sln | 2 +- specs/replicate.json | 1392 +++++++++++++++++ specs/replicate.yaml | 997 ------------ .../AutoSDK.IntegrationTests.Cli/CliTests.cs | 2 +- .../_#G.Api.CreateDeployments.g.verified.cs | 4 +- .../_#G.Api.CreateModels.g.verified.cs | 4 +- .../_#G.Api.CreatePredictions.g.verified.cs | 99 +- ...CreatePredictionsDeployments.g.verified.cs | 103 +- ....Api.CreatePredictionsModels.g.verified.cs | 178 +-- .../_#G.Api.CreateTrainings.g.verified.cs | 4 +- .../_#G.Api.DeleteDeployments.g.verified.cs | 2 +- .../_#G.Api.DeleteModels.g.verified.cs | 2 +- ..._#G.Api.DeleteVersionsModels.g.verified.cs | 2 +- .../_#G.Api.GetAccount.g.verified.cs | 2 +- .../_#G.Api.GetCollections.g.verified.cs | 2 +- .../_#G.Api.GetDeployments.g.verified.cs | 2 +- .../_#G.Api.GetModels.g.verified.cs | 2 +- .../_#G.Api.GetPredictions.g.verified.cs | 81 +- ...Api.GetSecretDefaultWebhooks.g.verified.cs | 2 +- .../_#G.Api.GetTrainings.g.verified.cs | 2 +- .../_#G.Api.GetVersionsModels.g.verified.cs | 2 +- .../_#G.Api.ListCollections.g.verified.cs | 2 +- .../_#G.Api.ListDeployments.g.verified.cs | 2 +- .../_#G.Api.ListHardware.g.verified.cs | 2 +- .../_#G.Api.ListModels.g.verified.cs | 2 +- .../_#G.Api.ListPredictions.g.verified.cs | 2 +- .../_#G.Api.ListTrainings.g.verified.cs | 2 +- .../_#G.Api.ListVersionsModels.g.verified.cs | 2 +- .../_#G.Api.UpdateDeployments.g.verified.cs | 4 +- .../_#G.IApi.CreateDeployments.g.verified.cs | 4 +- .../_#G.IApi.CreateModels.g.verified.cs | 4 +- .../_#G.IApi.CreatePredictions.g.verified.cs | 88 +- ...CreatePredictionsDeployments.g.verified.cs | 92 +- ...IApi.CreatePredictionsModels.g.verified.cs | 88 +- .../_#G.IApi.CreateTrainings.g.verified.cs | 4 +- .../_#G.IApi.DeleteDeployments.g.verified.cs | 2 +- .../_#G.IApi.DeleteModels.g.verified.cs | 2 +- ...#G.IApi.DeleteVersionsModels.g.verified.cs | 2 +- .../_#G.IApi.GetAccount.g.verified.cs | 2 +- .../_#G.IApi.GetCollections.g.verified.cs | 2 +- .../_#G.IApi.GetDeployments.g.verified.cs | 2 +- .../_#G.IApi.GetModels.g.verified.cs | 2 +- .../_#G.IApi.GetPredictions.g.verified.cs | 4 +- ...Api.GetSecretDefaultWebhooks.g.verified.cs | 2 +- .../_#G.IApi.GetTrainings.g.verified.cs | 2 +- .../_#G.IApi.GetVersionsModels.g.verified.cs | 2 +- .../_#G.IApi.ListCollections.g.verified.cs | 2 +- .../_#G.IApi.ListDeployments.g.verified.cs | 2 +- .../_#G.IApi.ListHardware.g.verified.cs | 2 +- .../_#G.IApi.ListModels.g.verified.cs | 2 +- .../_#G.IApi.ListPredictions.g.verified.cs | 2 +- .../_#G.IApi.ListTrainings.g.verified.cs | 2 +- .../_#G.IApi.ListVersionsModels.g.verified.cs | 2 +- .../_#G.IApi.UpdateDeployments.g.verified.cs | 4 +- ...dels.PredictionResponse.Json.g.verified.cs | 56 - ...#G.Models.PredictionResponse.g.verified.cs | 149 -- ...PredictionResponseInput.Json.g.verified.cs | 56 - ...dels.PredictionResponseInput.g.verified.cs | 95 -- ...edictionResponseMetrics.Json.g.verified.cs | 56 - ...ls.PredictionResponseMetrics.g.verified.cs | 59 - ....PredictionResponseUrls.Json.g.verified.cs | 56 - ...odels.PredictionResponseUrls.g.verified.cs | 50 - .../_#G.Api.CreateDeployments.g.verified.cs | 4 +- .../_#G.Api.CreateModels.g.verified.cs | 4 +- .../_#G.Api.CreatePredictions.g.verified.cs | 99 +- ...CreatePredictionsDeployments.g.verified.cs | 103 +- ....Api.CreatePredictionsModels.g.verified.cs | 178 +-- .../_#G.Api.CreateTrainings.g.verified.cs | 4 +- .../_#G.Api.DeleteDeployments.g.verified.cs | 2 +- .../_#G.Api.DeleteModels.g.verified.cs | 2 +- ..._#G.Api.DeleteVersionsModels.g.verified.cs | 2 +- .../_#G.Api.GetAccount.g.verified.cs | 2 +- .../_#G.Api.GetCollections.g.verified.cs | 2 +- .../_#G.Api.GetDeployments.g.verified.cs | 2 +- .../_#G.Api.GetModels.g.verified.cs | 2 +- .../_#G.Api.GetPredictions.g.verified.cs | 81 +- ...Api.GetSecretDefaultWebhooks.g.verified.cs | 2 +- .../_#G.Api.GetTrainings.g.verified.cs | 2 +- .../_#G.Api.GetVersionsModels.g.verified.cs | 2 +- .../_#G.Api.ListCollections.g.verified.cs | 2 +- .../_#G.Api.ListDeployments.g.verified.cs | 2 +- .../_#G.Api.ListHardware.g.verified.cs | 2 +- .../_#G.Api.ListModels.g.verified.cs | 2 +- .../_#G.Api.ListPredictions.g.verified.cs | 2 +- .../_#G.Api.ListTrainings.g.verified.cs | 2 +- .../_#G.Api.ListVersionsModels.g.verified.cs | 2 +- .../_#G.Api.UpdateDeployments.g.verified.cs | 4 +- .../_#G.IApi.CreateDeployments.g.verified.cs | 4 +- .../_#G.IApi.CreateModels.g.verified.cs | 4 +- .../_#G.IApi.CreatePredictions.g.verified.cs | 88 +- ...CreatePredictionsDeployments.g.verified.cs | 92 +- ...IApi.CreatePredictionsModels.g.verified.cs | 88 +- .../_#G.IApi.CreateTrainings.g.verified.cs | 4 +- .../_#G.IApi.DeleteDeployments.g.verified.cs | 2 +- .../_#G.IApi.DeleteModels.g.verified.cs | 2 +- ...#G.IApi.DeleteVersionsModels.g.verified.cs | 2 +- .../_#G.IApi.GetAccount.g.verified.cs | 2 +- .../_#G.IApi.GetCollections.g.verified.cs | 2 +- .../_#G.IApi.GetDeployments.g.verified.cs | 2 +- .../_#G.IApi.GetModels.g.verified.cs | 2 +- .../_#G.IApi.GetPredictions.g.verified.cs | 4 +- ...Api.GetSecretDefaultWebhooks.g.verified.cs | 2 +- .../_#G.IApi.GetTrainings.g.verified.cs | 2 +- .../_#G.IApi.GetVersionsModels.g.verified.cs | 2 +- .../_#G.IApi.ListCollections.g.verified.cs | 2 +- .../_#G.IApi.ListDeployments.g.verified.cs | 2 +- .../_#G.IApi.ListHardware.g.verified.cs | 2 +- .../_#G.IApi.ListModels.g.verified.cs | 2 +- .../_#G.IApi.ListPredictions.g.verified.cs | 2 +- .../_#G.IApi.ListTrainings.g.verified.cs | 2 +- .../_#G.IApi.ListVersionsModels.g.verified.cs | 2 +- .../_#G.IApi.UpdateDeployments.g.verified.cs | 4 +- ...dels.PredictionResponse.Json.g.verified.cs | 93 -- ...#G.Models.PredictionResponse.g.verified.cs | 150 -- ...PredictionResponseInput.Json.g.verified.cs | 93 -- ...dels.PredictionResponseInput.g.verified.cs | 96 -- ...edictionResponseMetrics.Json.g.verified.cs | 93 -- ...ls.PredictionResponseMetrics.g.verified.cs | 60 - ....PredictionResponseUrls.Json.g.verified.cs | 93 -- ...odels.PredictionResponseUrls.g.verified.cs | 51 - ..._#JsonSerializerContextTypes.g.verified.cs | 86 +- src/tests/AutoSDK.SnapshotTests/Tests.cs | 5 +- src/tests/AutoSDK.UnitTests/DataTests.cs | 5 +- .../Replicate/ResolvedSchemas/_.verified.txt | 31 +- .../Replicate/Schemas/_.verified.txt | 31 +- ...ionTests.Validation_NewErrors.verified.txt | 6 + ...nTests.Validation_NewWarnings.verified.txt | 1 + ...sts.Validation_OriginalErrors.verified.txt | 6 + ...s.Validation_OriginalWarnings.verified.txt | 1 + .../replicate.json/_.verified.txt | 1392 +++++++++++++++++ .../AutoSDK.UnitTests/ValidationTests.cs | 2 +- 132 files changed, 3311 insertions(+), 3622 deletions(-) create mode 100644 specs/replicate.json delete mode 100644 specs/replicate.yaml delete mode 100644 src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.Models.PredictionResponse.Json.g.verified.cs delete mode 100644 src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.Models.PredictionResponse.g.verified.cs delete mode 100644 src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.Models.PredictionResponseInput.Json.g.verified.cs delete mode 100644 src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.Models.PredictionResponseInput.g.verified.cs delete mode 100644 src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.Models.PredictionResponseMetrics.Json.g.verified.cs delete mode 100644 src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.Models.PredictionResponseMetrics.g.verified.cs delete mode 100644 src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.Models.PredictionResponseUrls.Json.g.verified.cs delete mode 100644 src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.Models.PredictionResponseUrls.g.verified.cs delete mode 100644 src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.Models.PredictionResponse.Json.g.verified.cs delete mode 100644 src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.Models.PredictionResponse.g.verified.cs delete mode 100644 src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.Models.PredictionResponseInput.Json.g.verified.cs delete mode 100644 src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.Models.PredictionResponseInput.g.verified.cs delete mode 100644 src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.Models.PredictionResponseMetrics.Json.g.verified.cs delete mode 100644 src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.Models.PredictionResponseMetrics.g.verified.cs delete mode 100644 src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.Models.PredictionResponseUrls.Json.g.verified.cs delete mode 100644 src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.Models.PredictionResponseUrls.g.verified.cs create mode 100644 src/tests/AutoSDK.UnitTests/Snapshots/Validation/ConvertedSpecs/replicate.json/ValidationTests.Validation_NewErrors.verified.txt create mode 100644 src/tests/AutoSDK.UnitTests/Snapshots/Validation/ConvertedSpecs/replicate.json/ValidationTests.Validation_NewWarnings.verified.txt create mode 100644 src/tests/AutoSDK.UnitTests/Snapshots/Validation/ConvertedSpecs/replicate.json/ValidationTests.Validation_OriginalErrors.verified.txt create mode 100644 src/tests/AutoSDK.UnitTests/Snapshots/Validation/ConvertedSpecs/replicate.json/ValidationTests.Validation_OriginalWarnings.verified.txt create mode 100644 src/tests/AutoSDK.UnitTests/Snapshots/Validation/ConvertedSpecs/replicate.json/_.verified.txt diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index de4a417398..e333d9d0ef 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -38,7 +38,7 @@ jobs: - ollama.yaml - openai.yaml - petstore.yaml - - replicate.yaml + - replicate.json - special-cases.yaml - together.yaml - heygen.yaml diff --git a/AutoSDK.sln b/AutoSDK.sln index 2bc1329a97..19edcefc10 100644 --- a/AutoSDK.sln +++ b/AutoSDK.sln @@ -40,7 +40,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "specs", "specs", "{7E829AE4 specs\ai21.json = specs\ai21.json specs\huggingface.yaml = specs\huggingface.yaml specs\cohere.yaml = specs\cohere.yaml - specs\replicate.yaml = specs\replicate.yaml specs\together.yaml = specs\together.yaml specs\assemblyai.yaml = specs\assemblyai.yaml specs\mystic.yaml = specs\mystic.yaml @@ -56,6 +55,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "specs", "specs", "{7E829AE4 specs\langsmith.json = specs\langsmith.json specs\jina.json = specs\jina.json specs\recraft.yaml = specs\recraft.yaml + specs\replicate.json = specs\replicate.json EndProjectSection EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AutoSDK.IntegrationTests.Cli", "src\tests\AutoSDK.IntegrationTests.Cli\AutoSDK.IntegrationTests.Cli.csproj", "{41F1B4D8-5F6F-40FB-A1C2-A5E6A4B62AA7}" diff --git a/specs/replicate.json b/specs/replicate.json new file mode 100644 index 0000000000..81ccc70488 --- /dev/null +++ b/specs/replicate.json @@ -0,0 +1,1392 @@ +{ + "components": { + "parameters": { + "prefer_header": { + "description": "Leave the request open and wait for the model to finish generating output. Set to `wait=n` where n is a number of seconds between 1 and 60.\n\nSee https://replicate.com/docs/topics/predictions/create-a-prediction#sync-mode for more information.", + "in": "header", + "name": "Prefer", + "schema": { + "example": "wait=5", + "pattern": "^wait(=([1-9]|[1-9][0-9]|60))?$", + "type": "string" + } + } + }, + "schemas": { + "prediction_request": { + "additionalProperties": false, + "properties": { + "input": { + "description": "The model's input as a JSON object. The input schema depends on what model you are running. To see the available inputs, click the \"API\" tab on the model you are running or [get the model version](#models.versions.get) and look at its `openapi_schema` property. For example, [stability-ai/sdxl](https://replicate.com/stability-ai/sdxl) takes `prompt` as an input.\n\nFiles should be passed as HTTP URLs or data URLs.\n\nUse an HTTP URL when:\n\n- you have a large file \u003e 256kb\n- you want to be able to use the file multiple times\n- you want your prediction metadata to be associable with your input files\n\nUse a data URL when:\n\n- you have a small file \u003c= 256kb\n- you don't want to upload and host the file somewhere\n- you don't need to use the file again (Replicate will not store it)\n", + "type": "object" + }, + "stream": { + "description": "**This field is deprecated.**\n\nRequest a URL to receive streaming output using [server-sent events (SSE)](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events).\n\nThis field is no longer needed as the returned prediction will always have a `stream` entry in its `url` property if the model supports streaming.\n", + "type": "boolean" + }, + "webhook": { + "description": "An HTTPS URL for receiving a webhook when the prediction has new output. The webhook will be a POST request where the request body is the same as the response body of the [get prediction](#predictions.get) operation. If there are network problems, we will retry the webhook a few times, so make sure it can be safely called more than once. Replicate will not follow redirects when sending webhook requests to your service, so be sure to specify a URL that will resolve without redirecting.\n", + "type": "string" + }, + "webhook_events_filter": { + "description": "By default, we will send requests to your webhook URL whenever there are new outputs or the prediction has finished. You can change which events trigger webhook requests by specifying `webhook_events_filter` in the prediction request:\n\n- `start`: immediately on prediction start\n- `output`: each time a prediction generates an output (note that predictions can generate multiple outputs)\n- `logs`: each time log output is generated by a prediction\n- `completed`: when the prediction reaches a terminal state (succeeded/canceled/failed)\n\nFor example, if you only wanted requests to be sent at the start and end of the prediction, you would provide:\n\n```json\n{\n \"input\": {\n \"text\": \"Alice\"\n },\n \"webhook\": \"https://example.com/my-webhook\",\n \"webhook_events_filter\": [\"start\", \"completed\"]\n}\n```\n\nRequests for event types `output` and `logs` will be sent at most once every 500ms. If you request `start` and `completed` webhooks, then they'll always be sent regardless of throttling.\n", + "items": { + "enum": [ + "start", + "output", + "logs", + "completed" + ], + "type": "string" + }, + "type": "array" + } + }, + "required": [ + "input" + ], + "type": "object" + }, + "training_request": { + "properties": { + "destination": { + "description": "A string representing the desired model to push to in the format `{destination_model_owner}/{destination_model_name}`. This should be an existing model owned by the user or organization making the API request. If the destination is invalid, the server will return an appropriate 4XX response.\n", + "type": "string" + }, + "input": { + "description": "An object containing inputs to the Cog model's `train()` function.\n", + "type": "object" + }, + "webhook": { + "description": "An HTTPS URL for receiving a webhook when the training completes. The webhook will be a POST request where the request body is the same as the response body of the [get training](#trainings.get) operation. If there are network problems, we will retry the webhook a few times, so make sure it can be safely called more than once. Replicate will not follow redirects when sending webhook requests to your service, so be sure to specify a URL that will resolve without redirecting.", + "type": "string" + }, + "webhook_events_filter": { + "description": "By default, we will send requests to your webhook URL whenever there are new outputs or the training has finished. You can change which events trigger webhook requests by specifying `webhook_events_filter` in the training request:\n\n- `start`: immediately on training start\n- `output`: each time a training generates an output (note that trainings can generate multiple outputs)\n- `logs`: each time log output is generated by a training\n- `completed`: when the training reaches a terminal state (succeeded/canceled/failed)\n\nFor example, if you only wanted requests to be sent at the start and end of the training, you would provide:\n\n```json\n{\n \"destination\": \"my-organization/my-model\",\n \"input\": {\n \"text\": \"Alice\"\n },\n \"webhook\": \"https://example.com/my-webhook\",\n \"webhook_events_filter\": [\"start\", \"completed\"]\n}\n```\n\nRequests for event types `output` and `logs` will be sent at most once every 500ms. If you request `start` and `completed` webhooks, then they'll always be sent regardless of throttling.\n", + "items": { + "enum": [ + "start", + "output", + "logs", + "completed" + ], + "type": "string" + }, + "type": "array" + } + }, + "required": [ + "destination", + "input" + ], + "type": "object" + }, + "version_prediction_request": { + "additionalProperties": false, + "properties": { + "input": { + "description": "The model's input as a JSON object. The input schema depends on what model you are running. To see the available inputs, click the \"API\" tab on the model you are running or [get the model version](#models.versions.get) and look at its `openapi_schema` property. For example, [stability-ai/sdxl](https://replicate.com/stability-ai/sdxl) takes `prompt` as an input.\n\nFiles should be passed as HTTP URLs or data URLs.\n\nUse an HTTP URL when:\n\n- you have a large file \u003e 256kb\n- you want to be able to use the file multiple times\n- you want your prediction metadata to be associable with your input files\n\nUse a data URL when:\n\n- you have a small file \u003c= 256kb\n- you don't want to upload and host the file somewhere\n- you don't need to use the file again (Replicate will not store it)\n", + "type": "object" + }, + "stream": { + "description": "**This field is deprecated.**\n\nRequest a URL to receive streaming output using [server-sent events (SSE)](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events).\n\nThis field is no longer needed as the returned prediction will always have a `stream` entry in its `url` property if the model supports streaming.\n", + "type": "boolean" + }, + "version": { + "description": "The ID of the model version that you want to run.", + "type": "string" + }, + "webhook": { + "description": "An HTTPS URL for receiving a webhook when the prediction has new output. The webhook will be a POST request where the request body is the same as the response body of the [get prediction](#predictions.get) operation. If there are network problems, we will retry the webhook a few times, so make sure it can be safely called more than once. Replicate will not follow redirects when sending webhook requests to your service, so be sure to specify a URL that will resolve without redirecting.\n", + "type": "string" + }, + "webhook_events_filter": { + "description": "By default, we will send requests to your webhook URL whenever there are new outputs or the prediction has finished. You can change which events trigger webhook requests by specifying `webhook_events_filter` in the prediction request:\n\n- `start`: immediately on prediction start\n- `output`: each time a prediction generates an output (note that predictions can generate multiple outputs)\n- `logs`: each time log output is generated by a prediction\n- `completed`: when the prediction reaches a terminal state (succeeded/canceled/failed)\n\nFor example, if you only wanted requests to be sent at the start and end of the prediction, you would provide:\n\n```json\n{\n \"version\": \"5c7d5dc6dd8bf75c1acaa8565735e7986bc5b66206b55cca93cb72c9bf15ccaa\",\n \"input\": {\n \"text\": \"Alice\"\n },\n \"webhook\": \"https://example.com/my-webhook\",\n \"webhook_events_filter\": [\"start\", \"completed\"]\n}\n```\n\nRequests for event types `output` and `logs` will be sent at most once every 500ms. If you request `start` and `completed` webhooks, then they'll always be sent regardless of throttling.\n", + "items": { + "enum": [ + "start", + "output", + "logs", + "completed" + ], + "type": "string" + }, + "type": "array" + } + }, + "required": [ + "version", + "input" + ], + "type": "object" + } + }, + "securitySchemes": { + "bearerAuth": { + "bearerFormat": "All API requests must include a valid API token in the `Authorization` request header. The token must be prefixed by \"Bearer\", followed by a space and the token value.\nExample: `Authorization: Bearer r8_Hw***********************************`\nFind your tokens at https://replicate.com/account/api-tokens\n", + "scheme": "bearer", + "type": "http" + } + } + }, + "externalDocs": { + "description": "Replicate HTTP API", + "url": "https://replicate.com/docs/reference/http" + }, + "info": { + "contact": { + "email": "team@replicate.com" + }, + "description": "A web service for running Replicate models", + "termsOfService": "https://replicate.com/terms", + "title": "Replicate HTTP API", + "version": "1.0.0-a1" + }, + "openapi": "3.1.0", + "paths": { + "/account": { + "get": { + "description": "Returns information about the user or organization associated with the provided API token.\n\nExample cURL request:\n\n```console\ncurl -s \\\n -H \"Authorization: Bearer $REPLICATE_API_TOKEN\" \\\n https://api.replicate.com/v1/account\n```\n\nThe response will be a JSON object describing the account:\n\n```json\n{\n \"type\": \"organization\",\n \"username\": \"acme\",\n \"name\": \"Acme Corp, Inc.\",\n \"github_url\": \"https://github.com/acme\",\n}\n```\n", + "operationId": "account.get", + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "properties": { + "github_url": { + "description": "The GitHub URL of the account.", + "format": "uri", + "type": "string" + }, + "name": { + "description": "The name of the account.", + "type": "string" + }, + "type": { + "description": "The account type. Can be a user or an organization.", + "enum": [ + "organization", + "user" + ], + "type": "string" + }, + "username": { + "description": "The username of the account.", + "type": "string" + } + }, + "type": "object" + } + } + }, + "description": "Success" + } + }, + "summary": "Get the authenticated account" + } + }, + "/collections": { + "get": { + "description": "Example cURL request:\n\n```console\ncurl -s \\\n -H \"Authorization: Bearer $REPLICATE_API_TOKEN\" \\\n https://api.replicate.com/v1/collections\n```\n\nThe response will be a paginated JSON list of collection objects:\n\n```json\n{\n \"next\": \"null\",\n \"previous\": null,\n \"results\": [\n {\n \"name\": \"Super resolution\",\n \"slug\": \"super-resolution\",\n \"description\": \"Upscaling models that create high-quality images from low-quality images.\"\n }\n ]\n}\n```\n", + "operationId": "collections.list", + "responses": { + "200": { + "description": "Success" + } + }, + "summary": "List collections of models" + } + }, + "/collections/{collection_slug}": { + "get": { + "description": "Example cURL request:\n\n```console\ncurl -s \\\n -H \"Authorization: Bearer $REPLICATE_API_TOKEN\" \\\n https://api.replicate.com/v1/collections/super-resolution\n```\n\nThe response will be a collection object with a nested list of the models in that collection:\n\n```json\n{\n \"name\": \"Super resolution\",\n \"slug\": \"super-resolution\",\n \"description\": \"Upscaling models that create high-quality images from low-quality images.\",\n \"models\": [...]\n}\n```\n", + "operationId": "collections.get", + "parameters": [ + { + "description": "The slug of the collection, like `super-resolution` or `image-restoration`. See [replicate.com/collections](https://replicate.com/collections).\n", + "in": "path", + "name": "collection_slug", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Success" + } + }, + "summary": "Get a collection of models" + } + }, + "/deployments": { + "get": { + "description": "Get a list of deployments associated with the current account, including the latest release configuration for each deployment.\n\nExample cURL request:\n\n```console\ncurl -s \\\n -H \"Authorization: Bearer $REPLICATE_API_TOKEN\" \\\n https://api.replicate.com/v1/deployments\n```\n\nThe response will be a paginated JSON array of deployment objects, sorted with the most recent deployment first:\n\n```json\n{\n \"next\": \"http://api.replicate.com/v1/deployments?cursor=cD0yMDIzLTA2LTA2KzIzJTNBNDAlM0EwOC45NjMwMDAlMkIwMCUzQTAw\",\n \"previous\": null,\n \"results\": [\n {\n \"owner\": \"replicate\",\n \"name\": \"my-app-image-generator\",\n \"current_release\": {\n \"number\": 1,\n \"model\": \"stability-ai/sdxl\",\n \"version\": \"da77bc59ee60423279fd632efb4795ab731d9e3ca9705ef3341091fb989b7eaf\",\n \"created_at\": \"2024-02-15T16:32:57.018467Z\",\n \"created_by\": {\n \"type\": \"organization\",\n \"username\": \"acme\",\n \"name\": \"Acme Corp, Inc.\",\n \"github_url\": \"https://github.com/acme\",\n },\n \"configuration\": {\n \"hardware\": \"gpu-t4\",\n \"min_instances\": 1,\n \"max_instances\": 5\n }\n }\n }\n ]\n}\n```\n", + "operationId": "deployments.list", + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "properties": { + "next": { + "description": "A URL pointing to the next page of deployment objects if any", + "nullable": true, + "type": "string" + }, + "previous": { + "description": "A URL pointing to the previous page of deployment objects if any", + "nullable": true, + "type": "string" + }, + "results": { + "description": "An array containing a page of deployment objects", + "items": { + "properties": { + "current_release": { + "properties": { + "configuration": { + "properties": { + "hardware": { + "description": "The SKU for the hardware used to run the model.", + "type": "string" + }, + "max_instances": { + "description": "The maximum number of instances for scaling.", + "type": "integer" + }, + "min_instances": { + "description": "The minimum number of instances for scaling.", + "type": "integer" + } + }, + "type": "object" + }, + "created_at": { + "description": "The time the release was created.", + "format": "date-time", + "type": "string" + }, + "created_by": { + "properties": { + "github_url": { + "description": "The GitHub URL of the account that created the release.", + "format": "uri", + "type": "string" + }, + "name": { + "description": "The name of the account that created the release.", + "type": "string" + }, + "type": { + "description": "The account type of the creator. Can be a user or an organization.", + "enum": [ + "organization", + "user" + ], + "type": "string" + }, + "username": { + "description": "The username of the account that created the release.", + "type": "string" + } + }, + "type": "object" + }, + "model": { + "description": "The model identifier string in the format of `{model_owner}/{model_name}`.", + "type": "string" + }, + "number": { + "description": "The release number. This is an auto-incrementing integer that starts at 1, and is set automatically when a deployment is created.", + "type": "integer" + }, + "version": { + "description": "The ID of the model version used in the release.", + "type": "string" + } + }, + "type": "object" + }, + "name": { + "description": "The name of the deployment.", + "type": "string" + }, + "owner": { + "description": "The owner of the deployment.", + "type": "string" + } + }, + "type": "object" + }, + "type": "array" + } + }, + "type": "object" + } + } + }, + "description": "Success" + } + }, + "summary": "List deployments" + }, + "post": { + "description": "Create a new deployment:\n\nExample cURL request:\n\n```console\ncurl -s \\\n -X POST \\\n -H \"Authorization: Bearer $REPLICATE_API_TOKEN\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"name\": \"my-app-image-generator\",\n \"model\": \"stability-ai/sdxl\",\n \"version\": \"da77bc59ee60423279fd632efb4795ab731d9e3ca9705ef3341091fb989b7eaf\",\n \"hardware\": \"gpu-t4\",\n \"min_instances\": 0,\n \"max_instances\": 3\n }' \\\n https://api.replicate.com/v1/deployments\n```\n\nThe response will be a JSON object describing the deployment:\n\n```json\n{\n \"owner\": \"acme\",\n \"name\": \"my-app-image-generator\",\n \"current_release\": {\n \"number\": 1,\n \"model\": \"stability-ai/sdxl\",\n \"version\": \"da77bc59ee60423279fd632efb4795ab731d9e3ca9705ef3341091fb989b7eaf\",\n \"created_at\": \"2024-02-15T16:32:57.018467Z\",\n \"created_by\": {\n \"type\": \"organization\",\n \"username\": \"acme\",\n \"name\": \"Acme Corp, Inc.\",\n \"github_url\": \"https://github.com/acme\",\n },\n \"configuration\": {\n \"hardware\": \"gpu-t4\",\n \"min_instances\": 1,\n \"max_instances\": 5\n }\n }\n}\n```\n", + "operationId": "deployments.create", + "requestBody": { + "content": { + "application/json": { + "schema": { + "properties": { + "hardware": { + "description": "The SKU for the hardware used to run the model. Possible values can be retrieved from the `hardware.list` endpoint.", + "type": "string" + }, + "max_instances": { + "description": "The maximum number of instances for scaling.", + "maximum": 20, + "minimum": 0, + "type": "integer" + }, + "min_instances": { + "description": "The minimum number of instances for scaling.", + "maximum": 5, + "minimum": 0, + "type": "integer" + }, + "model": { + "description": "The full name of the model that you want to deploy e.g. stability-ai/sdxl.", + "type": "string" + }, + "name": { + "description": "The name of the deployment.", + "type": "string" + }, + "version": { + "description": "The 64-character string ID of the model version that you want to deploy.", + "type": "string" + } + }, + "required": [ + "name", + "model", + "version", + "hardware", + "min_instances", + "max_instances" + ], + "type": "object" + } + } + }, + "required": true + }, + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "properties": { + "current_release": { + "properties": { + "configuration": { + "properties": { + "hardware": { + "description": "The SKU for the hardware used to run the model.", + "type": "string" + }, + "max_instances": { + "description": "The maximum number of instances for scaling.", + "type": "integer" + }, + "min_instances": { + "description": "The minimum number of instances for scaling.", + "type": "integer" + } + }, + "type": "object" + }, + "created_at": { + "description": "The time the release was created.", + "format": "date-time", + "type": "string" + }, + "created_by": { + "properties": { + "github_url": { + "description": "The GitHub URL of the account that created the release.", + "format": "uri", + "type": "string" + }, + "name": { + "description": "The name of the account that created the release.", + "type": "string" + }, + "type": { + "description": "The account type of the creator. Can be a user or an organization.", + "enum": [ + "organization", + "user" + ], + "type": "string" + }, + "username": { + "description": "The username of the account that created the release.", + "type": "string" + } + }, + "type": "object" + }, + "model": { + "description": "The model identifier string in the format of `{model_owner}/{model_name}`.", + "type": "string" + }, + "number": { + "description": "The release number.", + "type": "integer" + }, + "version": { + "description": "The ID of the model version used in the release.", + "type": "string" + } + }, + "type": "object" + }, + "name": { + "description": "The name of the deployment.", + "type": "string" + }, + "owner": { + "description": "The owner of the deployment.", + "type": "string" + } + }, + "type": "object" + } + } + }, + "description": "Success" + } + }, + "summary": "Create a deployment" + } + }, + "/deployments/{deployment_owner}/{deployment_name}": { + "delete": { + "description": "Delete a deployment\n\nDeployment deletion has some restrictions:\n\n- You can only delete deployments that have been offline and unused for at least 15 minutes.\n\nExample cURL request:\n\n```command\ncurl -s -X DELETE \\\n -H \"Authorization: Bearer $REPLICATE_API_TOKEN\" \\\n https://api.replicate.com/v1/deployments/acme/my-app-image-generator\n```\n\nThe response will be an empty 204, indicating the deployment has been deleted.\n", + "operationId": "deployments.delete", + "parameters": [ + { + "description": "The name of the user or organization that owns the deployment.\n", + "in": "path", + "name": "deployment_owner", + "required": true, + "schema": { + "type": "string" + } + }, + { + "description": "The name of the deployment.\n", + "in": "path", + "name": "deployment_name", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "204": { + "description": "Success" + } + }, + "summary": "Delete a deployment" + }, + "get": { + "description": "Get information about a deployment by name including the current release.\n\nExample cURL request:\n\n```console\ncurl -s \\\n -H \"Authorization: Bearer $REPLICATE_API_TOKEN\" \\\n https://api.replicate.com/v1/deployments/replicate/my-app-image-generator\n```\n\nThe response will be a JSON object describing the deployment:\n\n```json\n{\n \"owner\": \"acme\",\n \"name\": \"my-app-image-generator\",\n \"current_release\": {\n \"number\": 1,\n \"model\": \"stability-ai/sdxl\",\n \"version\": \"da77bc59ee60423279fd632efb4795ab731d9e3ca9705ef3341091fb989b7eaf\",\n \"created_at\": \"2024-02-15T16:32:57.018467Z\",\n \"created_by\": {\n \"type\": \"organization\",\n \"username\": \"acme\",\n \"name\": \"Acme Corp, Inc.\",\n \"github_url\": \"https://github.com/acme\",\n },\n \"configuration\": {\n \"hardware\": \"gpu-t4\",\n \"min_instances\": 1,\n \"max_instances\": 5\n }\n }\n}\n```\n", + "operationId": "deployments.get", + "parameters": [ + { + "description": "The name of the user or organization that owns the deployment.\n", + "in": "path", + "name": "deployment_owner", + "required": true, + "schema": { + "type": "string" + } + }, + { + "description": "The name of the deployment.\n", + "in": "path", + "name": "deployment_name", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "properties": { + "current_release": { + "properties": { + "configuration": { + "properties": { + "hardware": { + "description": "The SKU for the hardware used to run the model.", + "type": "string" + }, + "max_instances": { + "description": "The maximum number of instances for scaling.", + "type": "integer" + }, + "min_instances": { + "description": "The minimum number of instances for scaling.", + "type": "integer" + } + }, + "type": "object" + }, + "created_at": { + "description": "The time the release was created.", + "format": "date-time", + "type": "string" + }, + "created_by": { + "properties": { + "github_url": { + "description": "The GitHub URL of the account that created the release.", + "format": "uri", + "type": "string" + }, + "name": { + "description": "The name of the account that created the release.", + "type": "string" + }, + "type": { + "description": "The account type of the creator. Can be a user or an organization.", + "enum": [ + "organization", + "user" + ], + "type": "string" + }, + "username": { + "description": "The username of the account that created the release.", + "type": "string" + } + }, + "type": "object" + }, + "model": { + "description": "The model identifier string in the format of `{model_owner}/{model_name}`.", + "type": "string" + }, + "number": { + "description": "The release number.", + "type": "integer" + }, + "version": { + "description": "The ID of the model version used in the release.", + "type": "string" + } + }, + "type": "object" + }, + "name": { + "description": "The name of the deployment.", + "type": "string" + }, + "owner": { + "description": "The owner of the deployment.", + "type": "string" + } + }, + "type": "object" + } + } + }, + "description": "Success" + } + }, + "summary": "Get a deployment" + }, + "patch": { + "description": "Update properties of an existing deployment, including hardware, min/max instances, and the deployment's underlying model [version](https://replicate.com/docs/how-does-replicate-work#versions).\n\nExample cURL request:\n\n```console\ncurl -s \\\n -X PATCH \\\n -H \"Authorization: Bearer $REPLICATE_API_TOKEN\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\"min_instances\": 3, \"max_instances\": 10}' \\\n https://api.replicate.com/v1/deployments/acme/my-app-image-generator\n```\n\nThe response will be a JSON object describing the deployment:\n\n```json\n{\n \"owner\": \"acme\",\n \"name\": \"my-app-image-generator\",\n \"current_release\": {\n \"number\": 2,\n \"model\": \"stability-ai/sdxl\",\n \"version\": \"da77bc59ee60423279fd632efb4795ab731d9e3ca9705ef3341091fb989b7eaf\",\n \"created_at\": \"2024-02-15T16:32:57.018467Z\",\n \"created_by\": {\n \"type\": \"organization\",\n \"username\": \"acme\",\n \"name\": \"Acme Corp, Inc.\",\n \"github_url\": \"https://github.com/acme\",\n },\n \"configuration\": {\n \"hardware\": \"gpu-t4\",\n \"min_instances\": 3,\n \"max_instances\": 10\n }\n }\n}\n```\n\nUpdating any deployment properties will increment the `number` field of the `current_release`.\n", + "operationId": "deployments.update", + "parameters": [ + { + "description": "The name of the user or organization that owns the deployment.\n", + "in": "path", + "name": "deployment_owner", + "required": true, + "schema": { + "type": "string" + } + }, + { + "description": "The name of the deployment.\n", + "in": "path", + "name": "deployment_name", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "properties": { + "hardware": { + "description": "The SKU for the hardware used to run the model. Possible values can be retrieved from the `hardware.list` endpoint.", + "type": "string" + }, + "max_instances": { + "description": "The maximum number of instances for scaling.", + "maximum": 20, + "minimum": 0, + "type": "integer" + }, + "min_instances": { + "description": "The minimum number of instances for scaling.", + "maximum": 5, + "minimum": 0, + "type": "integer" + }, + "version": { + "description": "The ID of the model version that you want to deploy", + "type": "string" + } + }, + "type": "object" + } + } + } + }, + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "properties": { + "current_release": { + "properties": { + "configuration": { + "properties": { + "hardware": { + "description": "The SKU for the hardware used to run the model.", + "type": "string" + }, + "max_instances": { + "description": "The maximum number of instances for scaling.", + "type": "integer" + }, + "min_instances": { + "description": "The minimum number of instances for scaling.", + "type": "integer" + } + }, + "type": "object" + }, + "created_at": { + "description": "The time the release was created.", + "format": "date-time", + "type": "string" + }, + "created_by": { + "properties": { + "github_url": { + "description": "The GitHub URL of the account that created the release.", + "format": "uri", + "type": "string" + }, + "name": { + "description": "The name of the account that created the release.", + "type": "string" + }, + "type": { + "description": "The account type of the creator. Can be a user or an organization.", + "enum": [ + "organization", + "user" + ], + "type": "string" + }, + "username": { + "description": "The username of the account that created the release.", + "type": "string" + } + }, + "type": "object" + }, + "model": { + "description": "The model identifier string in the format of `{model_owner}/{model_name}`.", + "type": "string" + }, + "number": { + "description": "The release number.", + "type": "integer" + }, + "version": { + "description": "The ID of the model version used in the release.", + "type": "string" + } + }, + "type": "object" + }, + "name": { + "description": "The name of the deployment.", + "type": "string" + }, + "owner": { + "description": "The owner of the deployment.", + "type": "string" + } + }, + "type": "object" + } + } + }, + "description": "Success" + } + }, + "summary": "Update a deployment" + } + }, + "/deployments/{deployment_owner}/{deployment_name}/predictions": { + "post": { + "description": "Create a prediction for the deployment and inputs you provide.\n\nExample cURL request:\n\n```console\ncurl -s -X POST -H 'Prefer: wait' \\\n -d '{\"input\": {\"prompt\": \"A photo of a bear riding a bicycle over the moon\"}}' \\\n -H \"Authorization: Bearer $REPLICATE_API_TOKEN\" \\\n -H 'Content-Type: application/json' \\\n https://api.replicate.com/v1/deployments/acme/my-app-image-generator/predictions\n```\n\nThe request will wait up to 60 seconds for the model to run. If this time is exceeded the prediction will be returned in a `\"starting\"` state and need to be retrieved using the `predictions.get` endpiont.\n\nFor a complete overview of the `deployments.predictions.create` API check out our documentation on [creating a prediction](https://replicate.com/docs/topics/predictions/create-a-prediction) which covers a variety of use cases.\n", + "operationId": "deployments.predictions.create", + "parameters": [ + { + "description": "The name of the user or organization that owns the deployment.\n", + "in": "path", + "name": "deployment_owner", + "required": true, + "schema": { + "type": "string" + } + }, + { + "description": "The name of the deployment.\n", + "in": "path", + "name": "deployment_name", + "required": true, + "schema": { + "type": "string" + } + }, + { + "$ref": "#/components/parameters/prefer_header" + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/prediction_request" + } + } + } + }, + "responses": { + "201": { + "description": "Prediction has been created. If the `Prefer: wait` header is provided it will contain the final output." + }, + "202": { + "description": "Prediction has been created but does not yet have all outputs" + } + }, + "summary": "Create a prediction using a deployment" + } + }, + "/hardware": { + "get": { + "description": "Example cURL request:\n\n```console\ncurl -s \\\n -H \"Authorization: Bearer $REPLICATE_API_TOKEN\" \\\n https://api.replicate.com/v1/hardware\n```\n\nThe response will be a JSON array of hardware objects:\n\n```json\n[\n {\"name\": \"CPU\", \"sku\": \"cpu\"},\n {\"name\": \"Nvidia T4 GPU\", \"sku\": \"gpu-t4\"},\n {\"name\": \"Nvidia A40 GPU\", \"sku\": \"gpu-a40-small\"},\n {\"name\": \"Nvidia A40 (Large) GPU\", \"sku\": \"gpu-a40-large\"},\n]\n```\n", + "operationId": "hardware.list", + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "items": { + "properties": { + "name": { + "description": "The name of the hardware.", + "type": "string" + }, + "sku": { + "description": "The SKU of the hardware.", + "type": "string" + } + }, + "type": "object" + }, + "type": "array" + } + } + }, + "description": "Success" + } + }, + "summary": "List available hardware for models" + } + }, + "/models": { + "get": { + "description": "Get a paginated list of public models.\n\nExample cURL request:\n\n```console\ncurl -s \\\n -H \"Authorization: Bearer $REPLICATE_API_TOKEN\" \\\n https://api.replicate.com/v1/models\n```\n\nThe response will be a paginated JSON array of model objects:\n\n```json\n{\n \"next\": null,\n \"previous\": null,\n \"results\": [\n {\n \"url\": \"https://replicate.com/acme/hello-world\",\n \"owner\": \"acme\",\n \"name\": \"hello-world\",\n \"description\": \"A tiny model that says hello\",\n \"visibility\": \"public\",\n \"github_url\": \"https://github.com/replicate/cog-examples\",\n \"paper_url\": null,\n \"license_url\": null,\n \"run_count\": 5681081,\n \"cover_image_url\": \"...\",\n \"default_example\": {...},\n \"latest_version\": {...}\n }\n ]\n}\n```\n\nThe `cover_image_url` string is an HTTPS URL for an image file. This can be:\n\n- An image uploaded by the model author.\n- The output file of the example prediction, if the model author has not set a cover image.\n- The input file of the example prediction, if the model author has not set a cover image and the example prediction has no output file.\n- A generic fallback image.\n", + "operationId": "models.list", + "responses": { + "200": { + "description": "Success" + } + }, + "summary": "List public models" + }, + "post": { + "description": "Create a model.\n\nExample cURL request:\n\n```console\ncurl -s -X POST \\\n -H \"Authorization: Bearer $REPLICATE_API_TOKEN\" \\\n -H 'Content-Type: application/json' \\\n -d '{\"owner\": \"alice\", \"name\": \"my-model\", \"description\": \"An example model\", \"visibility\": \"public\", \"hardware\": \"cpu\"}' \\\n https://api.replicate.com/v1/models\n```\n\nThe response will be a model object in the following format:\n\n```json\n{\n \"url\": \"https://replicate.com/alice/my-model\",\n \"owner\": \"alice\",\n \"name\": \"my-model\",\n \"description\": \"An example model\",\n \"visibility\": \"public\",\n \"github_url\": null,\n \"paper_url\": null,\n \"license_url\": null,\n \"run_count\": 0,\n \"cover_image_url\": null,\n \"default_example\": null,\n \"latest_version\": null,\n}\n```\n\nNote that there is a limit of 1,000 models per account. For most purposes, we recommend using a single model and pushing new [versions](https://replicate.com/docs/how-does-replicate-work#versions) of the model as you make changes to it.\n", + "operationId": "models.create", + "requestBody": { + "content": { + "application/json": { + "schema": { + "properties": { + "cover_image_url": { + "description": "A URL for the model's cover image. This should be an image file.", + "type": "string" + }, + "description": { + "description": "A description of the model.", + "type": "string" + }, + "github_url": { + "description": "A URL for the model's source code on GitHub.", + "type": "string" + }, + "hardware": { + "description": "The SKU for the hardware used to run the model. Possible values can be retrieved from the `hardware.list` endpoint.", + "type": "string" + }, + "license_url": { + "description": "A URL for the model's license.", + "type": "string" + }, + "name": { + "description": "The name of the model. This must be unique among all models owned by the user or organization.", + "type": "string" + }, + "owner": { + "description": "The name of the user or organization that will own the model. This must be the same as the user or organization that is making the API request. In other words, the API token used in the request must belong to this user or organization.", + "type": "string" + }, + "paper_url": { + "description": "A URL for the model's paper.", + "type": "string" + }, + "visibility": { + "description": "Whether the model should be public or private. A public model can be viewed and run by anyone, whereas a private model can be viewed and run only by the user or organization members that own the model.", + "enum": [ + "public", + "private" + ], + "type": "string" + } + }, + "required": [ + "owner", + "name", + "visibility", + "hardware" + ], + "type": "object" + } + } + }, + "required": true + }, + "responses": { + "201": { + "description": "Success" + } + }, + "summary": "Create a model" + }, + "query": { + "description": "Get a list of public models matching a search query.\n\nExample cURL request:\n\n```console\ncurl -s -X QUERY \\\n -H \"Authorization: Bearer $REPLICATE_API_TOKEN\" \\\n -H \"Content-Type: text/plain\" \\\n -d \"hello\" \\\n https://api.replicate.com/v1/models\n```\n\nThe response will be a paginated JSON object containing an array of model objects:\n\n```json\n{\n \"next\": null,\n \"previous\": null,\n \"results\": [\n {\n \"url\": \"https://replicate.com/acme/hello-world\",\n \"owner\": \"acme\",\n \"name\": \"hello-world\",\n \"description\": \"A tiny model that says hello\",\n \"visibility\": \"public\",\n \"github_url\": \"https://github.com/replicate/cog-examples\",\n \"paper_url\": null,\n \"license_url\": null,\n \"run_count\": 5681081,\n \"cover_image_url\": \"...\",\n \"default_example\": {...},\n \"latest_version\": {...}\n }\n ]\n}\n```\n\nThe `cover_image_url` string is an HTTPS URL for an image file. This can be:\n\n- An image uploaded by the model author.\n- The output file of the example prediction, if the model author has not set a cover image.\n- The input file of the example prediction, if the model author has not set a cover image and the example prediction has no output file.\n- A generic fallback image.\n", + "operationId": "models.search", + "requestBody": { + "content": { + "text/plain": { + "schema": { + "description": "The search query", + "type": "string" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "Success" + } + }, + "summary": "Search public models" + } + }, + "/models/{model_owner}/{model_name}": { + "delete": { + "description": "Delete a model\n\nModel deletion has some restrictions:\n\n- You can only delete models you own.\n- You can only delete private models.\n- You can only delete models that have no versions associated with them. Currently you'll need to [delete the model's versions](#models.versions.delete) before you can delete the model itself.\n\nExample cURL request:\n\n```command\ncurl -s -X DELETE \\\n -H \"Authorization: Bearer $REPLICATE_API_TOKEN\" \\\n https://api.replicate.com/v1/models/replicate/hello-world\n```\n\nThe response will be an empty 204, indicating the model has been deleted.\n", + "operationId": "models.delete", + "parameters": [ + { + "description": "The name of the user or organization that owns the model.\n", + "in": "path", + "name": "model_owner", + "required": true, + "schema": { + "type": "string" + } + }, + { + "description": "The name of the model.\n", + "in": "path", + "name": "model_name", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "204": { + "description": "Success" + } + }, + "summary": "Delete a model" + }, + "get": { + "description": "Example cURL request:\n\n```console\ncurl -s \\\n -H \"Authorization: Bearer $REPLICATE_API_TOKEN\" \\\n https://api.replicate.com/v1/models/replicate/hello-world\n```\n\nThe response will be a model object in the following format:\n\n```json\n{\n \"url\": \"https://replicate.com/replicate/hello-world\",\n \"owner\": \"replicate\",\n \"name\": \"hello-world\",\n \"description\": \"A tiny model that says hello\",\n \"visibility\": \"public\",\n \"github_url\": \"https://github.com/replicate/cog-examples\",\n \"paper_url\": null,\n \"license_url\": null,\n \"run_count\": 5681081,\n \"cover_image_url\": \"...\",\n \"default_example\": {...},\n \"latest_version\": {...},\n}\n```\n\nThe `cover_image_url` string is an HTTPS URL for an image file. This can be:\n\n- An image uploaded by the model author.\n- The output file of the example prediction, if the model author has not set a cover image.\n- The input file of the example prediction, if the model author has not set a cover image and the example prediction has no output file.\n- A generic fallback image.\n\nThe `default_example` object is a [prediction](#predictions.get) created with this model.\n\nThe `latest_version` object is the model's most recently pushed [version](#models.versions.get).\n", + "operationId": "models.get", + "parameters": [ + { + "description": "The name of the user or organization that owns the model.\n", + "in": "path", + "name": "model_owner", + "required": true, + "schema": { + "type": "string" + } + }, + { + "description": "The name of the model.\n", + "in": "path", + "name": "model_name", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Success" + } + }, + "summary": "Get a model" + } + }, + "/models/{model_owner}/{model_name}/predictions": { + "post": { + "description": "Create a prediction for the deployment and inputs you provide.\n\nExample cURL request:\n\n```console\ncurl -s -X POST -H 'Prefer: wait' \\\n -d '{\"input\": {\"prompt\": \"Write a short poem about the weather.\"}}' \\\n -H \"Authorization: Bearer $REPLICATE_API_TOKEN\" \\\n -H 'Content-Type: application/json' \\\n https://api.replicate.com/v1/models/meta/meta-llama-3-70b-instruct/predictions\n```\n\nThe request will wait up to 60 seconds for the model to run. If this time is exceeded the prediction will be returned in a `\"starting\"` state and need to be retrieved using the `predictions.get` endpiont.\n\nFor a complete overview of the `deployments.predictions.create` API check out our documentation on [creating a prediction](https://replicate.com/docs/topics/predictions/create-a-prediction) which covers a variety of use cases.\n", + "operationId": "models.predictions.create", + "parameters": [ + { + "description": "The name of the user or organization that owns the model.\n", + "in": "path", + "name": "model_owner", + "required": true, + "schema": { + "type": "string" + } + }, + { + "description": "The name of the model.\n", + "in": "path", + "name": "model_name", + "required": true, + "schema": { + "type": "string" + } + }, + { + "$ref": "#/components/parameters/prefer_header" + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/prediction_request" + } + } + } + }, + "responses": { + "201": { + "description": "Prediction has been created. If the `Prefer: wait` header is provided it will contain the final output." + }, + "202": { + "description": "Prediction has been created but does not yet have all outputs" + } + }, + "summary": "Create a prediction using an official model" + } + }, + "/models/{model_owner}/{model_name}/versions": { + "get": { + "description": "Example cURL request:\n\n```console\ncurl -s \\\n -H \"Authorization: Bearer $REPLICATE_API_TOKEN\" \\\n https://api.replicate.com/v1/models/replicate/hello-world/versions\n```\n\nThe response will be a JSON array of model version objects, sorted with the most recent version first:\n\n```json\n{\n \"next\": null,\n \"previous\": null,\n \"results\": [\n {\n \"id\": \"5c7d5dc6dd8bf75c1acaa8565735e7986bc5b66206b55cca93cb72c9bf15ccaa\",\n \"created_at\": \"2022-04-26T19:29:04.418669Z\",\n \"cog_version\": \"0.3.0\",\n \"openapi_schema\": {...}\n }\n ]\n}\n```\n", + "operationId": "models.versions.list", + "parameters": [ + { + "description": "The name of the user or organization that owns the model.\n", + "in": "path", + "name": "model_owner", + "required": true, + "schema": { + "type": "string" + } + }, + { + "description": "The name of the model.\n", + "in": "path", + "name": "model_name", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Success" + } + }, + "summary": "List model versions" + } + }, + "/models/{model_owner}/{model_name}/versions/{version_id}": { + "delete": { + "description": "Delete a model version and all associated predictions, including all output files.\n\nModel version deletion has some restrictions:\n\n- You can only delete versions from models you own.\n- You can only delete versions from private models.\n- You cannot delete a version if someone other than you has run predictions with it.\n- You cannot delete a version if it is being used as the base model for a fine tune/training.\n- You cannot delete a version if it has an associated deployment.\n- You cannot delete a version if another model version is overridden to use it.\n\nExample cURL request:\n\n```command\ncurl -s -X DELETE \\\n -H \"Authorization: Bearer $REPLICATE_API_TOKEN\" \\\n https://api.replicate.com/v1/models/replicate/hello-world/versions/5c7d5dc6dd8bf75c1acaa8565735e7986bc5b66206b55cca93cb72c9bf15ccaa\n```\n\nThe response will be an empty 202, indicating the deletion request has been accepted. It might take a few minutes to be processed.\n", + "operationId": "models.versions.delete", + "parameters": [ + { + "description": "The name of the user or organization that owns the model.\n", + "in": "path", + "name": "model_owner", + "required": true, + "schema": { + "type": "string" + } + }, + { + "description": "The name of the model.\n", + "in": "path", + "name": "model_name", + "required": true, + "schema": { + "type": "string" + } + }, + { + "description": "The ID of the version.\n", + "in": "path", + "name": "version_id", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "202": { + "description": "Deletion request has been accepted. It might take a few minutes to be processed." + } + }, + "summary": "Delete a model version" + }, + "get": { + "description": "Example cURL request:\n\n```console\ncurl -s \\\n -H \"Authorization: Bearer $REPLICATE_API_TOKEN\" \\\n https://api.replicate.com/v1/models/replicate/hello-world/versions/5c7d5dc6dd8bf75c1acaa8565735e7986bc5b66206b55cca93cb72c9bf15ccaa\n```\n\nThe response will be the version object:\n\n```json\n{\n \"id\": \"5c7d5dc6dd8bf75c1acaa8565735e7986bc5b66206b55cca93cb72c9bf15ccaa\",\n \"created_at\": \"2022-04-26T19:29:04.418669Z\",\n \"cog_version\": \"0.3.0\",\n \"openapi_schema\": {...}\n}\n```\n\nEvery model describes its inputs and outputs with [OpenAPI Schema Objects](https://spec.openapis.org/oas/latest.html#schemaObject) in the `openapi_schema` property.\n\nThe `openapi_schema.components.schemas.Input` property for the [replicate/hello-world](https://replicate.com/replicate/hello-world) model looks like this:\n\n```json\n{\n \"type\": \"object\",\n \"title\": \"Input\",\n \"required\": [\n \"text\"\n ],\n \"properties\": {\n \"text\": {\n \"x-order\": 0,\n \"type\": \"string\",\n \"title\": \"Text\",\n \"description\": \"Text to prefix with 'hello '\"\n }\n }\n}\n```\n\nThe `openapi_schema.components.schemas.Output` property for the [replicate/hello-world](https://replicate.com/replicate/hello-world) model looks like this:\n\n```json\n{\n \"type\": \"string\",\n \"title\": \"Output\"\n}\n```\n\nFor more details, see the docs on [Cog's supported input and output types](https://github.com/replicate/cog/blob/75b7802219e7cd4cee845e34c4c22139558615d4/docs/python.md#input-and-output-types)\n", + "operationId": "models.versions.get", + "parameters": [ + { + "description": "The name of the user or organization that owns the model.\n", + "in": "path", + "name": "model_owner", + "required": true, + "schema": { + "type": "string" + } + }, + { + "description": "The name of the model.\n", + "in": "path", + "name": "model_name", + "required": true, + "schema": { + "type": "string" + } + }, + { + "description": "The ID of the version.\n", + "in": "path", + "name": "version_id", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Success" + } + }, + "summary": "Get a model version" + } + }, + "/models/{model_owner}/{model_name}/versions/{version_id}/trainings": { + "post": { + "description": "Start a new training of the model version you specify.\n\nExample request body:\n\n```json\n{\n \"destination\": \"{new_owner}/{new_name}\",\n \"input\": {\n \"train_data\": \"https://example.com/my-input-images.zip\",\n },\n \"webhook\": \"https://example.com/my-webhook\",\n}\n```\n\nExample cURL request:\n\n```console\ncurl -s -X POST \\\n -d '{\"destination\": \"{new_owner}/{new_name}\", \"input\": {\"input_images\": \"https://example.com/my-input-images.zip\"}}' \\\n -H \"Authorization: Bearer $REPLICATE_API_TOKEN\" \\\n -H 'Content-Type: application/json' \\\n https://api.replicate.com/v1/models/stability-ai/sdxl/versions/da77bc59ee60423279fd632efb4795ab731d9e3ca9705ef3341091fb989b7eaf/trainings\n```\n\nThe response will be the training object:\n\n```json\n{\n \"id\": \"zz4ibbonubfz7carwiefibzgga\",\n \"model\": \"stability-ai/sdxl\",\n \"version\": \"da77bc59ee60423279fd632efb4795ab731d9e3ca9705ef3341091fb989b7eaf\",\n \"input\": {\n \"input_images\": \"https://example.com/my-input-images.zip\"\n },\n \"logs\": \"\",\n \"error\": null,\n \"status\": \"starting\",\n \"created_at\": \"2023-09-08T16:32:56.990893084Z\",\n \"urls\": {\n \"cancel\": \"https://api.replicate.com/v1/predictions/zz4ibbonubfz7carwiefibzgga/cancel\",\n \"get\": \"https://api.replicate.com/v1/predictions/zz4ibbonubfz7carwiefibzgga\"\n }\n}\n```\n\nAs models can take several minutes or more to train, the result will not be available immediately. To get the final result of the training you should either provide a `webhook` HTTPS URL for us to call when the results are ready, or poll the [get a training](#trainings.get) endpoint until it has finished.\n\nWhen a training completes, it creates a new [version](https://replicate.com/docs/how-does-replicate-work#terminology) of the model at the specified destination.\n\nTo find some models to train on, check out the [trainable language models collection](https://replicate.com/collections/trainable-language-models).\n", + "operationId": "trainings.create", + "parameters": [ + { + "description": "The name of the user or organization that owns the model.\n", + "in": "path", + "name": "model_owner", + "required": true, + "schema": { + "type": "string" + } + }, + { + "description": "The name of the model.\n", + "in": "path", + "name": "model_name", + "required": true, + "schema": { + "type": "string" + } + }, + { + "description": "The ID of the version.\n", + "in": "path", + "name": "version_id", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/training_request" + } + } + } + }, + "responses": { + "201": { + "description": "Success" + } + }, + "summary": "Create a training" + } + }, + "/predictions": { + "get": { + "description": "Get a paginated list of predictions that you've created. This will include predictions created from the API and the website. It will return 100 records per page.\n\nExample cURL request:\n\n```console\ncurl -s \\\n -H \"Authorization: Bearer $REPLICATE_API_TOKEN\" \\\n https://api.replicate.com/v1/predictions\n```\n\nThe response will be a paginated JSON array of prediction objects, sorted with the most recent prediction first:\n\n```json\n{\n \"next\": null,\n \"previous\": null,\n \"results\": [\n {\n \"completed_at\": \"2023-09-08T16:19:34.791859Z\",\n \"created_at\": \"2023-09-08T16:19:34.907244Z\",\n \"data_removed\": false,\n \"error\": null,\n \"id\": \"gm3qorzdhgbfurvjtvhg6dckhu\",\n \"input\": {\n \"text\": \"Alice\"\n },\n \"metrics\": {\n \"predict_time\": 0.012683\n },\n \"output\": \"hello Alice\",\n \"started_at\": \"2023-09-08T16:19:34.779176Z\",\n \"source\": \"api\",\n \"status\": \"succeeded\",\n \"urls\": {\n \"get\": \"https://api.replicate.com/v1/predictions/gm3qorzdhgbfurvjtvhg6dckhu\",\n \"cancel\": \"https://api.replicate.com/v1/predictions/gm3qorzdhgbfurvjtvhg6dckhu/cancel\"\n },\n \"model\": \"replicate/hello-world\",\n \"version\": \"5c7d5dc6dd8bf75c1acaa8565735e7986bc5b66206b55cca93cb72c9bf15ccaa\",\n }\n ]\n}\n```\n\n`id` will be the unique ID of the prediction.\n\n`source` will indicate how the prediction was created. Possible values are `web` or `api`.\n\n`status` will be the status of the prediction. Refer to [get a single prediction](#predictions.get) for possible values.\n\n`urls` will be a convenience object that can be used to construct new API requests for the given prediction. If the requested model version supports streaming, this will have a `stream` entry with an HTTPS URL that you can use to construct an [`EventSource`](https://developer.mozilla.org/en-US/docs/Web/API/EventSource).\n\n`model` will be the model identifier string in the format of `{model_owner}/{model_name}`.\n\n`version` will be the unique ID of model version used to create the prediction.\n\n`data_removed` will be `true` if the input and output data has been deleted.\n", + "operationId": "predictions.list", + "responses": { + "200": { + "description": "Success" + } + }, + "summary": "List predictions" + }, + "post": { + "description": "Create a prediction for the model version and inputs you provide.\n\nExample cURL request:\n\n```console\ncurl -s -X POST -H 'Prefer: wait' \\\n -d '{\"version\": \"5c7d5dc6dd8bf75c1acaa8565735e7986bc5b66206b55cca93cb72c9bf15ccaa\", \"input\": {\"text\": \"Alice\"}}' \\\n -H \"Authorization: Bearer $REPLICATE_API_TOKEN\" \\\n -H 'Content-Type: application/json' \\\n https://api.replicate.com/v1/predictions\n```\n\nThe request will wait up to 60 seconds for the model to run. If this time is exceeded the prediction will be returned in a `\"starting\"` state and need to be retrieved using the `predictions.get` endpiont.\n\nFor a complete overview of the `predictions.create` API check out our documentation on [creating a prediction](https://replicate.com/docs/topics/predictions/create-a-prediction) which covers a variety of use cases.\n", + "operationId": "predictions.create", + "parameters": [ + { + "$ref": "#/components/parameters/prefer_header" + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/version_prediction_request" + } + } + } + }, + "responses": { + "201": { + "description": "Prediction has been created. If the `Prefer: wait` header is provided it will contain the final output." + }, + "202": { + "description": "Prediction has been created but does not yet have all outputs" + } + }, + "summary": "Create a prediction" + } + }, + "/predictions/{prediction_id}": { + "get": { + "description": "Get the current state of a prediction.\n\nExample cURL request:\n\n```console\ncurl -s \\\n -H \"Authorization: Bearer $REPLICATE_API_TOKEN\" \\\n https://api.replicate.com/v1/predictions/gm3qorzdhgbfurvjtvhg6dckhu\n```\n\nThe response will be the prediction object:\n\n```json\n{\n \"id\": \"gm3qorzdhgbfurvjtvhg6dckhu\",\n \"model\": \"replicate/hello-world\",\n \"version\": \"5c7d5dc6dd8bf75c1acaa8565735e7986bc5b66206b55cca93cb72c9bf15ccaa\",\n \"input\": {\n \"text\": \"Alice\"\n },\n \"logs\": \"\",\n \"output\": \"hello Alice\",\n \"error\": null,\n \"status\": \"succeeded\",\n \"created_at\": \"2023-09-08T16:19:34.765994Z\",\n \"data_removed\": false,\n \"started_at\": \"2023-09-08T16:19:34.779176Z\",\n \"completed_at\": \"2023-09-08T16:19:34.791859Z\",\n \"metrics\": {\n \"predict_time\": 0.012683\n },\n \"urls\": {\n \"cancel\": \"https://api.replicate.com/v1/predictions/gm3qorzdhgbfurvjtvhg6dckhu/cancel\",\n \"get\": \"https://api.replicate.com/v1/predictions/gm3qorzdhgbfurvjtvhg6dckhu\"\n }\n}\n```\n\n`status` will be one of:\n\n- `starting`: the prediction is starting up. If this status lasts longer than a few seconds, then it's typically because a new worker is being started to run the prediction.\n- `processing`: the `predict()` method of the model is currently running.\n- `succeeded`: the prediction completed successfully.\n- `failed`: the prediction encountered an error during processing.\n- `canceled`: the prediction was canceled by its creator.\n\nIn the case of success, `output` will be an object containing the output of the model. Any files will be represented as HTTPS URLs. You'll need to pass the `Authorization` header to request them.\n\nIn the case of failure, `error` will contain the error encountered during the prediction.\n\nTerminated predictions (with a status of `succeeded`, `failed`, or `canceled`) will include a `metrics` object with a `predict_time` property showing the amount of CPU or GPU time, in seconds, that the prediction used while running. It won't include time waiting for the prediction to start.\n\nAll input parameters, output values, and logs are automatically removed after an hour, by default, for predictions created through the API.\n\nYou must save a copy of any data or files in the output if you'd like to continue using them. The `output` key will still be present, but it's value will be `null` after the output has been removed.\n\nOutput files are served by `replicate.delivery` and its subdomains. If you use an allow list of external domains for your assets, add `replicate.delivery` and `*.replicate.delivery` to it.\n", + "operationId": "predictions.get", + "parameters": [ + { + "description": "The ID of the prediction to get.\n", + "in": "path", + "name": "prediction_id", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Success" + } + }, + "summary": "Get a prediction" + } + }, + "/predictions/{prediction_id}/cancel": { + "post": { + "operationId": "predictions.cancel", + "parameters": [ + { + "description": "The ID of the prediction to cancel.\n", + "in": "path", + "name": "prediction_id", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Success" + } + }, + "summary": "Cancel a prediction" + } + }, + "/trainings": { + "get": { + "description": "Get a paginated list of trainings that you've created. This will include trainings created from the API and the website. It will return 100 records per page.\n\nExample cURL request:\n\n```console\ncurl -s \\\n -H \"Authorization: Bearer $REPLICATE_API_TOKEN\" \\\n https://api.replicate.com/v1/trainings\n```\n\nThe response will be a paginated JSON array of training objects, sorted with the most recent training first:\n\n```json\n{\n \"next\": null,\n \"previous\": null,\n \"results\": [\n {\n \"completed_at\": \"2023-09-08T16:41:19.826523Z\",\n \"created_at\": \"2023-09-08T16:32:57.018467Z\",\n \"error\": null,\n \"id\": \"zz4ibbonubfz7carwiefibzgga\",\n \"input\": {\n \"input_images\": \"https://example.com/my-input-images.zip\"\n },\n \"metrics\": {\n \"predict_time\": 502.713876\n },\n \"output\": {\n \"version\": \"...\",\n \"weights\": \"...\"\n },\n \"started_at\": \"2023-09-08T16:32:57.112647Z\",\n \"source\": \"api\",\n \"status\": \"succeeded\",\n \"urls\": {\n \"get\": \"https://api.replicate.com/v1/trainings/zz4ibbonubfz7carwiefibzgga\",\n \"cancel\": \"https://api.replicate.com/v1/trainings/zz4ibbonubfz7carwiefibzgga/cancel\"\n },\n \"model\": \"stability-ai/sdxl\",\n \"version\": \"da77bc59ee60423279fd632efb4795ab731d9e3ca9705ef3341091fb989b7eaf\",\n }\n ]\n}\n```\n\n`id` will be the unique ID of the training.\n\n`source` will indicate how the training was created. Possible values are `web` or `api`.\n\n`status` will be the status of the training. Refer to [get a single training](#trainings.get) for possible values.\n\n`urls` will be a convenience object that can be used to construct new API requests for the given training.\n\n`version` will be the unique ID of model version used to create the training.\n", + "operationId": "trainings.list", + "responses": { + "200": { + "description": "Success" + } + }, + "summary": "List trainings" + } + }, + "/trainings/{training_id}": { + "get": { + "description": "Get the current state of a training.\n\nExample cURL request:\n\n```console\ncurl -s \\\n -H \"Authorization: Bearer $REPLICATE_API_TOKEN\" \\\n https://api.replicate.com/v1/trainings/zz4ibbonubfz7carwiefibzgga\n```\n\nThe response will be the training object:\n\n```json\n{\n \"completed_at\": \"2023-09-08T16:41:19.826523Z\",\n \"created_at\": \"2023-09-08T16:32:57.018467Z\",\n \"error\": null,\n \"id\": \"zz4ibbonubfz7carwiefibzgga\",\n \"input\": {\n \"input_images\": \"https://example.com/my-input-images.zip\"\n },\n \"logs\": \"...\",\n \"metrics\": {\n \"predict_time\": 502.713876\n },\n \"output\": {\n \"version\": \"...\",\n \"weights\": \"...\"\n },\n \"started_at\": \"2023-09-08T16:32:57.112647Z\",\n \"status\": \"succeeded\",\n \"urls\": {\n \"get\": \"https://api.replicate.com/v1/trainings/zz4ibbonubfz7carwiefibzgga\",\n \"cancel\": \"https://api.replicate.com/v1/trainings/zz4ibbonubfz7carwiefibzgga/cancel\"\n },\n \"model\": \"stability-ai/sdxl\",\n \"version\": \"da77bc59ee60423279fd632efb4795ab731d9e3ca9705ef3341091fb989b7eaf\",\n}\n```\n\n`status` will be one of:\n\n- `starting`: the training is starting up. If this status lasts longer than a few seconds, then it's typically because a new worker is being started to run the training.\n- `processing`: the `train()` method of the model is currently running.\n- `succeeded`: the training completed successfully.\n- `failed`: the training encountered an error during processing.\n- `canceled`: the training was canceled by its creator.\n\nIn the case of success, `output` will be an object containing the output of the model. Any files will be represented as HTTPS URLs. You'll need to pass the `Authorization` header to request them.\n\nIn the case of failure, `error` will contain the error encountered during the training.\n\nTerminated trainings (with a status of `succeeded`, `failed`, or `canceled`) will include a `metrics` object with a `predict_time` property showing the amount of CPU or GPU time, in seconds, that the training used while running. It won't include time waiting for the training to start.\n", + "operationId": "trainings.get", + "parameters": [ + { + "description": "The ID of the training to get.\n", + "in": "path", + "name": "training_id", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Success" + } + }, + "summary": "Get a training" + } + }, + "/trainings/{training_id}/cancel": { + "post": { + "operationId": "trainings.cancel", + "parameters": [ + { + "description": "The ID of the training you want to cancel.\n", + "in": "path", + "name": "training_id", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Success" + } + }, + "summary": "Cancel a training" + } + }, + "/webhooks/default/secret": { + "get": { + "description": "Get the signing secret for the default webhook endpoint. This is used to verify that webhook requests are coming from Replicate.\n\nExample cURL request:\n\n```console\ncurl -s \\\n -H \"Authorization: Bearer $REPLICATE_API_TOKEN\" \\\n https://api.replicate.com/v1/webhooks/default/secret\n```\n\nThe response will be a JSON object with a `key` property:\n\n```json\n{\n \"key\": \"...\"\n}\n```\n", + "operationId": "webhooks.default.secret.get", + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "properties": { + "key": { + "description": "The signing secret.", + "type": "string" + } + }, + "type": "object" + } + } + }, + "description": "Success" + } + }, + "summary": "Get the signing secret for the default webhook" + } + } + }, + "security": [ + { + "bearerAuth": [] + } + ], + "servers": [ + { + "url": "https://api.replicate.com/v1" + } + ] +} diff --git a/specs/replicate.yaml b/specs/replicate.yaml deleted file mode 100644 index eadb7a6f12..0000000000 --- a/specs/replicate.yaml +++ /dev/null @@ -1,997 +0,0 @@ -openapi: 3.0.1 -info: - title: Replicate HTTP API - description: A web service for running Replicate models - termsOfService: https://replicate.com/terms - contact: - email: team@replicate.com - version: 1.0.0-a1 -servers: - - url: https://api.replicate.com/v1 -paths: - /account: - get: - summary: Get the authenticated account - description: "Returns information about the user or organization associated with the provided API token.\n\nExample cURL request:\n\n```console\ncurl -s \\\n -H \"Authorization: Bearer \" \\\n https://api.replicate.com/v1/account\n```\n\nThe response will be a JSON object describing the account:\n\n```json\n{\n \"type\": \"organization\",\n \"username\": \"acme\",\n \"name\": \"Acme Corp, Inc.\",\n \"github_url\": \"https://github.com/acme\",\n}\n```\n" - operationId: account.get - responses: - '200': - description: Success - content: - application/json: - schema: - type: object - properties: - github_url: - type: string - description: The GitHub URL of the account. - format: uri - name: - type: string - description: The name of the account. - type: - enum: - - organization - - user - type: string - description: The account type. Can be a user or an organization. - username: - type: string - description: The username of the account. - /collections: - get: - summary: List collections of models - description: "Example cURL request:\n\n```console\ncurl -s \\\n -H \"Authorization: Bearer \" \\\n https://api.replicate.com/v1/collections\n```\n\nThe response will be a paginated JSON list of collection objects:\n\n```json\n{\n \"next\": \"null\",\n \"previous\": null,\n \"results\": [\n {\n \"name\": \"Super resolution\",\n \"slug\": \"super-resolution\",\n \"description\": \"Upscaling models that create high-quality images from low-quality images.\"\n }\n ]\n}\n```\n" - operationId: collections.list - responses: - '200': - description: Success - '/collections/{collection_slug}': - get: - summary: Get a collection of models - description: "Example cURL request:\n\n```console\ncurl -s \\\n -H \"Authorization: Bearer \" \\\n https://api.replicate.com/v1/collections/super-resolution\n```\n\nThe response will be a collection object with a nested list of the models in that collection:\n\n```json\n{\n \"name\": \"Super resolution\",\n \"slug\": \"super-resolution\",\n \"description\": \"Upscaling models that create high-quality images from low-quality images.\",\n \"models\": [...]\n}\n```\n" - operationId: collections.get - parameters: - - name: collection_slug - in: path - description: "The slug of the collection, like `super-resolution` or `image-restoration`. See [replicate.com/collections](https://replicate.com/collections).\n" - required: true - schema: - type: string - responses: - '200': - description: Success - /deployments: - get: - summary: List deployments - description: "Get a list of deployments associated with the current account, including the latest release configuration for each deployment.\n\nExample cURL request:\n\n```console\ncurl -s \\\n -H \"Authorization: Bearer \" \\\n https://api.replicate.com/v1/deployments\n```\n\nThe response will be a paginated JSON array of deployment objects, sorted with the most recent deployment first:\n\n```json\n{\n \"next\": \"http://api.replicate.com/v1/deployments?cursor=cD0yMDIzLTA2LTA2KzIzJTNBNDAlM0EwOC45NjMwMDAlMkIwMCUzQTAw\",\n \"previous\": null,\n \"results\": [\n {\n \"owner\": \"replicate\",\n \"name\": \"my-app-image-generator\",\n \"current_release\": {\n \"number\": 1,\n \"model\": \"stability-ai/sdxl\",\n \"version\": \"da77bc59ee60423279fd632efb4795ab731d9e3ca9705ef3341091fb989b7eaf\",\n \"created_at\": \"2024-02-15T16:32:57.018467Z\",\n \"created_by\": {\n \"type\": \"organization\",\n \"username\": \"acme\",\n \"name\": \"Acme Corp, Inc.\",\n \"github_url\": \"https://github.com/acme\",\n },\n \"configuration\": {\n \"hardware\": \"gpu-t4\",\n \"min_instances\": 1,\n \"max_instances\": 5\n }\n }\n }\n ]\n}\n```\n" - operationId: deployments.list - responses: - '200': - description: Success - content: - application/json: - schema: - type: object - properties: - next: - type: string - description: A URL pointing to the next page of deployment objects if any - nullable: true - previous: - type: string - description: A URL pointing to the previous page of deployment objects if any - nullable: true - results: - type: array - items: - type: object - properties: - current_release: - type: object - properties: - configuration: - type: object - properties: - hardware: - type: string - description: The SKU for the hardware used to run the model. - max_instances: - type: integer - description: The maximum number of instances for scaling. - min_instances: - type: integer - description: The minimum number of instances for scaling. - created_at: - type: string - description: The time the release was created. - format: date-time - created_by: - type: object - properties: - github_url: - type: string - description: The GitHub URL of the account that created the release. - format: uri - name: - type: string - description: The name of the account that created the release. - type: - enum: - - organization - - user - type: string - description: The account type of the creator. Can be a user or an organization. - username: - type: string - description: The username of the account that created the release. - model: - type: string - description: 'The model identifier string in the format of `{model_owner}/{model_name}`.' - number: - type: integer - description: 'The release number. This is an auto-incrementing integer that starts at 1, and is set automatically when a deployment is created.' - version: - type: string - description: The ID of the model version used in the release. - name: - type: string - description: The name of the deployment. - owner: - type: string - description: The owner of the deployment. - description: An array containing a page of deployment objects - post: - summary: Create a deployment - description: "Create a new deployment:\n\nExample cURL request:\n\n```console\ncurl -s \\\n -X POST \\\n -H \"Authorization: Bearer \" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"name\": \"my-app-image-generator\",\n \"model\": \"stability-ai/sdxl\",\n \"version\": \"da77bc59ee60423279fd632efb4795ab731d9e3ca9705ef3341091fb989b7eaf\",\n \"hardware\": \"gpu-t4\",\n \"min_instances\": 0,\n \"max_instances\": 3\n }' \\\n https://api.replicate.com/v1/deployments\n```\n\nThe response will be a JSON object describing the deployment:\n\n```json\n{\n \"owner\": \"acme\",\n \"name\": \"my-app-image-generator\",\n \"current_release\": {\n \"number\": 1,\n \"model\": \"stability-ai/sdxl\",\n \"version\": \"da77bc59ee60423279fd632efb4795ab731d9e3ca9705ef3341091fb989b7eaf\",\n \"created_at\": \"2024-02-15T16:32:57.018467Z\",\n \"created_by\": {\n \"type\": \"organization\",\n \"username\": \"acme\",\n \"name\": \"Acme Corp, Inc.\",\n \"github_url\": \"https://github.com/acme\",\n },\n \"configuration\": {\n \"hardware\": \"gpu-t4\",\n \"min_instances\": 1,\n \"max_instances\": 5\n }\n }\n}\n```\n" - operationId: deployments.create - requestBody: - content: - application/json: - schema: - required: - - name - - model - - version - - hardware - - min_instances - - max_instances - type: object - properties: - hardware: - type: string - description: The SKU for the hardware used to run the model. Possible values can be retrieved from the `hardware.list` endpoint. - max_instances: - maximum: 20 - minimum: 0 - type: integer - description: The maximum number of instances for scaling. - min_instances: - maximum: 5 - minimum: 0 - type: integer - description: The minimum number of instances for scaling. - model: - type: string - description: The full name of the model that you want to deploy e.g. stability-ai/sdxl. - name: - type: string - description: The name of the deployment. - version: - type: string - description: The 64-character string ID of the model version that you want to deploy. - required: true - responses: - '200': - description: Success - content: - application/json: - schema: - type: object - properties: - current_release: - type: object - properties: - configuration: - type: object - properties: - hardware: - type: string - description: The SKU for the hardware used to run the model. - max_instances: - type: integer - description: The maximum number of instances for scaling. - min_instances: - type: integer - description: The minimum number of instances for scaling. - created_at: - type: string - description: The time the release was created. - format: date-time - created_by: - type: object - properties: - github_url: - type: string - description: The GitHub URL of the account that created the release. - format: uri - name: - type: string - description: The name of the account that created the release. - type: - enum: - - organization - - user - type: string - description: The account type of the creator. Can be a user or an organization. - username: - type: string - description: The username of the account that created the release. - model: - type: string - description: 'The model identifier string in the format of `{model_owner}/{model_name}`.' - number: - type: integer - description: The release number. - version: - type: string - description: The ID of the model version used in the release. - name: - type: string - description: The name of the deployment. - owner: - type: string - description: The owner of the deployment. - '/deployments/{deployment_owner}/{deployment_name}': - delete: - summary: Delete a deployment - description: "Delete a deployment\n\nDeployment deletion has some restrictions:\n\n- You can only delete deployments that have been offline and unused for at least 15 minutes.\n\nExample cURL request:\n\n```command\ncurl -s -X DELETE \\\n -H \"Authorization: Bearer \" \\\n https://api.replicate.com/v1/deployments/acme/my-app-image-generator\n```\n\nThe response will be an empty 204, indicating the deployment has been deleted.\n" - operationId: deployments.delete - parameters: - - name: deployment_owner - in: path - description: "The name of the user or organization that owns the deployment.\n" - required: true - schema: - type: string - - name: deployment_name - in: path - description: "The name of the deployment.\n" - required: true - schema: - type: string - responses: - '204': - description: Success - get: - summary: Get a deployment - description: "Get information about a deployment by name including the current release.\n\nExample cURL request:\n\n```console\ncurl -s \\\n -H \"Authorization: Bearer \" \\\n https://api.replicate.com/v1/deployments/replicate/my-app-image-generator\n```\n\nThe response will be a JSON object describing the deployment:\n\n```json\n{\n \"owner\": \"acme\",\n \"name\": \"my-app-image-generator\",\n \"current_release\": {\n \"number\": 1,\n \"model\": \"stability-ai/sdxl\",\n \"version\": \"da77bc59ee60423279fd632efb4795ab731d9e3ca9705ef3341091fb989b7eaf\",\n \"created_at\": \"2024-02-15T16:32:57.018467Z\",\n \"created_by\": {\n \"type\": \"organization\",\n \"username\": \"acme\",\n \"name\": \"Acme Corp, Inc.\",\n \"github_url\": \"https://github.com/acme\",\n },\n \"configuration\": {\n \"hardware\": \"gpu-t4\",\n \"min_instances\": 1,\n \"max_instances\": 5\n }\n }\n}\n```\n" - operationId: deployments.get - parameters: - - name: deployment_owner - in: path - description: "The name of the user or organization that owns the deployment.\n" - required: true - schema: - type: string - - name: deployment_name - in: path - description: "The name of the deployment.\n" - required: true - schema: - type: string - responses: - '200': - description: Success - content: - application/json: - schema: - type: object - properties: - current_release: - type: object - properties: - configuration: - type: object - properties: - hardware: - type: string - description: The SKU for the hardware used to run the model. - max_instances: - type: integer - description: The maximum number of instances for scaling. - min_instances: - type: integer - description: The minimum number of instances for scaling. - created_at: - type: string - description: The time the release was created. - format: date-time - created_by: - type: object - properties: - github_url: - type: string - description: The GitHub URL of the account that created the release. - format: uri - name: - type: string - description: The name of the account that created the release. - type: - enum: - - organization - - user - type: string - description: The account type of the creator. Can be a user or an organization. - username: - type: string - description: The username of the account that created the release. - model: - type: string - description: 'The model identifier string in the format of `{model_owner}/{model_name}`.' - number: - type: integer - description: The release number. - version: - type: string - description: The ID of the model version used in the release. - name: - type: string - description: The name of the deployment. - owner: - type: string - description: The owner of the deployment. - patch: - summary: Update a deployment - description: "Update properties of an existing deployment, including hardware, min/max instances, and the deployment's underlying model [version](https://replicate.com/docs/how-does-replicate-work#versions).\n\nExample cURL request:\n\n```console\ncurl -s \\\n -X PATCH \\\n -H \"Authorization: Bearer \" \\\n -H \"Content-Type: application/json\" \\\n -d '{\"min_instances\": 3, \"max_instances\": 10}' \\\n https://api.replicate.com/v1/deployments/acme/my-app-image-generator\n```\n\nThe response will be a JSON object describing the deployment:\n\n```json\n{\n \"owner\": \"acme\",\n \"name\": \"my-app-image-generator\",\n \"current_release\": {\n \"number\": 2,\n \"model\": \"stability-ai/sdxl\",\n \"version\": \"da77bc59ee60423279fd632efb4795ab731d9e3ca9705ef3341091fb989b7eaf\",\n \"created_at\": \"2024-02-15T16:32:57.018467Z\",\n \"created_by\": {\n \"type\": \"organization\",\n \"username\": \"acme\",\n \"name\": \"Acme Corp, Inc.\",\n \"github_url\": \"https://github.com/acme\",\n },\n \"configuration\": {\n \"hardware\": \"gpu-t4\",\n \"min_instances\": 3,\n \"max_instances\": 10\n }\n }\n}\n```\n\nUpdating any deployment properties will increment the `number` field of the `current_release`.\n" - operationId: deployments.update - parameters: - - name: deployment_owner - in: path - description: "The name of the user or organization that owns the deployment.\n" - required: true - schema: - type: string - - name: deployment_name - in: path - description: "The name of the deployment.\n" - required: true - schema: - type: string - requestBody: - content: - application/json: - schema: - type: object - properties: - hardware: - type: string - description: The SKU for the hardware used to run the model. Possible values can be retrieved from the `hardware.list` endpoint. - max_instances: - maximum: 20 - minimum: 0 - type: integer - description: The maximum number of instances for scaling. - min_instances: - maximum: 5 - minimum: 0 - type: integer - description: The minimum number of instances for scaling. - version: - type: string - description: The ID of the model version that you want to deploy - responses: - '200': - description: Success - content: - application/json: - schema: - type: object - properties: - current_release: - type: object - properties: - configuration: - type: object - properties: - hardware: - type: string - description: The SKU for the hardware used to run the model. - max_instances: - type: integer - description: The maximum number of instances for scaling. - min_instances: - type: integer - description: The minimum number of instances for scaling. - created_at: - type: string - description: The time the release was created. - format: date-time - created_by: - type: object - properties: - github_url: - type: string - description: The GitHub URL of the account that created the release. - format: uri - name: - type: string - description: The name of the account that created the release. - type: - enum: - - organization - - user - type: string - description: The account type of the creator. Can be a user or an organization. - username: - type: string - description: The username of the account that created the release. - model: - type: string - description: 'The model identifier string in the format of `{model_owner}/{model_name}`.' - number: - type: integer - description: The release number. - version: - type: string - description: The ID of the model version used in the release. - name: - type: string - description: The name of the deployment. - owner: - type: string - description: The owner of the deployment. - '/deployments/{deployment_owner}/{deployment_name}/predictions': - post: - summary: Create a prediction using a deployment - description: "Start a new prediction for a deployment of a model using inputs you provide.\n\nExample request body:\n\n```json\n{\n \"input\": {\n \"text\": \"Alice\"\n }\n}\n```\n\nExample cURL request:\n\n```console\ncurl -s -X POST \\\n -d '{\"input\": {\"text\": \"Alice\"}}' \\\n -H \"Authorization: Bearer \" \\\n -H 'Content-Type: application/json' \\\n \"https://api.replicate.com/v1/deployments/replicate/hello-world/predictions\"\n```\n\nThe response will be the prediction object:\n\n```json\n{\n \"id\": \"86b6trbv99rgp0cf1h886f69ew\",\n \"model\": \"replicate/hello-world\",\n \"version\": \"dp-8e43d61c333b5ddc7a921130bc3ab3ea\",\n \"input\": {\n \"text\": \"Alice\"\n },\n \"logs\": \"\",\n \"error\": null,\n \"status\": \"starting\",\n \"created_at\": \"2024-04-23T18:55:52.138Z\",\n \"urls\": {\n \"cancel\": \"https://api.replicate.com/v1/predictions/86b6trbv99rgp0cf1h886f69ew/cancel\",\n \"get\": \"https://api.replicate.com/v1/predictions/86b6trbv99rgp0cf1h886f69ew\"\n }\n}\n```\n\nAs models can take several seconds or more to run, the output will not be available immediately. To get the final result of the prediction you should either provide a `webhook` HTTPS URL for us to call when the results are ready, or poll the [get a prediction](#predictions.get) endpoint until it has finished.\n\nInput and output (including any files) will be automatically deleted after an hour, so you must save a copy of any files in the output if you'd like to continue using them.\n\nOutput files are served by `replicate.delivery` and its subdomains. If you use an allow list of external domains for your assets, add `replicate.delivery` and `*.replicate.delivery` to it.\n" - operationId: deployments.predictions.create - parameters: - - name: deployment_owner - in: path - description: "The name of the user or organization that owns the deployment.\n" - required: true - schema: - type: string - - name: deployment_name - in: path - description: "The name of the deployment.\n" - required: true - schema: - type: string - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/prediction_request' - responses: - '200': - description: Success - /hardware: - get: - summary: List available hardware for models - description: "Example cURL request:\n\n```console\ncurl -s \\\n -H \"Authorization: Bearer \" \\\n https://api.replicate.com/v1/hardware\n```\n\nThe response will be a JSON array of hardware objects:\n\n```json\n[\n {\"name\": \"CPU\", \"sku\": \"cpu\"},\n {\"name\": \"Nvidia T4 GPU\", \"sku\": \"gpu-t4\"},\n {\"name\": \"Nvidia A40 GPU\", \"sku\": \"gpu-a40-small\"},\n {\"name\": \"Nvidia A40 (Large) GPU\", \"sku\": \"gpu-a40-large\"},\n]\n```\n" - operationId: hardware.list - responses: - '200': - description: Success - content: - application/json: - schema: - type: array - items: - type: object - properties: - name: - type: string - description: The name of the hardware. - sku: - type: string - description: The SKU of the hardware. - /models: - get: - summary: List public models - description: "Get a paginated list of public models.\n\nExample cURL request:\n\n```console\ncurl -s \\\n -H \"Authorization: Bearer \" \\\n https://api.replicate.com/v1/models\n```\n\nThe response will be a paginated JSON array of model objects:\n\n```json\n{\n \"next\": null,\n \"previous\": null,\n \"results\": [\n {\n \"url\": \"https://replicate.com/acme/hello-world\",\n \"owner\": \"acme\",\n \"name\": \"hello-world\",\n \"description\": \"A tiny model that says hello\",\n \"visibility\": \"public\",\n \"github_url\": \"https://github.com/replicate/cog-examples\",\n \"paper_url\": null,\n \"license_url\": null,\n \"run_count\": 5681081,\n \"cover_image_url\": \"...\",\n \"default_example\": {...},\n \"latest_version\": {...}\n }\n ]\n}\n```\n\nThe `cover_image_url` string is an HTTPS URL for an image file. This can be:\n\n- An image uploaded by the model author.\n- The output file of the example prediction, if the model author has not set a cover image.\n- The input file of the example prediction, if the model author has not set a cover image and the example prediction has no output file.\n- A generic fallback image.\n" - operationId: models.list - responses: - '200': - description: Success - post: - summary: Create a model - description: "Create a model.\n\nExample cURL request:\n\n```console\ncurl -s -X POST \\\n -H \"Authorization: Bearer \" \\\n -H 'Content-Type: application/json' \\\n -d '{\"owner\": \"alice\", \"name\": \"my-model\", \"description\": \"An example model\", \"visibility\": \"public\", \"hardware\": \"cpu\"}' \\\n https://api.replicate.com/v1/models\n```\n\nThe response will be a model object in the following format:\n\n```json\n{\n \"url\": \"https://replicate.com/alice/my-model\",\n \"owner\": \"alice\",\n \"name\": \"my-model\",\n \"description\": \"An example model\",\n \"visibility\": \"public\",\n \"github_url\": null,\n \"paper_url\": null,\n \"license_url\": null,\n \"run_count\": 0,\n \"cover_image_url\": null,\n \"default_example\": null,\n \"latest_version\": null,\n}\n```\n\nNote that there is a limit of 1,000 models per account. For most purposes, we recommend using a single model and pushing new [versions](https://replicate.com/docs/how-does-replicate-work#versions) of the model as you make changes to it.\n" - operationId: models.create - requestBody: - content: - application/json: - schema: - required: - - owner - - name - - visibility - - hardware - type: object - properties: - cover_image_url: - type: string - description: A URL for the model's cover image. This should be an image file. - description: - type: string - description: A description of the model. - github_url: - type: string - description: A URL for the model's source code on GitHub. - hardware: - type: string - description: The SKU for the hardware used to run the model. Possible values can be retrieved from the `hardware.list` endpoint. - license_url: - type: string - description: A URL for the model's license. - name: - type: string - description: The name of the model. This must be unique among all models owned by the user or organization. - owner: - type: string - description: 'The name of the user or organization that will own the model. This must be the same as the user or organization that is making the API request. In other words, the API token used in the request must belong to this user or organization.' - paper_url: - type: string - description: A URL for the model's paper. - visibility: - enum: - - public - - private - type: string - description: 'Whether the model should be public or private. A public model can be viewed and run by anyone, whereas a private model can be viewed and run only by the user or organization members that own the model.' - required: true - responses: - '201': - description: Success - '/models/{model_owner}/{model_name}': - delete: - summary: Delete a model - description: "Delete a model\n\nModel deletion has some restrictions:\n\n- You can only delete models you own.\n- You can only delete private models.\n- You can only delete models that have no versions associated with them. Currently you'll need to [delete the model's versions](#models.versions.delete) before you can delete the model itself.\n\nExample cURL request:\n\n```command\ncurl -s -X DELETE \\\n -H \"Authorization: Bearer \" \\\n https://api.replicate.com/v1/models/replicate/hello-world\n```\n\nThe response will be an empty 204, indicating the model has been deleted.\n" - operationId: models.delete - parameters: - - name: model_owner - in: path - description: "The name of the user or organization that owns the model.\n" - required: true - schema: - type: string - - name: model_name - in: path - description: "The name of the model.\n" - required: true - schema: - type: string - responses: - '204': - description: Success - get: - summary: Get a model - description: "Example cURL request:\n\n```console\ncurl -s \\\n -H \"Authorization: Bearer \" \\\n https://api.replicate.com/v1/models/replicate/hello-world\n```\n\nThe response will be a model object in the following format:\n\n```json\n{\n \"url\": \"https://replicate.com/replicate/hello-world\",\n \"owner\": \"replicate\",\n \"name\": \"hello-world\",\n \"description\": \"A tiny model that says hello\",\n \"visibility\": \"public\",\n \"github_url\": \"https://github.com/replicate/cog-examples\",\n \"paper_url\": null,\n \"license_url\": null,\n \"run_count\": 5681081,\n \"cover_image_url\": \"...\",\n \"default_example\": {...},\n \"latest_version\": {...},\n}\n```\n\nThe `cover_image_url` string is an HTTPS URL for an image file. This can be:\n\n- An image uploaded by the model author.\n- The output file of the example prediction, if the model author has not set a cover image.\n- The input file of the example prediction, if the model author has not set a cover image and the example prediction has no output file.\n- A generic fallback image.\n\nThe `default_example` object is a [prediction](#predictions.get) created with this model.\n\nThe `latest_version` object is the model's most recently pushed [version](#models.versions.get).\n" - operationId: models.get - parameters: - - name: model_owner - in: path - description: "The name of the user or organization that owns the model.\n" - required: true - schema: - type: string - - name: model_name - in: path - description: "The name of the model.\n" - required: true - schema: - type: string - responses: - '200': - description: Success - '/models/{model_owner}/{model_name}/predictions': - post: - summary: Create a prediction using an official model - description: "Start a new prediction for an official model using the inputs you provide.\n\nExample request body:\n\n```json\n{\n \"input\": {\n \"prompt\": \"Write a short poem about the weather.\"\n }\n}\n```\n\nExample cURL request:\n\n```console\ncurl -s -X POST \\\n -d '{\"input\": {\"prompt\": \"Write a short poem about the weather.\"}}' \\\n -H \"Authorization: Bearer \" \\\n -H 'Content-Type: application/json' \\\n https://api.replicate.com/v1/models/meta/meta-llama-3-70b-instruct/predictions\n```\n\nThe response will be the prediction object:\n\n```json\n{\n \"id\": \"25s2s4n7rdrgg0cf1httb3myk0\",\n \"model\": \"replicate-internal/llama3-70b-chat-vllm-unquantized\",\n \"version\": \"dp-cf04fe09351e25db628e8b6181276547\",\n \"input\": {\n \"prompt\": \"Write a short poem about the weather.\"\n },\n \"logs\": \"\",\n \"error\": null,\n \"status\": \"starting\",\n \"created_at\": \"2024-04-23T19:36:28.355Z\",\n \"urls\": {\n \"cancel\": \"https://api.replicate.com/v1/predictions/25s2s4n7rdrgg0cf1httb3myk0/cancel\",\n \"get\": \"https://api.replicate.com/v1/predictions/25s2s4n7rdrgg0cf1httb3myk0\"\n }\n}\n```\n\nAs models can take several seconds or more to run, the output will not be available immediately. To get the final result of the prediction you should either provide a `webhook` HTTPS URL for us to call when the results are ready, or poll the [get a prediction](#predictions.get) endpoint until it has finished.\n\nAll input parameters, output values, and logs are automatically removed after an hour, by default, for predictions created through the API.\n\nOutput files are served by `replicate.delivery` and its subdomains. If you use an allow list of external domains for your assets, add `replicate.delivery` and `*.replicate.delivery` to it.\n" - operationId: models.predictions.create - parameters: - - name: model_owner - in: path - description: "The name of the user or organization that owns the model.\n" - required: true - schema: - type: string - - name: model_name - in: path - description: "The name of the model.\n" - required: true - schema: - type: string - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/prediction_request' - responses: - '200': - description: Successful - content: - application/json: - schema: - $ref: '#/components/schemas/prediction_response' - '/models/{model_owner}/{model_name}/versions': - get: - summary: List model versions - description: "Example cURL request:\n\n```console\ncurl -s \\\n -H \"Authorization: Bearer \" \\\n https://api.replicate.com/v1/models/replicate/hello-world/versions\n```\n\nThe response will be a JSON array of model version objects, sorted with the most recent version first:\n\n```json\n{\n \"next\": null,\n \"previous\": null,\n \"results\": [\n {\n \"id\": \"5c7d5dc6dd8bf75c1acaa8565735e7986bc5b66206b55cca93cb72c9bf15ccaa\",\n \"created_at\": \"2022-04-26T19:29:04.418669Z\",\n \"cog_version\": \"0.3.0\",\n \"openapi_schema\": {...}\n }\n ]\n}\n```\n" - operationId: models.versions.list - parameters: - - name: model_owner - in: path - description: "The name of the user or organization that owns the model.\n" - required: true - schema: - type: string - - name: model_name - in: path - description: "The name of the model.\n" - required: true - schema: - type: string - responses: - '200': - description: Success - '/models/{model_owner}/{model_name}/versions/{version_id}': - delete: - summary: Delete a model version - description: "Delete a model version and all associated predictions, including all output files.\n\nModel version deletion has some restrictions:\n\n- You can only delete versions from models you own.\n- You can only delete versions from private models.\n- You cannot delete a version if someone other than you has run predictions with it.\n- You cannot delete a version if it is being used as the base model for a fine tune/training.\n- You cannot delete a version if it has an associated deployment.\n- You cannot delete a version if another model version is overridden to use it.\n\nExample cURL request:\n\n```command\ncurl -s -X DELETE \\\n -H \"Authorization: Bearer \" \\\n https://api.replicate.com/v1/models/replicate/hello-world/versions/5c7d5dc6dd8bf75c1acaa8565735e7986bc5b66206b55cca93cb72c9bf15ccaa\n```\n\nThe response will be an empty 202, indicating the deletion request has been accepted. It might take a few minutes to be processed.\n" - operationId: models.versions.delete - parameters: - - name: model_owner - in: path - description: "The name of the user or organization that owns the model.\n" - required: true - schema: - type: string - - name: model_name - in: path - description: "The name of the model.\n" - required: true - schema: - type: string - - name: version_id - in: path - description: "The ID of the version.\n" - required: true - schema: - type: string - responses: - '202': - description: Deletion request has been accepted. It might take a few minutes to be processed. - get: - summary: Get a model version - description: "Example cURL request:\n\n```console\ncurl -s \\\n -H \"Authorization: Bearer \" \\\n https://api.replicate.com/v1/models/replicate/hello-world/versions/5c7d5dc6dd8bf75c1acaa8565735e7986bc5b66206b55cca93cb72c9bf15ccaa\n```\n\nThe response will be the version object:\n\n```json\n{\n \"id\": \"5c7d5dc6dd8bf75c1acaa8565735e7986bc5b66206b55cca93cb72c9bf15ccaa\",\n \"created_at\": \"2022-04-26T19:29:04.418669Z\",\n \"cog_version\": \"0.3.0\",\n \"openapi_schema\": {...}\n}\n```\n\nEvery model describes its inputs and outputs with [OpenAPI Schema Objects](https://spec.openapis.org/oas/latest.html#schemaObject) in the `openapi_schema` property.\n\nThe `openapi_schema.components.schemas.Input` property for the [replicate/hello-world](https://replicate.com/replicate/hello-world) model looks like this:\n\n```json\n{\n \"type\": \"object\",\n \"title\": \"Input\",\n \"required\": [\n \"text\"\n ],\n \"properties\": {\n \"text\": {\n \"x-order\": 0,\n \"type\": \"string\",\n \"title\": \"Text\",\n \"description\": \"Text to prefix with 'hello '\"\n }\n }\n}\n```\n\nThe `openapi_schema.components.schemas.Output` property for the [replicate/hello-world](https://replicate.com/replicate/hello-world) model looks like this:\n\n```json\n{\n \"type\": \"string\",\n \"title\": \"Output\"\n}\n```\n\nFor more details, see the docs on [Cog's supported input and output types](https://github.com/replicate/cog/blob/75b7802219e7cd4cee845e34c4c22139558615d4/docs/python.md#input-and-output-types)\n" - operationId: models.versions.get - parameters: - - name: model_owner - in: path - description: "The name of the user or organization that owns the model.\n" - required: true - schema: - type: string - - name: model_name - in: path - description: "The name of the model.\n" - required: true - schema: - type: string - - name: version_id - in: path - description: "The ID of the version.\n" - required: true - schema: - type: string - responses: - '200': - description: Success - '/models/{model_owner}/{model_name}/versions/{version_id}/trainings': - post: - summary: Create a training - description: "Start a new training of the model version you specify.\n\nExample request body:\n\n```json\n{\n \"destination\": \"{new_owner}/{new_name}\",\n \"input\": {\n \"train_data\": \"https://example.com/my-input-images.zip\",\n },\n \"webhook\": \"https://example.com/my-webhook\",\n}\n```\n\nExample cURL request:\n\n```console\ncurl -s -X POST \\\n -d '{\"destination\": \"{new_owner}/{new_name}\", \"input\": {\"input_images\": \"https://example.com/my-input-images.zip\"}}' \\\n -H \"Authorization: Bearer \" \\\n -H 'Content-Type: application/json' \\\n https://api.replicate.com/v1/models/stability-ai/sdxl/versions/da77bc59ee60423279fd632efb4795ab731d9e3ca9705ef3341091fb989b7eaf/trainings\n```\n\nThe response will be the training object:\n\n```json\n{\n \"id\": \"zz4ibbonubfz7carwiefibzgga\",\n \"model\": \"stability-ai/sdxl\",\n \"version\": \"da77bc59ee60423279fd632efb4795ab731d9e3ca9705ef3341091fb989b7eaf\",\n \"input\": {\n \"input_images\": \"https://example.com/my-input-images.zip\"\n },\n \"logs\": \"\",\n \"error\": null,\n \"status\": \"starting\",\n \"created_at\": \"2023-09-08T16:32:56.990893084Z\",\n \"urls\": {\n \"cancel\": \"https://api.replicate.com/v1/predictions/zz4ibbonubfz7carwiefibzgga/cancel\",\n \"get\": \"https://api.replicate.com/v1/predictions/zz4ibbonubfz7carwiefibzgga\"\n }\n}\n```\n\nAs models can take several minutes or more to train, the result will not be available immediately. To get the final result of the training you should either provide a `webhook` HTTPS URL for us to call when the results are ready, or poll the [get a training](#trainings.get) endpoint until it has finished.\n\nWhen a training completes, it creates a new [version](https://replicate.com/docs/how-does-replicate-work#terminology) of the model at the specified destination.\n\nTo find some models to train on, check out the [trainable language models collection](https://replicate.com/collections/trainable-language-models).\n" - operationId: trainings.create - parameters: - - name: model_owner - in: path - description: "The name of the user or organization that owns the model.\n" - required: true - schema: - type: string - - name: model_name - in: path - description: "The name of the model.\n" - required: true - schema: - type: string - - name: version_id - in: path - description: "The ID of the version.\n" - required: true - schema: - type: string - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/training_request' - responses: - '201': - description: Success - /predictions: - get: - summary: List predictions - description: "Get a paginated list of predictions that you've created. This will include predictions created from the API and the website. It will return 100 records per page.\n\nExample cURL request:\n\n```console\ncurl -s \\\n -H \"Authorization: Bearer \" \\\n https://api.replicate.com/v1/predictions\n```\n\nThe response will be a paginated JSON array of prediction objects, sorted with the most recent prediction first:\n\n```json\n{\n \"next\": null,\n \"previous\": null,\n \"results\": [\n {\n \"completed_at\": \"2023-09-08T16:19:34.791859Z\",\n \"created_at\": \"2023-09-08T16:19:34.907244Z\",\n \"data_removed\": false,\n \"error\": null,\n \"id\": \"gm3qorzdhgbfurvjtvhg6dckhu\",\n \"input\": {\n \"text\": \"Alice\"\n },\n \"metrics\": {\n \"predict_time\": 0.012683\n },\n \"output\": \"hello Alice\",\n \"started_at\": \"2023-09-08T16:19:34.779176Z\",\n \"source\": \"api\",\n \"status\": \"succeeded\",\n \"urls\": {\n \"get\": \"https://api.replicate.com/v1/predictions/gm3qorzdhgbfurvjtvhg6dckhu\",\n \"cancel\": \"https://api.replicate.com/v1/predictions/gm3qorzdhgbfurvjtvhg6dckhu/cancel\"\n },\n \"model\": \"replicate/hello-world\",\n \"version\": \"5c7d5dc6dd8bf75c1acaa8565735e7986bc5b66206b55cca93cb72c9bf15ccaa\",\n }\n ]\n}\n```\n\n`id` will be the unique ID of the prediction.\n\n`source` will indicate how the prediction was created. Possible values are `web` or `api`.\n\n`status` will be the status of the prediction. Refer to [get a single prediction](#predictions.get) for possible values.\n\n`urls` will be a convenience object that can be used to construct new API requests for the given prediction. If the requested model version supports streaming, this will have a `stream` entry with an HTTPS URL that you can use to construct an [`EventSource`](https://developer.mozilla.org/en-US/docs/Web/API/EventSource).\n\n`model` will be the model identifier string in the format of `{model_owner}/{model_name}`.\n\n`version` will be the unique ID of model version used to create the prediction.\n\n`data_removed` will be `true` if the input and output data has been deleted.\n" - operationId: predictions.list - responses: - '200': - description: Success - post: - summary: Create a prediction - description: "Start a new prediction for the model version and inputs you provide.\n\nExample request body:\n\n```json\n{\n \"version\": \"5c7d5dc6dd8bf75c1acaa8565735e7986bc5b66206b55cca93cb72c9bf15ccaa\",\n \"input\": {\n \"text\": \"Alice\"\n }\n}\n```\n\nExample cURL request:\n\n```console\ncurl -s -X POST \\\n -d '{\"version\": \"5c7d5dc6dd8bf75c1acaa8565735e7986bc5b66206b55cca93cb72c9bf15ccaa\", \"input\": {\"text\": \"Alice\"}}' \\\n -H \"Authorization: Bearer \" \\\n -H 'Content-Type: application/json' \\\n https://api.replicate.com/v1/predictions\n```\n\nThe response will be the prediction object:\n\n```json\n{\n \"id\": \"gm3qorzdhgbfurvjtvhg6dckhu\",\n \"model\": \"replicate/hello-world\",\n \"version\": \"5c7d5dc6dd8bf75c1acaa8565735e7986bc5b66206b55cca93cb72c9bf15ccaa\",\n \"input\": {\n \"text\": \"Alice\"\n },\n \"output\": null,\n \"logs\": \"\",\n \"error\": null,\n \"status\": \"starting\",\n \"created_at\": \"2023-09-08T16:19:34.765994657Z\",\n \"urls\": {\n \"cancel\": \"https://api.replicate.com/v1/predictions/gm3qorzdhgbfurvjtvhg6dckhu/cancel\",\n \"get\": \"https://api.replicate.com/v1/predictions/gm3qorzdhgbfurvjtvhg6dckhu\"\n }\n}\n```\n\nAs models can take several seconds or more to run, the output will not be available immediately. To get the final result of the prediction you should either provide a `webhook` HTTPS URL for us to call when the results are ready, or poll the [get a prediction](#predictions.get) endpoint until it has finished.\n\nInput and output (including any files) will be automatically deleted after an hour, so you must save a copy of any files in the output if you'd like to continue using them.\n\nOutput files are served by `replicate.delivery` and its subdomains. If you use an allow list of external domains for your assets, add `replicate.delivery` and `*.replicate.delivery` to it.\n" - operationId: predictions.create - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/version_prediction_request' - responses: - '200': - description: Success - '/predictions/{prediction_id}': - get: - summary: Get a prediction - description: "Get the current state of a prediction.\n\nExample cURL request:\n\n```console\ncurl -s \\\n -H \"Authorization: Bearer \" \\\n https://api.replicate.com/v1/predictions/gm3qorzdhgbfurvjtvhg6dckhu\n```\n\nThe response will be the prediction object:\n\n```json\n{\n \"id\": \"gm3qorzdhgbfurvjtvhg6dckhu\",\n \"model\": \"replicate/hello-world\",\n \"version\": \"5c7d5dc6dd8bf75c1acaa8565735e7986bc5b66206b55cca93cb72c9bf15ccaa\",\n \"input\": {\n \"text\": \"Alice\"\n },\n \"logs\": \"\",\n \"output\": \"hello Alice\",\n \"error\": null,\n \"status\": \"succeeded\",\n \"created_at\": \"2023-09-08T16:19:34.765994Z\",\n \"data_removed\": false,\n \"started_at\": \"2023-09-08T16:19:34.779176Z\",\n \"completed_at\": \"2023-09-08T16:19:34.791859Z\",\n \"metrics\": {\n \"predict_time\": 0.012683\n },\n \"urls\": {\n \"cancel\": \"https://api.replicate.com/v1/predictions/gm3qorzdhgbfurvjtvhg6dckhu/cancel\",\n \"get\": \"https://api.replicate.com/v1/predictions/gm3qorzdhgbfurvjtvhg6dckhu\"\n }\n}\n```\n\n`status` will be one of:\n\n- `starting`: the prediction is starting up. If this status lasts longer than a few seconds, then it's typically because a new worker is being started to run the prediction.\n- `processing`: the `predict()` method of the model is currently running.\n- `succeeded`: the prediction completed successfully.\n- `failed`: the prediction encountered an error during processing.\n- `canceled`: the prediction was canceled by its creator.\n\nIn the case of success, `output` will be an object containing the output of the model. Any files will be represented as HTTPS URLs. You'll need to pass the `Authorization` header to request them.\n\nIn the case of failure, `error` will contain the error encountered during the prediction.\n\nTerminated predictions (with a status of `succeeded`, `failed`, or `canceled`) will include a `metrics` object with a `predict_time` property showing the amount of CPU or GPU time, in seconds, that the prediction used while running. It won't include time waiting for the prediction to start.\n\nAll input parameters, output values, and logs are automatically removed after an hour, by default, for predictions created through the API.\n\nYou must save a copy of any data or files in the output if you'd like to continue using them. The `output` key will still be present, but it's value will be `null` after the output has been removed.\n\nOutput files are served by `replicate.delivery` and its subdomains. If you use an allow list of external domains for your assets, add `replicate.delivery` and `*.replicate.delivery` to it.\n" - operationId: predictions.get - parameters: - - name: prediction_id - in: path - description: "The ID of the prediction to get.\n" - required: true - schema: - type: string - responses: - '200': - description: Successful - content: - application/json: - schema: - $ref: '#/components/schemas/prediction_response' - '/predictions/{prediction_id}/cancel': - post: - summary: Cancel a prediction - operationId: predictions.cancel - parameters: - - name: prediction_id - in: path - description: "The ID of the prediction to cancel.\n" - required: true - schema: - type: string - responses: - '200': - description: Success - /trainings: - get: - summary: List trainings - description: "Get a paginated list of trainings that you've created. This will include trainings created from the API and the website. It will return 100 records per page.\n\nExample cURL request:\n\n```console\ncurl -s \\\n -H \"Authorization: Bearer \" \\\n https://api.replicate.com/v1/trainings\n```\n\nThe response will be a paginated JSON array of training objects, sorted with the most recent training first:\n\n```json\n{\n \"next\": null,\n \"previous\": null,\n \"results\": [\n {\n \"completed_at\": \"2023-09-08T16:41:19.826523Z\",\n \"created_at\": \"2023-09-08T16:32:57.018467Z\",\n \"error\": null,\n \"id\": \"zz4ibbonubfz7carwiefibzgga\",\n \"input\": {\n \"input_images\": \"https://example.com/my-input-images.zip\"\n },\n \"metrics\": {\n \"predict_time\": 502.713876\n },\n \"output\": {\n \"version\": \"...\",\n \"weights\": \"...\"\n },\n \"started_at\": \"2023-09-08T16:32:57.112647Z\",\n \"source\": \"api\",\n \"status\": \"succeeded\",\n \"urls\": {\n \"get\": \"https://api.replicate.com/v1/trainings/zz4ibbonubfz7carwiefibzgga\",\n \"cancel\": \"https://api.replicate.com/v1/trainings/zz4ibbonubfz7carwiefibzgga/cancel\"\n },\n \"model\": \"stability-ai/sdxl\",\n \"version\": \"da77bc59ee60423279fd632efb4795ab731d9e3ca9705ef3341091fb989b7eaf\",\n }\n ]\n}\n```\n\n`id` will be the unique ID of the training.\n\n`source` will indicate how the training was created. Possible values are `web` or `api`.\n\n`status` will be the status of the training. Refer to [get a single training](#trainings.get) for possible values.\n\n`urls` will be a convenience object that can be used to construct new API requests for the given training.\n\n`version` will be the unique ID of model version used to create the training.\n" - operationId: trainings.list - responses: - '200': - description: Success - '/trainings/{training_id}': - get: - summary: Get a training - description: "Get the current state of a training.\n\nExample cURL request:\n\n```console\ncurl -s \\\n -H \"Authorization: Bearer \" \\\n https://api.replicate.com/v1/trainings/zz4ibbonubfz7carwiefibzgga\n```\n\nThe response will be the training object:\n\n```json\n{\n \"completed_at\": \"2023-09-08T16:41:19.826523Z\",\n \"created_at\": \"2023-09-08T16:32:57.018467Z\",\n \"error\": null,\n \"id\": \"zz4ibbonubfz7carwiefibzgga\",\n \"input\": {\n \"input_images\": \"https://example.com/my-input-images.zip\"\n },\n \"logs\": \"...\",\n \"metrics\": {\n \"predict_time\": 502.713876\n },\n \"output\": {\n \"version\": \"...\",\n \"weights\": \"...\"\n },\n \"started_at\": \"2023-09-08T16:32:57.112647Z\",\n \"status\": \"succeeded\",\n \"urls\": {\n \"get\": \"https://api.replicate.com/v1/trainings/zz4ibbonubfz7carwiefibzgga\",\n \"cancel\": \"https://api.replicate.com/v1/trainings/zz4ibbonubfz7carwiefibzgga/cancel\"\n },\n \"model\": \"stability-ai/sdxl\",\n \"version\": \"da77bc59ee60423279fd632efb4795ab731d9e3ca9705ef3341091fb989b7eaf\",\n}\n```\n\n`status` will be one of:\n\n- `starting`: the training is starting up. If this status lasts longer than a few seconds, then it's typically because a new worker is being started to run the training.\n- `processing`: the `train()` method of the model is currently running.\n- `succeeded`: the training completed successfully.\n- `failed`: the training encountered an error during processing.\n- `canceled`: the training was canceled by its creator.\n\nIn the case of success, `output` will be an object containing the output of the model. Any files will be represented as HTTPS URLs. You'll need to pass the `Authorization` header to request them.\n\nIn the case of failure, `error` will contain the error encountered during the training.\n\nTerminated trainings (with a status of `succeeded`, `failed`, or `canceled`) will include a `metrics` object with a `predict_time` property showing the amount of CPU or GPU time, in seconds, that the training used while running. It won't include time waiting for the training to start.\n" - operationId: trainings.get - parameters: - - name: training_id - in: path - description: "The ID of the training to get.\n" - required: true - schema: - type: string - responses: - '200': - description: Success - '/trainings/{training_id}/cancel': - post: - summary: Cancel a training - operationId: trainings.cancel - parameters: - - name: training_id - in: path - description: "The ID of the training you want to cancel.\n" - required: true - schema: - type: string - responses: - '200': - description: Success - /webhooks/default/secret: - get: - summary: Get the signing secret for the default webhook - description: "Get the signing secret for the default webhook endpoint. This is used to verify that webhook requests are coming from Replicate.\n\nExample cURL request:\n\n```console\ncurl -s \\\n -H \"Authorization: Bearer \" \\\n https://api.replicate.com/v1/webhooks/default/secret\n```\n\nThe response will be a JSON object with a `key` property:\n\n```json\n{\n \"key\": \"...\"\n}\n```\n" - operationId: webhooks.default.secret.get - responses: - '200': - description: Success - content: - application/json: - schema: - type: object - properties: - key: - type: string - description: The signing secret. -components: - schemas: - prediction_request: - required: - - input - type: object - properties: - input: - type: object - description: "The model's input as a JSON object. The input schema depends on what model you are running. To see the available inputs, click the \"API\" tab on the model you are running or [get the model version](#models.versions.get) and look at its `openapi_schema` property. For example, [stability-ai/sdxl](https://replicate.com/stability-ai/sdxl) takes `prompt` as an input.\n\nFiles should be passed as HTTP URLs or data URLs.\n\nUse an HTTP URL when:\n\n- you have a large file > 256kb\n- you want to be able to use the file multiple times\n- you want your prediction metadata to be associable with your input files\n\nUse a data URL when:\n\n- you have a small file <= 256kb\n- you don't want to upload and host the file somewhere\n- you don't need to use the file again (Replicate will not store it)\n" - stream: - type: boolean - description: "**This field is deprecated.**\n\nRequest a URL to receive streaming output using [server-sent events (SSE)](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events).\n\nThis field is no longer needed as the returned prediction will always have a `stream` entry in its `url` property if the model supports streaming.\n" - webhook: - type: string - description: "An HTTPS URL for receiving a webhook when the prediction has new output. The webhook will be a POST request where the request body is the same as the response body of the [get prediction](#predictions.get) operation. If there are network problems, we will retry the webhook a few times, so make sure it can be safely called more than once. Replicate will not follow redirects when sending webhook requests to your service, so be sure to specify a URL that will resolve without redirecting.\n" - webhook_events_filter: - type: array - items: - enum: - - start - - output - - logs - - completed - type: string - description: "By default, we will send requests to your webhook URL whenever there are new outputs or the prediction has finished. You can change which events trigger webhook requests by specifying `webhook_events_filter` in the prediction request:\n\n- `start`: immediately on prediction start\n- `output`: each time a prediction generates an output (note that predictions can generate multiple outputs)\n- `logs`: each time log output is generated by a prediction\n- `completed`: when the prediction reaches a terminal state (succeeded/canceled/failed)\n\nFor example, if you only wanted requests to be sent at the start and end of the prediction, you would provide:\n\n```json\n{\n \"input\": {\n \"text\": \"Alice\"\n },\n \"webhook\": \"https://example.com/my-webhook\",\n \"webhook_events_filter\": [\"start\", \"completed\"]\n}\n```\n\nRequests for event types `output` and `logs` will be sent at most once every 500ms. If you request `start` and `completed` webhooks, then they'll always be sent regardless of throttling.\n" - additionalProperties: false - training_request: - required: - - destination - - input - type: object - properties: - destination: - type: string - description: "A string representing the desired model to push to in the format `{destination_model_owner}/{destination_model_name}`. This should be an existing model owned by the user or organization making the API request. If the destination is invalid, the server will return an appropriate 4XX response.\n" - input: - type: object - description: "An object containing inputs to the Cog model's `train()` function.\n" - webhook: - type: string - description: 'An HTTPS URL for receiving a webhook when the training completes. The webhook will be a POST request where the request body is the same as the response body of the [get training](#trainings.get) operation. If there are network problems, we will retry the webhook a few times, so make sure it can be safely called more than once. Replicate will not follow redirects when sending webhook requests to your service, so be sure to specify a URL that will resolve without redirecting.' - webhook_events_filter: - type: array - items: - enum: - - start - - output - - logs - - completed - type: string - description: "By default, we will send requests to your webhook URL whenever there are new outputs or the training has finished. You can change which events trigger webhook requests by specifying `webhook_events_filter` in the training request:\n\n- `start`: immediately on training start\n- `output`: each time a training generates an output (note that trainings can generate multiple outputs)\n- `logs`: each time log output is generated by a training\n- `completed`: when the training reaches a terminal state (succeeded/canceled/failed)\n\nFor example, if you only wanted requests to be sent at the start and end of the training, you would provide:\n\n```json\n{\n \"destination\": \"my-organization/my-model\",\n \"input\": {\n \"text\": \"Alice\"\n },\n \"webhook\": \"https://example.com/my-webhook\",\n \"webhook_events_filter\": [\"start\", \"completed\"]\n}\n```\n\nRequests for event types `output` and `logs` will be sent at most once every 500ms. If you request `start` and `completed` webhooks, then they'll always be sent regardless of throttling.\n" - version_prediction_request: - required: - - version - - input - type: object - properties: - input: - type: object - description: "The model's input as a JSON object. The input schema depends on what model you are running. To see the available inputs, click the \"API\" tab on the model you are running or [get the model version](#models.versions.get) and look at its `openapi_schema` property. For example, [stability-ai/sdxl](https://replicate.com/stability-ai/sdxl) takes `prompt` as an input.\n\nFiles should be passed as HTTP URLs or data URLs.\n\nUse an HTTP URL when:\n\n- you have a large file > 256kb\n- you want to be able to use the file multiple times\n- you want your prediction metadata to be associable with your input files\n\nUse a data URL when:\n\n- you have a small file <= 256kb\n- you don't want to upload and host the file somewhere\n- you don't need to use the file again (Replicate will not store it)\n" - stream: - type: boolean - description: "**This field is deprecated.**\n\nRequest a URL to receive streaming output using [server-sent events (SSE)](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events).\n\nThis field is no longer needed as the returned prediction will always have a `stream` entry in its `url` property if the model supports streaming.\n" - version: - type: string - description: The ID of the model version that you want to run. - webhook: - type: string - description: "An HTTPS URL for receiving a webhook when the prediction has new output. The webhook will be a POST request where the request body is the same as the response body of the [get prediction](#predictions.get) operation. If there are network problems, we will retry the webhook a few times, so make sure it can be safely called more than once. Replicate will not follow redirects when sending webhook requests to your service, so be sure to specify a URL that will resolve without redirecting.\n" - webhook_events_filter: - type: array - items: - enum: - - start - - output - - logs - - completed - type: string - description: "By default, we will send requests to your webhook URL whenever there are new outputs or the prediction has finished. You can change which events trigger webhook requests by specifying `webhook_events_filter` in the prediction request:\n\n- `start`: immediately on prediction start\n- `output`: each time a prediction generates an output (note that predictions can generate multiple outputs)\n- `logs`: each time log output is generated by a prediction\n- `completed`: when the prediction reaches a terminal state (succeeded/canceled/failed)\n\nFor example, if you only wanted requests to be sent at the start and end of the prediction, you would provide:\n\n```json\n{\n \"version\": \"5c7d5dc6dd8bf75c1acaa8565735e7986bc5b66206b55cca93cb72c9bf15ccaa\",\n \"input\": {\n \"text\": \"Alice\"\n },\n \"webhook\": \"https://example.com/my-webhook\",\n \"webhook_events_filter\": [\"start\", \"completed\"]\n}\n```\n\nRequests for event types `output` and `logs` will be sent at most once every 500ms. If you request `start` and `completed` webhooks, then they'll always be sent regardless of throttling.\n" - additionalProperties: false - prediction_response: - type: object - properties: - completed_at: - type: string - format: string - created_at: - type: string - format: string - data_removed: - type: boolean - error: - type: 'null' - id: - type: string - format: string - input: - type: object - properties: - seed: - type: number - format: int64 - steps: - type: number - format: int64 - prompt: - type: string - format: string - guidance: - type: number - format: number - interval: - type: number - format: int64 - aspect_ratio: - type: string - format: string - safety_tolerance: - type: number - format: int64 - logs: - type: string - format: string - metrics: - type: object - properties: - image_count: - type: number - format: int64 - predict_time: - type: number - format: number - total_time: - type: number - format: number - output: - type: string - format: string - started_at: - type: string - format: string - status: - type: string - format: string - urls: - type: object - properties: - get: - type: string - format: string - cancel: - type: string - format: string - version: - type: string - format: string - securitySchemes: - bearerAuth: - type: http - scheme: bearer - bearerFormat: "All API requests must include a valid API token in the `Authorization` request header. The token must be prefixed by \"Bearer\", followed by a space and the token value.\nExample: `Authorization: Bearer r8_Hw***********************************`\nFind your tokens at https://replicate.com/account/api-tokens\n" -security: - - bearerAuth: [ ] -externalDocs: - description: Replicate HTTP API - url: https://replicate.com/docs/reference/http \ No newline at end of file diff --git a/src/tests/AutoSDK.IntegrationTests.Cli/CliTests.cs b/src/tests/AutoSDK.IntegrationTests.Cli/CliTests.cs index e80434d452..3b2849bf9b 100644 --- a/src/tests/AutoSDK.IntegrationTests.Cli/CliTests.cs +++ b/src/tests/AutoSDK.IntegrationTests.Cli/CliTests.cs @@ -12,7 +12,7 @@ public class CliTests [DataRow("ollama.yaml")] [DataRow("openai.yaml")] [DataRow("petstore.yaml")] - [DataRow("replicate.yaml")] + [DataRow("replicate.json")] [DataRow("huggingface.yaml")] [DataRow("ai21.json")] [DataRow("cohere.yaml")] diff --git a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.Api.CreateDeployments.g.verified.cs b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.Api.CreateDeployments.g.verified.cs index cc5e4f3c38..9e0a1cb205 100644 --- a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.Api.CreateDeployments.g.verified.cs +++ b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.Api.CreateDeployments.g.verified.cs @@ -29,7 +29,7 @@ partial void ProcessCreateDeploymentsResponseContent( /// ```console
/// curl -s \
/// -X POST \
- /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
/// -H "Content-Type: application/json" \
/// -d '{
/// "name": "my-app-image-generator",
@@ -204,7 +204,7 @@ partial void ProcessCreateDeploymentsResponseContent( /// ```console
/// curl -s \
/// -X POST \
- /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
/// -H "Content-Type: application/json" \
/// -d '{
/// "name": "my-app-image-generator",
diff --git a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.Api.CreateModels.g.verified.cs b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.Api.CreateModels.g.verified.cs index eab866cb7f..c7f5243642 100644 --- a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.Api.CreateModels.g.verified.cs +++ b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.Api.CreateModels.g.verified.cs @@ -23,7 +23,7 @@ partial void ProcessCreateModelsResponse( /// Example cURL request:
/// ```console
/// curl -s -X POST \
- /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
/// -H 'Content-Type: application/json' \
/// -d '{"owner": "alice", "name": "my-model", "description": "An example model", "visibility": "public", "hardware": "cpu"}' \
/// https://api.replicate.com/v1/models
@@ -136,7 +136,7 @@ partial void ProcessCreateModelsResponse( /// Example cURL request:
/// ```console
/// curl -s -X POST \
- /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
/// -H 'Content-Type: application/json' \
/// -d '{"owner": "alice", "name": "my-model", "description": "An example model", "visibility": "public", "hardware": "cpu"}' \
/// https://api.replicate.com/v1/models
diff --git a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.Api.CreatePredictions.g.verified.cs b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.Api.CreatePredictions.g.verified.cs index eea0e59da6..68f62a9e2b 100644 --- a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.Api.CreatePredictions.g.verified.cs +++ b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.Api.CreatePredictions.g.verified.cs @@ -8,10 +8,12 @@ public partial class Api { partial void PrepareCreatePredictionsArguments( global::System.Net.Http.HttpClient httpClient, + ref string? prefer, global::G.VersionPredictionRequest request); partial void PrepareCreatePredictionsRequest( global::System.Net.Http.HttpClient httpClient, global::System.Net.Http.HttpRequestMessage httpRequestMessage, + string? prefer, global::G.VersionPredictionRequest request); partial void ProcessCreatePredictionsResponse( global::System.Net.Http.HttpClient httpClient, @@ -19,53 +21,27 @@ partial void ProcessCreatePredictionsResponse( /// /// Create a prediction
- /// Start a new prediction for the model version and inputs you provide.
- /// Example request body:
- /// ```json
- /// {
- /// "version": "5c7d5dc6dd8bf75c1acaa8565735e7986bc5b66206b55cca93cb72c9bf15ccaa",
- /// "input": {
- /// "text": "Alice"
- /// }
- /// }
- /// ```
+ /// Create a prediction for the model version and inputs you provide.
/// Example cURL request:
/// ```console
- /// curl -s -X POST \
+ /// curl -s -X POST -H 'Prefer: wait' \
/// -d '{"version": "5c7d5dc6dd8bf75c1acaa8565735e7986bc5b66206b55cca93cb72c9bf15ccaa", "input": {"text": "Alice"}}' \
- /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
/// -H 'Content-Type: application/json' \
/// https://api.replicate.com/v1/predictions
/// ```
- /// The response will be the prediction object:
- /// ```json
- /// {
- /// "id": "gm3qorzdhgbfurvjtvhg6dckhu",
- /// "model": "replicate/hello-world",
- /// "version": "5c7d5dc6dd8bf75c1acaa8565735e7986bc5b66206b55cca93cb72c9bf15ccaa",
- /// "input": {
- /// "text": "Alice"
- /// },
- /// "output": null,
- /// "logs": "",
- /// "error": null,
- /// "status": "starting",
- /// "created_at": "2023-09-08T16:19:34.765994657Z",
- /// "urls": {
- /// "cancel": "https://api.replicate.com/v1/predictions/gm3qorzdhgbfurvjtvhg6dckhu/cancel",
- /// "get": "https://api.replicate.com/v1/predictions/gm3qorzdhgbfurvjtvhg6dckhu"
- /// }
- /// }
- /// ```
- /// As models can take several seconds or more to run, the output will not be available immediately. To get the final result of the prediction you should either provide a `webhook` HTTPS URL for us to call when the results are ready, or poll the [get a prediction](#predictions.get) endpoint until it has finished.
- /// Input and output (including any files) will be automatically deleted after an hour, so you must save a copy of any files in the output if you'd like to continue using them.
- /// Output files are served by `replicate.delivery` and its subdomains. If you use an allow list of external domains for your assets, add `replicate.delivery` and `*.replicate.delivery` to it. + /// The request will wait up to 60 seconds for the model to run. If this time is exceeded the prediction will be returned in a `"starting"` state and need to be retrieved using the `predictions.get` endpiont.
+ /// For a complete overview of the `predictions.create` API check out our documentation on [creating a prediction](https://replicate.com/docs/topics/predictions/create-a-prediction) which covers a variety of use cases. ///
+ /// + /// Example: wait=5 + /// /// /// The token to cancel the operation with /// public async global::System.Threading.Tasks.Task CreatePredictionsAsync( global::G.VersionPredictionRequest request, + string? prefer = default, global::System.Threading.CancellationToken cancellationToken = default) { request = request ?? throw new global::System.ArgumentNullException(nameof(request)); @@ -74,6 +50,7 @@ partial void ProcessCreatePredictionsResponse( client: HttpClient); PrepareCreatePredictionsArguments( httpClient: HttpClient, + prefer: ref prefer, request: request); var __pathBuilder = new PathBuilder( @@ -99,6 +76,12 @@ partial void ProcessCreatePredictionsResponse( __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); } } + + if (prefer != default) + { + __httpRequest.Headers.TryAddWithoutValidation("Prefer", prefer.ToString()); + } + var __httpRequestContentBody = request.ToJson(JsonSerializerOptions); var __httpRequestContent = new global::System.Net.Http.StringContent( content: __httpRequestContentBody, @@ -112,6 +95,7 @@ partial void ProcessCreatePredictionsResponse( PrepareCreatePredictionsRequest( httpClient: HttpClient, httpRequestMessage: __httpRequest, + prefer: prefer, request: request); using var __response = await HttpClient.SendAsync( @@ -146,48 +130,21 @@ partial void ProcessCreatePredictionsResponse( /// /// Create a prediction
- /// Start a new prediction for the model version and inputs you provide.
- /// Example request body:
- /// ```json
- /// {
- /// "version": "5c7d5dc6dd8bf75c1acaa8565735e7986bc5b66206b55cca93cb72c9bf15ccaa",
- /// "input": {
- /// "text": "Alice"
- /// }
- /// }
- /// ```
+ /// Create a prediction for the model version and inputs you provide.
/// Example cURL request:
/// ```console
- /// curl -s -X POST \
+ /// curl -s -X POST -H 'Prefer: wait' \
/// -d '{"version": "5c7d5dc6dd8bf75c1acaa8565735e7986bc5b66206b55cca93cb72c9bf15ccaa", "input": {"text": "Alice"}}' \
- /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
/// -H 'Content-Type: application/json' \
/// https://api.replicate.com/v1/predictions
/// ```
- /// The response will be the prediction object:
- /// ```json
- /// {
- /// "id": "gm3qorzdhgbfurvjtvhg6dckhu",
- /// "model": "replicate/hello-world",
- /// "version": "5c7d5dc6dd8bf75c1acaa8565735e7986bc5b66206b55cca93cb72c9bf15ccaa",
- /// "input": {
- /// "text": "Alice"
- /// },
- /// "output": null,
- /// "logs": "",
- /// "error": null,
- /// "status": "starting",
- /// "created_at": "2023-09-08T16:19:34.765994657Z",
- /// "urls": {
- /// "cancel": "https://api.replicate.com/v1/predictions/gm3qorzdhgbfurvjtvhg6dckhu/cancel",
- /// "get": "https://api.replicate.com/v1/predictions/gm3qorzdhgbfurvjtvhg6dckhu"
- /// }
- /// }
- /// ```
- /// As models can take several seconds or more to run, the output will not be available immediately. To get the final result of the prediction you should either provide a `webhook` HTTPS URL for us to call when the results are ready, or poll the [get a prediction](#predictions.get) endpoint until it has finished.
- /// Input and output (including any files) will be automatically deleted after an hour, so you must save a copy of any files in the output if you'd like to continue using them.
- /// Output files are served by `replicate.delivery` and its subdomains. If you use an allow list of external domains for your assets, add `replicate.delivery` and `*.replicate.delivery` to it. + /// The request will wait up to 60 seconds for the model to run. If this time is exceeded the prediction will be returned in a `"starting"` state and need to be retrieved using the `predictions.get` endpiont.
+ /// For a complete overview of the `predictions.create` API check out our documentation on [creating a prediction](https://replicate.com/docs/topics/predictions/create-a-prediction) which covers a variety of use cases. ///
+ /// + /// Example: wait=5 + /// /// /// The model's input as a JSON object. The input schema depends on what model you are running. To see the available inputs, click the "API" tab on the model you are running or [get the model version](#models.versions.get) and look at its `openapi_schema` property. For example, [stability-ai/sdxl](https://replicate.com/stability-ai/sdxl) takes `prompt` as an input.
/// Files should be passed as HTTP URLs or data URLs.
@@ -235,6 +192,7 @@ partial void ProcessCreatePredictionsResponse( public async global::System.Threading.Tasks.Task CreatePredictionsAsync( object input, string version, + string? prefer = default, bool? stream = default, string? webhook = default, global::System.Collections.Generic.IList? webhookEventsFilter = default, @@ -250,6 +208,7 @@ partial void ProcessCreatePredictionsResponse( }; await CreatePredictionsAsync( + prefer: prefer, request: __request, cancellationToken: cancellationToken).ConfigureAwait(false); } diff --git a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.Api.CreatePredictionsDeployments.g.verified.cs b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.Api.CreatePredictionsDeployments.g.verified.cs index 2ae913eee4..a0dac0cec0 100644 --- a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.Api.CreatePredictionsDeployments.g.verified.cs +++ b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.Api.CreatePredictionsDeployments.g.verified.cs @@ -10,12 +10,14 @@ partial void PrepareCreatePredictionsDeploymentsArguments( global::System.Net.Http.HttpClient httpClient, ref string deploymentOwner, ref string deploymentName, + ref string? prefer, global::G.PredictionRequest request); partial void PrepareCreatePredictionsDeploymentsRequest( global::System.Net.Http.HttpClient httpClient, global::System.Net.Http.HttpRequestMessage httpRequestMessage, string deploymentOwner, string deploymentName, + string? prefer, global::G.PredictionRequest request); partial void ProcessCreatePredictionsDeploymentsResponse( global::System.Net.Http.HttpClient httpClient, @@ -23,48 +25,23 @@ partial void ProcessCreatePredictionsDeploymentsResponse( /// /// Create a prediction using a deployment
- /// Start a new prediction for a deployment of a model using inputs you provide.
- /// Example request body:
- /// ```json
- /// {
- /// "input": {
- /// "text": "Alice"
- /// }
- /// }
- /// ```
+ /// Create a prediction for the deployment and inputs you provide.
/// Example cURL request:
/// ```console
- /// curl -s -X POST \
- /// -d '{"input": {"text": "Alice"}}' \
- /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// curl -s -X POST -H 'Prefer: wait' \
+ /// -d '{"input": {"prompt": "A photo of a bear riding a bicycle over the moon"}}' \
+ /// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
/// -H 'Content-Type: application/json' \
- /// "https://api.replicate.com/v1/deployments/replicate/hello-world/predictions"
- /// ```
- /// The response will be the prediction object:
- /// ```json
- /// {
- /// "id": "86b6trbv99rgp0cf1h886f69ew",
- /// "model": "replicate/hello-world",
- /// "version": "dp-8e43d61c333b5ddc7a921130bc3ab3ea",
- /// "input": {
- /// "text": "Alice"
- /// },
- /// "logs": "",
- /// "error": null,
- /// "status": "starting",
- /// "created_at": "2024-04-23T18:55:52.138Z",
- /// "urls": {
- /// "cancel": "https://api.replicate.com/v1/predictions/86b6trbv99rgp0cf1h886f69ew/cancel",
- /// "get": "https://api.replicate.com/v1/predictions/86b6trbv99rgp0cf1h886f69ew"
- /// }
- /// }
+ /// https://api.replicate.com/v1/deployments/acme/my-app-image-generator/predictions
/// ```
- /// As models can take several seconds or more to run, the output will not be available immediately. To get the final result of the prediction you should either provide a `webhook` HTTPS URL for us to call when the results are ready, or poll the [get a prediction](#predictions.get) endpoint until it has finished.
- /// Input and output (including any files) will be automatically deleted after an hour, so you must save a copy of any files in the output if you'd like to continue using them.
- /// Output files are served by `replicate.delivery` and its subdomains. If you use an allow list of external domains for your assets, add `replicate.delivery` and `*.replicate.delivery` to it. + /// The request will wait up to 60 seconds for the model to run. If this time is exceeded the prediction will be returned in a `"starting"` state and need to be retrieved using the `predictions.get` endpiont.
+ /// For a complete overview of the `deployments.predictions.create` API check out our documentation on [creating a prediction](https://replicate.com/docs/topics/predictions/create-a-prediction) which covers a variety of use cases. ///
/// /// + /// + /// Example: wait=5 + /// /// /// The token to cancel the operation with /// @@ -72,6 +49,7 @@ partial void ProcessCreatePredictionsDeploymentsResponse( string deploymentOwner, string deploymentName, global::G.PredictionRequest request, + string? prefer = default, global::System.Threading.CancellationToken cancellationToken = default) { request = request ?? throw new global::System.ArgumentNullException(nameof(request)); @@ -82,6 +60,7 @@ partial void ProcessCreatePredictionsDeploymentsResponse( httpClient: HttpClient, deploymentOwner: ref deploymentOwner, deploymentName: ref deploymentName, + prefer: ref prefer, request: request); var __pathBuilder = new PathBuilder( @@ -107,6 +86,12 @@ partial void ProcessCreatePredictionsDeploymentsResponse( __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); } } + + if (prefer != default) + { + __httpRequest.Headers.TryAddWithoutValidation("Prefer", prefer.ToString()); + } + var __httpRequestContentBody = request.ToJson(JsonSerializerOptions); var __httpRequestContent = new global::System.Net.Http.StringContent( content: __httpRequestContentBody, @@ -122,6 +107,7 @@ partial void ProcessCreatePredictionsDeploymentsResponse( httpRequestMessage: __httpRequest, deploymentOwner: deploymentOwner, deploymentName: deploymentName, + prefer: prefer, request: request); using var __response = await HttpClient.SendAsync( @@ -156,48 +142,23 @@ partial void ProcessCreatePredictionsDeploymentsResponse( /// /// Create a prediction using a deployment
- /// Start a new prediction for a deployment of a model using inputs you provide.
- /// Example request body:
- /// ```json
- /// {
- /// "input": {
- /// "text": "Alice"
- /// }
- /// }
- /// ```
+ /// Create a prediction for the deployment and inputs you provide.
/// Example cURL request:
/// ```console
- /// curl -s -X POST \
- /// -d '{"input": {"text": "Alice"}}' \
- /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// curl -s -X POST -H 'Prefer: wait' \
+ /// -d '{"input": {"prompt": "A photo of a bear riding a bicycle over the moon"}}' \
+ /// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
/// -H 'Content-Type: application/json' \
- /// "https://api.replicate.com/v1/deployments/replicate/hello-world/predictions"
+ /// https://api.replicate.com/v1/deployments/acme/my-app-image-generator/predictions
/// ```
- /// The response will be the prediction object:
- /// ```json
- /// {
- /// "id": "86b6trbv99rgp0cf1h886f69ew",
- /// "model": "replicate/hello-world",
- /// "version": "dp-8e43d61c333b5ddc7a921130bc3ab3ea",
- /// "input": {
- /// "text": "Alice"
- /// },
- /// "logs": "",
- /// "error": null,
- /// "status": "starting",
- /// "created_at": "2024-04-23T18:55:52.138Z",
- /// "urls": {
- /// "cancel": "https://api.replicate.com/v1/predictions/86b6trbv99rgp0cf1h886f69ew/cancel",
- /// "get": "https://api.replicate.com/v1/predictions/86b6trbv99rgp0cf1h886f69ew"
- /// }
- /// }
- /// ```
- /// As models can take several seconds or more to run, the output will not be available immediately. To get the final result of the prediction you should either provide a `webhook` HTTPS URL for us to call when the results are ready, or poll the [get a prediction](#predictions.get) endpoint until it has finished.
- /// Input and output (including any files) will be automatically deleted after an hour, so you must save a copy of any files in the output if you'd like to continue using them.
- /// Output files are served by `replicate.delivery` and its subdomains. If you use an allow list of external domains for your assets, add `replicate.delivery` and `*.replicate.delivery` to it. + /// The request will wait up to 60 seconds for the model to run. If this time is exceeded the prediction will be returned in a `"starting"` state and need to be retrieved using the `predictions.get` endpiont.
+ /// For a complete overview of the `deployments.predictions.create` API check out our documentation on [creating a prediction](https://replicate.com/docs/topics/predictions/create-a-prediction) which covers a variety of use cases. ///
/// /// + /// + /// Example: wait=5 + /// /// /// The model's input as a JSON object. The input schema depends on what model you are running. To see the available inputs, click the "API" tab on the model you are running or [get the model version](#models.versions.get) and look at its `openapi_schema` property. For example, [stability-ai/sdxl](https://replicate.com/stability-ai/sdxl) takes `prompt` as an input.
/// Files should be passed as HTTP URLs or data URLs.
@@ -242,6 +203,7 @@ partial void ProcessCreatePredictionsDeploymentsResponse( string deploymentOwner, string deploymentName, object input, + string? prefer = default, bool? stream = default, string? webhook = default, global::System.Collections.Generic.IList? webhookEventsFilter = default, @@ -258,6 +220,7 @@ partial void ProcessCreatePredictionsDeploymentsResponse( await CreatePredictionsDeploymentsAsync( deploymentOwner: deploymentOwner, deploymentName: deploymentName, + prefer: prefer, request: __request, cancellationToken: cancellationToken).ConfigureAwait(false); } diff --git a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.Api.CreatePredictionsModels.g.verified.cs b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.Api.CreatePredictionsModels.g.verified.cs index 34ea976855..94ddf78e95 100644 --- a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.Api.CreatePredictionsModels.g.verified.cs +++ b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.Api.CreatePredictionsModels.g.verified.cs @@ -10,73 +10,46 @@ partial void PrepareCreatePredictionsModelsArguments( global::System.Net.Http.HttpClient httpClient, ref string modelOwner, ref string modelName, + ref string? prefer, global::G.PredictionRequest request); partial void PrepareCreatePredictionsModelsRequest( global::System.Net.Http.HttpClient httpClient, global::System.Net.Http.HttpRequestMessage httpRequestMessage, string modelOwner, string modelName, + string? prefer, global::G.PredictionRequest request); partial void ProcessCreatePredictionsModelsResponse( global::System.Net.Http.HttpClient httpClient, global::System.Net.Http.HttpResponseMessage httpResponseMessage); - partial void ProcessCreatePredictionsModelsResponseContent( - global::System.Net.Http.HttpClient httpClient, - global::System.Net.Http.HttpResponseMessage httpResponseMessage, - ref string content); - /// /// Create a prediction using an official model
- /// Start a new prediction for an official model using the inputs you provide.
- /// Example request body:
- /// ```json
- /// {
- /// "input": {
- /// "prompt": "Write a short poem about the weather."
- /// }
- /// }
- /// ```
+ /// Create a prediction for the deployment and inputs you provide.
/// Example cURL request:
/// ```console
- /// curl -s -X POST \
+ /// curl -s -X POST -H 'Prefer: wait' \
/// -d '{"input": {"prompt": "Write a short poem about the weather."}}' \
- /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
/// -H 'Content-Type: application/json' \
/// https://api.replicate.com/v1/models/meta/meta-llama-3-70b-instruct/predictions
/// ```
- /// The response will be the prediction object:
- /// ```json
- /// {
- /// "id": "25s2s4n7rdrgg0cf1httb3myk0",
- /// "model": "replicate-internal/llama3-70b-chat-vllm-unquantized",
- /// "version": "dp-cf04fe09351e25db628e8b6181276547",
- /// "input": {
- /// "prompt": "Write a short poem about the weather."
- /// },
- /// "logs": "",
- /// "error": null,
- /// "status": "starting",
- /// "created_at": "2024-04-23T19:36:28.355Z",
- /// "urls": {
- /// "cancel": "https://api.replicate.com/v1/predictions/25s2s4n7rdrgg0cf1httb3myk0/cancel",
- /// "get": "https://api.replicate.com/v1/predictions/25s2s4n7rdrgg0cf1httb3myk0"
- /// }
- /// }
- /// ```
- /// As models can take several seconds or more to run, the output will not be available immediately. To get the final result of the prediction you should either provide a `webhook` HTTPS URL for us to call when the results are ready, or poll the [get a prediction](#predictions.get) endpoint until it has finished.
- /// All input parameters, output values, and logs are automatically removed after an hour, by default, for predictions created through the API.
- /// Output files are served by `replicate.delivery` and its subdomains. If you use an allow list of external domains for your assets, add `replicate.delivery` and `*.replicate.delivery` to it. + /// The request will wait up to 60 seconds for the model to run. If this time is exceeded the prediction will be returned in a `"starting"` state and need to be retrieved using the `predictions.get` endpiont.
+ /// For a complete overview of the `deployments.predictions.create` API check out our documentation on [creating a prediction](https://replicate.com/docs/topics/predictions/create-a-prediction) which covers a variety of use cases. ///
/// /// + /// + /// Example: wait=5 + /// /// /// The token to cancel the operation with /// - public async global::System.Threading.Tasks.Task CreatePredictionsModelsAsync( + public async global::System.Threading.Tasks.Task CreatePredictionsModelsAsync( string modelOwner, string modelName, global::G.PredictionRequest request, + string? prefer = default, global::System.Threading.CancellationToken cancellationToken = default) { request = request ?? throw new global::System.ArgumentNullException(nameof(request)); @@ -87,6 +60,7 @@ partial void ProcessCreatePredictionsModelsResponseContent( httpClient: HttpClient, modelOwner: ref modelOwner, modelName: ref modelName, + prefer: ref prefer, request: request); var __pathBuilder = new PathBuilder( @@ -112,6 +86,12 @@ partial void ProcessCreatePredictionsModelsResponseContent( __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); } } + + if (prefer != default) + { + __httpRequest.Headers.TryAddWithoutValidation("Prefer", prefer.ToString()); + } + var __httpRequestContentBody = request.ToJson(JsonSerializerOptions); var __httpRequestContent = new global::System.Net.Http.StringContent( content: __httpRequestContentBody, @@ -127,6 +107,7 @@ partial void ProcessCreatePredictionsModelsResponseContent( httpRequestMessage: __httpRequest, modelOwner: modelOwner, modelName: modelName, + prefer: prefer, request: request); using var __response = await HttpClient.SendAsync( @@ -140,117 +121,44 @@ partial void ProcessCreatePredictionsModelsResponseContent( ProcessCreatePredictionsModelsResponse( httpClient: HttpClient, httpResponseMessage: __response); - - if (ReadResponseAsString) + try { - var __content = await __response.Content.ReadAsStringAsync().ConfigureAwait(false); - - ProcessResponseContent( - client: HttpClient, - response: __response, - content: ref __content); - ProcessCreatePredictionsModelsResponseContent( - httpClient: HttpClient, - httpResponseMessage: __response, - content: ref __content); - - try - { - __response.EnsureSuccessStatusCode(); - } - catch (global::System.Net.Http.HttpRequestException __ex) - { - throw new global::G.ApiException( - message: __content ?? __response.ReasonPhrase ?? string.Empty, - innerException: __ex, - statusCode: __response.StatusCode) - { - ResponseBody = __content, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - - return - global::G.PredictionResponse.FromJson(__content, JsonSerializerOptions) ?? - throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + __response.EnsureSuccessStatusCode(); } - else + catch (global::System.Net.Http.HttpRequestException __ex) { - try - { - __response.EnsureSuccessStatusCode(); - } - catch (global::System.Net.Http.HttpRequestException __ex) + throw new global::G.ApiException( + message: __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + statusCode: __response.StatusCode) { - throw new global::G.ApiException( - message: __response.ReasonPhrase ?? string.Empty, - innerException: __ex, - statusCode: __response.StatusCode) - { - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - - using var __responseStream = await __response.Content.ReadAsStreamAsync().ConfigureAwait(false); - - var __responseValue = await global::G.PredictionResponse.FromJsonStreamAsync(__responseStream, JsonSerializerOptions).ConfigureAwait(false); - - return - __responseValue ?? - throw new global::System.InvalidOperationException("Response deserialization failed."); + ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value), + }; } } /// /// Create a prediction using an official model
- /// Start a new prediction for an official model using the inputs you provide.
- /// Example request body:
- /// ```json
- /// {
- /// "input": {
- /// "prompt": "Write a short poem about the weather."
- /// }
- /// }
- /// ```
+ /// Create a prediction for the deployment and inputs you provide.
/// Example cURL request:
/// ```console
- /// curl -s -X POST \
+ /// curl -s -X POST -H 'Prefer: wait' \
/// -d '{"input": {"prompt": "Write a short poem about the weather."}}' \
- /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
/// -H 'Content-Type: application/json' \
/// https://api.replicate.com/v1/models/meta/meta-llama-3-70b-instruct/predictions
/// ```
- /// The response will be the prediction object:
- /// ```json
- /// {
- /// "id": "25s2s4n7rdrgg0cf1httb3myk0",
- /// "model": "replicate-internal/llama3-70b-chat-vllm-unquantized",
- /// "version": "dp-cf04fe09351e25db628e8b6181276547",
- /// "input": {
- /// "prompt": "Write a short poem about the weather."
- /// },
- /// "logs": "",
- /// "error": null,
- /// "status": "starting",
- /// "created_at": "2024-04-23T19:36:28.355Z",
- /// "urls": {
- /// "cancel": "https://api.replicate.com/v1/predictions/25s2s4n7rdrgg0cf1httb3myk0/cancel",
- /// "get": "https://api.replicate.com/v1/predictions/25s2s4n7rdrgg0cf1httb3myk0"
- /// }
- /// }
- /// ```
- /// As models can take several seconds or more to run, the output will not be available immediately. To get the final result of the prediction you should either provide a `webhook` HTTPS URL for us to call when the results are ready, or poll the [get a prediction](#predictions.get) endpoint until it has finished.
- /// All input parameters, output values, and logs are automatically removed after an hour, by default, for predictions created through the API.
- /// Output files are served by `replicate.delivery` and its subdomains. If you use an allow list of external domains for your assets, add `replicate.delivery` and `*.replicate.delivery` to it. + /// The request will wait up to 60 seconds for the model to run. If this time is exceeded the prediction will be returned in a `"starting"` state and need to be retrieved using the `predictions.get` endpiont.
+ /// For a complete overview of the `deployments.predictions.create` API check out our documentation on [creating a prediction](https://replicate.com/docs/topics/predictions/create-a-prediction) which covers a variety of use cases. ///
/// /// + /// + /// Example: wait=5 + /// /// /// The model's input as a JSON object. The input schema depends on what model you are running. To see the available inputs, click the "API" tab on the model you are running or [get the model version](#models.versions.get) and look at its `openapi_schema` property. For example, [stability-ai/sdxl](https://replicate.com/stability-ai/sdxl) takes `prompt` as an input.
/// Files should be passed as HTTP URLs or data URLs.
@@ -291,10 +199,11 @@ partial void ProcessCreatePredictionsModelsResponseContent( /// /// The token to cancel the operation with /// - public async global::System.Threading.Tasks.Task CreatePredictionsModelsAsync( + public async global::System.Threading.Tasks.Task CreatePredictionsModelsAsync( string modelOwner, string modelName, object input, + string? prefer = default, bool? stream = default, string? webhook = default, global::System.Collections.Generic.IList? webhookEventsFilter = default, @@ -308,9 +217,10 @@ partial void ProcessCreatePredictionsModelsResponseContent( WebhookEventsFilter = webhookEventsFilter, }; - return await CreatePredictionsModelsAsync( + await CreatePredictionsModelsAsync( modelOwner: modelOwner, modelName: modelName, + prefer: prefer, request: __request, cancellationToken: cancellationToken).ConfigureAwait(false); } diff --git a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.Api.CreateTrainings.g.verified.cs b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.Api.CreateTrainings.g.verified.cs index bc49b37042..55faed1530 100644 --- a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.Api.CreateTrainings.g.verified.cs +++ b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.Api.CreateTrainings.g.verified.cs @@ -40,7 +40,7 @@ partial void ProcessCreateTrainingsResponse( /// ```console
/// curl -s -X POST \
/// -d '{"destination": "{new_owner}/{new_name}", "input": {"input_images": "https://example.com/my-input-images.zip"}}' \
- /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
/// -H 'Content-Type: application/json' \
/// https://api.replicate.com/v1/models/stability-ai/sdxl/versions/da77bc59ee60423279fd632efb4795ab731d9e3ca9705ef3341091fb989b7eaf/trainings
/// ```
@@ -179,7 +179,7 @@ partial void ProcessCreateTrainingsResponse( /// ```console
/// curl -s -X POST \
/// -d '{"destination": "{new_owner}/{new_name}", "input": {"input_images": "https://example.com/my-input-images.zip"}}' \
- /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
/// -H 'Content-Type: application/json' \
/// https://api.replicate.com/v1/models/stability-ai/sdxl/versions/da77bc59ee60423279fd632efb4795ab731d9e3ca9705ef3341091fb989b7eaf/trainings
/// ```
diff --git a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.Api.DeleteDeployments.g.verified.cs b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.Api.DeleteDeployments.g.verified.cs index ee6f5e4526..01db3c760a 100644 --- a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.Api.DeleteDeployments.g.verified.cs +++ b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.Api.DeleteDeployments.g.verified.cs @@ -27,7 +27,7 @@ partial void ProcessDeleteDeploymentsResponse( /// Example cURL request:
/// ```command
/// curl -s -X DELETE \
- /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
/// https://api.replicate.com/v1/deployments/acme/my-app-image-generator
/// ```
/// The response will be an empty 204, indicating the deployment has been deleted. diff --git a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.Api.DeleteModels.g.verified.cs b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.Api.DeleteModels.g.verified.cs index 098ae68aa1..fdfcc5a6ff 100644 --- a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.Api.DeleteModels.g.verified.cs +++ b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.Api.DeleteModels.g.verified.cs @@ -29,7 +29,7 @@ partial void ProcessDeleteModelsResponse( /// Example cURL request:
/// ```command
/// curl -s -X DELETE \
- /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
/// https://api.replicate.com/v1/models/replicate/hello-world
/// ```
/// The response will be an empty 204, indicating the model has been deleted. diff --git a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.Api.DeleteVersionsModels.g.verified.cs b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.Api.DeleteVersionsModels.g.verified.cs index 7c00782f58..7114eefc97 100644 --- a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.Api.DeleteVersionsModels.g.verified.cs +++ b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.Api.DeleteVersionsModels.g.verified.cs @@ -34,7 +34,7 @@ partial void ProcessDeleteVersionsModelsResponse( /// Example cURL request:
/// ```command
/// curl -s -X DELETE \
- /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
/// https://api.replicate.com/v1/models/replicate/hello-world/versions/5c7d5dc6dd8bf75c1acaa8565735e7986bc5b66206b55cca93cb72c9bf15ccaa
/// ```
/// The response will be an empty 202, indicating the deletion request has been accepted. It might take a few minutes to be processed. diff --git a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.Api.GetAccount.g.verified.cs b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.Api.GetAccount.g.verified.cs index 757aadecb5..488b07268f 100644 --- a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.Api.GetAccount.g.verified.cs +++ b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.Api.GetAccount.g.verified.cs @@ -26,7 +26,7 @@ partial void ProcessGetAccountResponseContent( /// Example cURL request:
/// ```console
/// curl -s \
- /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
/// https://api.replicate.com/v1/account
/// ```
/// The response will be a JSON object describing the account:
diff --git a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.Api.GetCollections.g.verified.cs b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.Api.GetCollections.g.verified.cs index a58811b50b..dab7f78ba7 100644 --- a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.Api.GetCollections.g.verified.cs +++ b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.Api.GetCollections.g.verified.cs @@ -22,7 +22,7 @@ partial void ProcessGetCollectionsResponse( /// Example cURL request:
/// ```console
/// curl -s \
- /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
/// https://api.replicate.com/v1/collections/super-resolution
/// ```
/// The response will be a collection object with a nested list of the models in that collection:
diff --git a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.Api.GetDeployments.g.verified.cs b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.Api.GetDeployments.g.verified.cs index 7735642cb9..ad9ed3fe1c 100644 --- a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.Api.GetDeployments.g.verified.cs +++ b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.Api.GetDeployments.g.verified.cs @@ -30,7 +30,7 @@ partial void ProcessGetDeploymentsResponseContent( /// Example cURL request:
/// ```console
/// curl -s \
- /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
/// https://api.replicate.com/v1/deployments/replicate/my-app-image-generator
/// ```
/// The response will be a JSON object describing the deployment:
diff --git a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.Api.GetModels.g.verified.cs b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.Api.GetModels.g.verified.cs index f75dc65d53..cc34525938 100644 --- a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.Api.GetModels.g.verified.cs +++ b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.Api.GetModels.g.verified.cs @@ -24,7 +24,7 @@ partial void ProcessGetModelsResponse( /// Example cURL request:
/// ```console
/// curl -s \
- /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
/// https://api.replicate.com/v1/models/replicate/hello-world
/// ```
/// The response will be a model object in the following format:
diff --git a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.Api.GetPredictions.g.verified.cs b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.Api.GetPredictions.g.verified.cs index be652c2fb1..53033e414d 100644 --- a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.Api.GetPredictions.g.verified.cs +++ b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.Api.GetPredictions.g.verified.cs @@ -17,18 +17,13 @@ partial void ProcessGetPredictionsResponse( global::System.Net.Http.HttpClient httpClient, global::System.Net.Http.HttpResponseMessage httpResponseMessage); - partial void ProcessGetPredictionsResponseContent( - global::System.Net.Http.HttpClient httpClient, - global::System.Net.Http.HttpResponseMessage httpResponseMessage, - ref string content); - /// /// Get a prediction
/// Get the current state of a prediction.
/// Example cURL request:
/// ```console
/// curl -s \
- /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
/// https://api.replicate.com/v1/predictions/gm3qorzdhgbfurvjtvhg6dckhu
/// ```
/// The response will be the prediction object:
@@ -73,7 +68,7 @@ partial void ProcessGetPredictionsResponseContent( /// /// The token to cancel the operation with /// - public async global::System.Threading.Tasks.Task GetPredictionsAsync( + public async global::System.Threading.Tasks.Task GetPredictionsAsync( string predictionId, global::System.Threading.CancellationToken cancellationToken = default) { @@ -126,70 +121,22 @@ partial void ProcessGetPredictionsResponseContent( ProcessGetPredictionsResponse( httpClient: HttpClient, httpResponseMessage: __response); - - if (ReadResponseAsString) + try { - var __content = await __response.Content.ReadAsStringAsync().ConfigureAwait(false); - - ProcessResponseContent( - client: HttpClient, - response: __response, - content: ref __content); - ProcessGetPredictionsResponseContent( - httpClient: HttpClient, - httpResponseMessage: __response, - content: ref __content); - - try - { - __response.EnsureSuccessStatusCode(); - } - catch (global::System.Net.Http.HttpRequestException __ex) - { - throw new global::G.ApiException( - message: __content ?? __response.ReasonPhrase ?? string.Empty, - innerException: __ex, - statusCode: __response.StatusCode) - { - ResponseBody = __content, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - - return - global::G.PredictionResponse.FromJson(__content, JsonSerializerOptions) ?? - throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + __response.EnsureSuccessStatusCode(); } - else + catch (global::System.Net.Http.HttpRequestException __ex) { - try - { - __response.EnsureSuccessStatusCode(); - } - catch (global::System.Net.Http.HttpRequestException __ex) + throw new global::G.ApiException( + message: __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + statusCode: __response.StatusCode) { - throw new global::G.ApiException( - message: __response.ReasonPhrase ?? string.Empty, - innerException: __ex, - statusCode: __response.StatusCode) - { - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - - using var __responseStream = await __response.Content.ReadAsStreamAsync().ConfigureAwait(false); - - var __responseValue = await global::G.PredictionResponse.FromJsonStreamAsync(__responseStream, JsonSerializerOptions).ConfigureAwait(false); - - return - __responseValue ?? - throw new global::System.InvalidOperationException("Response deserialization failed."); + ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value), + }; } } } diff --git a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.Api.GetSecretDefaultWebhooks.g.verified.cs b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.Api.GetSecretDefaultWebhooks.g.verified.cs index bc898df8b8..cecab11c9d 100644 --- a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.Api.GetSecretDefaultWebhooks.g.verified.cs +++ b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.Api.GetSecretDefaultWebhooks.g.verified.cs @@ -26,7 +26,7 @@ partial void ProcessGetSecretDefaultWebhooksResponseContent( /// Example cURL request:
/// ```console
/// curl -s \
- /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
/// https://api.replicate.com/v1/webhooks/default/secret
/// ```
/// The response will be a JSON object with a `key` property:
diff --git a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.Api.GetTrainings.g.verified.cs b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.Api.GetTrainings.g.verified.cs index 742366f625..4f9076d543 100644 --- a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.Api.GetTrainings.g.verified.cs +++ b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.Api.GetTrainings.g.verified.cs @@ -23,7 +23,7 @@ partial void ProcessGetTrainingsResponse( /// Example cURL request:
/// ```console
/// curl -s \
- /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
/// https://api.replicate.com/v1/trainings/zz4ibbonubfz7carwiefibzgga
/// ```
/// The response will be the training object:
diff --git a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.Api.GetVersionsModels.g.verified.cs b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.Api.GetVersionsModels.g.verified.cs index c3bd14938e..3278c2f990 100644 --- a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.Api.GetVersionsModels.g.verified.cs +++ b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.Api.GetVersionsModels.g.verified.cs @@ -26,7 +26,7 @@ partial void ProcessGetVersionsModelsResponse( /// Example cURL request:
/// ```console
/// curl -s \
- /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
/// https://api.replicate.com/v1/models/replicate/hello-world/versions/5c7d5dc6dd8bf75c1acaa8565735e7986bc5b66206b55cca93cb72c9bf15ccaa
/// ```
/// The response will be the version object:
diff --git a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.Api.ListCollections.g.verified.cs b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.Api.ListCollections.g.verified.cs index dddd5b6e50..7abd9d48a6 100644 --- a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.Api.ListCollections.g.verified.cs +++ b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.Api.ListCollections.g.verified.cs @@ -20,7 +20,7 @@ partial void ProcessListCollectionsResponse( /// Example cURL request:
/// ```console
/// curl -s \
- /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
/// https://api.replicate.com/v1/collections
/// ```
/// The response will be a paginated JSON list of collection objects:
diff --git a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.Api.ListDeployments.g.verified.cs b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.Api.ListDeployments.g.verified.cs index 3c9f9918c9..0ec49e4ad8 100644 --- a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.Api.ListDeployments.g.verified.cs +++ b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.Api.ListDeployments.g.verified.cs @@ -26,7 +26,7 @@ partial void ProcessListDeploymentsResponseContent( /// Example cURL request:
/// ```console
/// curl -s \
- /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
/// https://api.replicate.com/v1/deployments
/// ```
/// The response will be a paginated JSON array of deployment objects, sorted with the most recent deployment first:
diff --git a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.Api.ListHardware.g.verified.cs b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.Api.ListHardware.g.verified.cs index 2b1b041810..c4572564bb 100644 --- a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.Api.ListHardware.g.verified.cs +++ b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.Api.ListHardware.g.verified.cs @@ -25,7 +25,7 @@ partial void ProcessListHardwareResponseContent( /// Example cURL request:
/// ```console
/// curl -s \
- /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
/// https://api.replicate.com/v1/hardware
/// ```
/// The response will be a JSON array of hardware objects:
diff --git a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.Api.ListModels.g.verified.cs b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.Api.ListModels.g.verified.cs index f533bc1a14..683e036c97 100644 --- a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.Api.ListModels.g.verified.cs +++ b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.Api.ListModels.g.verified.cs @@ -21,7 +21,7 @@ partial void ProcessListModelsResponse( /// Example cURL request:
/// ```console
/// curl -s \
- /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
/// https://api.replicate.com/v1/models
/// ```
/// The response will be a paginated JSON array of model objects:
diff --git a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.Api.ListPredictions.g.verified.cs b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.Api.ListPredictions.g.verified.cs index 4f3af29812..6af6826314 100644 --- a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.Api.ListPredictions.g.verified.cs +++ b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.Api.ListPredictions.g.verified.cs @@ -21,7 +21,7 @@ partial void ProcessListPredictionsResponse( /// Example cURL request:
/// ```console
/// curl -s \
- /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
/// https://api.replicate.com/v1/predictions
/// ```
/// The response will be a paginated JSON array of prediction objects, sorted with the most recent prediction first:
diff --git a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.Api.ListTrainings.g.verified.cs b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.Api.ListTrainings.g.verified.cs index 1fd36db3ac..7152d7088b 100644 --- a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.Api.ListTrainings.g.verified.cs +++ b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.Api.ListTrainings.g.verified.cs @@ -21,7 +21,7 @@ partial void ProcessListTrainingsResponse( /// Example cURL request:
/// ```console
/// curl -s \
- /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
/// https://api.replicate.com/v1/trainings
/// ```
/// The response will be a paginated JSON array of training objects, sorted with the most recent training first:
diff --git a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.Api.ListVersionsModels.g.verified.cs b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.Api.ListVersionsModels.g.verified.cs index 950f64fd16..789d27045e 100644 --- a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.Api.ListVersionsModels.g.verified.cs +++ b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.Api.ListVersionsModels.g.verified.cs @@ -24,7 +24,7 @@ partial void ProcessListVersionsModelsResponse( /// Example cURL request:
/// ```console
/// curl -s \
- /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
/// https://api.replicate.com/v1/models/replicate/hello-world/versions
/// ```
/// The response will be a JSON array of model version objects, sorted with the most recent version first:
diff --git a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.Api.UpdateDeployments.g.verified.cs b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.Api.UpdateDeployments.g.verified.cs index b4246322c0..cd886a7b6a 100644 --- a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.Api.UpdateDeployments.g.verified.cs +++ b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.Api.UpdateDeployments.g.verified.cs @@ -33,7 +33,7 @@ partial void ProcessUpdateDeploymentsResponseContent( /// ```console
/// curl -s \
/// -X PATCH \
- /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
/// -H "Content-Type: application/json" \
/// -d '{"min_instances": 3, "max_instances": 10}' \
/// https://api.replicate.com/v1/deployments/acme/my-app-image-generator
@@ -210,7 +210,7 @@ partial void ProcessUpdateDeploymentsResponseContent( /// ```console
/// curl -s \
/// -X PATCH \
- /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
/// -H "Content-Type: application/json" \
/// -d '{"min_instances": 3, "max_instances": 10}' \
/// https://api.replicate.com/v1/deployments/acme/my-app-image-generator
diff --git a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.IApi.CreateDeployments.g.verified.cs b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.IApi.CreateDeployments.g.verified.cs index fdefcdf686..57275382b7 100644 --- a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.IApi.CreateDeployments.g.verified.cs +++ b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.IApi.CreateDeployments.g.verified.cs @@ -12,7 +12,7 @@ public partial interface IApi /// ```console
/// curl -s \
/// -X POST \
- /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
/// -H "Content-Type: application/json" \
/// -d '{
/// "name": "my-app-image-generator",
@@ -63,7 +63,7 @@ public partial interface IApi /// ```console
/// curl -s \
/// -X POST \
- /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
/// -H "Content-Type: application/json" \
/// -d '{
/// "name": "my-app-image-generator",
diff --git a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.IApi.CreateModels.g.verified.cs b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.IApi.CreateModels.g.verified.cs index 44d5ae4704..3b721c600d 100644 --- a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.IApi.CreateModels.g.verified.cs +++ b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.IApi.CreateModels.g.verified.cs @@ -11,7 +11,7 @@ public partial interface IApi /// Example cURL request:
/// ```console
/// curl -s -X POST \
- /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
/// -H 'Content-Type: application/json' \
/// -d '{"owner": "alice", "name": "my-model", "description": "An example model", "visibility": "public", "hardware": "cpu"}' \
/// https://api.replicate.com/v1/models
@@ -48,7 +48,7 @@ public partial interface IApi /// Example cURL request:
/// ```console
/// curl -s -X POST \
- /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
/// -H 'Content-Type: application/json' \
/// -d '{"owner": "alice", "name": "my-model", "description": "An example model", "visibility": "public", "hardware": "cpu"}' \
/// https://api.replicate.com/v1/models
diff --git a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.IApi.CreatePredictions.g.verified.cs b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.IApi.CreatePredictions.g.verified.cs index a0250facf3..15227106d7 100644 --- a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.IApi.CreatePredictions.g.verified.cs +++ b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.IApi.CreatePredictions.g.verified.cs @@ -7,99 +7,46 @@ public partial interface IApi { /// /// Create a prediction
- /// Start a new prediction for the model version and inputs you provide.
- /// Example request body:
- /// ```json
- /// {
- /// "version": "5c7d5dc6dd8bf75c1acaa8565735e7986bc5b66206b55cca93cb72c9bf15ccaa",
- /// "input": {
- /// "text": "Alice"
- /// }
- /// }
- /// ```
+ /// Create a prediction for the model version and inputs you provide.
/// Example cURL request:
/// ```console
- /// curl -s -X POST \
+ /// curl -s -X POST -H 'Prefer: wait' \
/// -d '{"version": "5c7d5dc6dd8bf75c1acaa8565735e7986bc5b66206b55cca93cb72c9bf15ccaa", "input": {"text": "Alice"}}' \
- /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
/// -H 'Content-Type: application/json' \
/// https://api.replicate.com/v1/predictions
/// ```
- /// The response will be the prediction object:
- /// ```json
- /// {
- /// "id": "gm3qorzdhgbfurvjtvhg6dckhu",
- /// "model": "replicate/hello-world",
- /// "version": "5c7d5dc6dd8bf75c1acaa8565735e7986bc5b66206b55cca93cb72c9bf15ccaa",
- /// "input": {
- /// "text": "Alice"
- /// },
- /// "output": null,
- /// "logs": "",
- /// "error": null,
- /// "status": "starting",
- /// "created_at": "2023-09-08T16:19:34.765994657Z",
- /// "urls": {
- /// "cancel": "https://api.replicate.com/v1/predictions/gm3qorzdhgbfurvjtvhg6dckhu/cancel",
- /// "get": "https://api.replicate.com/v1/predictions/gm3qorzdhgbfurvjtvhg6dckhu"
- /// }
- /// }
- /// ```
- /// As models can take several seconds or more to run, the output will not be available immediately. To get the final result of the prediction you should either provide a `webhook` HTTPS URL for us to call when the results are ready, or poll the [get a prediction](#predictions.get) endpoint until it has finished.
- /// Input and output (including any files) will be automatically deleted after an hour, so you must save a copy of any files in the output if you'd like to continue using them.
- /// Output files are served by `replicate.delivery` and its subdomains. If you use an allow list of external domains for your assets, add `replicate.delivery` and `*.replicate.delivery` to it. + /// The request will wait up to 60 seconds for the model to run. If this time is exceeded the prediction will be returned in a `"starting"` state and need to be retrieved using the `predictions.get` endpiont.
+ /// For a complete overview of the `predictions.create` API check out our documentation on [creating a prediction](https://replicate.com/docs/topics/predictions/create-a-prediction) which covers a variety of use cases. ///
+ /// + /// Example: wait=5 + /// /// /// The token to cancel the operation with /// global::System.Threading.Tasks.Task CreatePredictionsAsync( global::G.VersionPredictionRequest request, + string? prefer = default, global::System.Threading.CancellationToken cancellationToken = default); /// /// Create a prediction
- /// Start a new prediction for the model version and inputs you provide.
- /// Example request body:
- /// ```json
- /// {
- /// "version": "5c7d5dc6dd8bf75c1acaa8565735e7986bc5b66206b55cca93cb72c9bf15ccaa",
- /// "input": {
- /// "text": "Alice"
- /// }
- /// }
- /// ```
+ /// Create a prediction for the model version and inputs you provide.
/// Example cURL request:
/// ```console
- /// curl -s -X POST \
+ /// curl -s -X POST -H 'Prefer: wait' \
/// -d '{"version": "5c7d5dc6dd8bf75c1acaa8565735e7986bc5b66206b55cca93cb72c9bf15ccaa", "input": {"text": "Alice"}}' \
- /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
/// -H 'Content-Type: application/json' \
/// https://api.replicate.com/v1/predictions
/// ```
- /// The response will be the prediction object:
- /// ```json
- /// {
- /// "id": "gm3qorzdhgbfurvjtvhg6dckhu",
- /// "model": "replicate/hello-world",
- /// "version": "5c7d5dc6dd8bf75c1acaa8565735e7986bc5b66206b55cca93cb72c9bf15ccaa",
- /// "input": {
- /// "text": "Alice"
- /// },
- /// "output": null,
- /// "logs": "",
- /// "error": null,
- /// "status": "starting",
- /// "created_at": "2023-09-08T16:19:34.765994657Z",
- /// "urls": {
- /// "cancel": "https://api.replicate.com/v1/predictions/gm3qorzdhgbfurvjtvhg6dckhu/cancel",
- /// "get": "https://api.replicate.com/v1/predictions/gm3qorzdhgbfurvjtvhg6dckhu"
- /// }
- /// }
- /// ```
- /// As models can take several seconds or more to run, the output will not be available immediately. To get the final result of the prediction you should either provide a `webhook` HTTPS URL for us to call when the results are ready, or poll the [get a prediction](#predictions.get) endpoint until it has finished.
- /// Input and output (including any files) will be automatically deleted after an hour, so you must save a copy of any files in the output if you'd like to continue using them.
- /// Output files are served by `replicate.delivery` and its subdomains. If you use an allow list of external domains for your assets, add `replicate.delivery` and `*.replicate.delivery` to it. + /// The request will wait up to 60 seconds for the model to run. If this time is exceeded the prediction will be returned in a `"starting"` state and need to be retrieved using the `predictions.get` endpiont.
+ /// For a complete overview of the `predictions.create` API check out our documentation on [creating a prediction](https://replicate.com/docs/topics/predictions/create-a-prediction) which covers a variety of use cases. ///
+ /// + /// Example: wait=5 + /// /// /// The model's input as a JSON object. The input schema depends on what model you are running. To see the available inputs, click the "API" tab on the model you are running or [get the model version](#models.versions.get) and look at its `openapi_schema` property. For example, [stability-ai/sdxl](https://replicate.com/stability-ai/sdxl) takes `prompt` as an input.
/// Files should be passed as HTTP URLs or data URLs.
@@ -147,6 +94,7 @@ public partial interface IApi global::System.Threading.Tasks.Task CreatePredictionsAsync( object input, string version, + string? prefer = default, bool? stream = default, string? webhook = default, global::System.Collections.Generic.IList? webhookEventsFilter = default, diff --git a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.IApi.CreatePredictionsDeployments.g.verified.cs b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.IApi.CreatePredictionsDeployments.g.verified.cs index 75eb561b03..4c61f97df8 100644 --- a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.IApi.CreatePredictionsDeployments.g.verified.cs +++ b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.IApi.CreatePredictionsDeployments.g.verified.cs @@ -7,48 +7,23 @@ public partial interface IApi { /// /// Create a prediction using a deployment
- /// Start a new prediction for a deployment of a model using inputs you provide.
- /// Example request body:
- /// ```json
- /// {
- /// "input": {
- /// "text": "Alice"
- /// }
- /// }
- /// ```
+ /// Create a prediction for the deployment and inputs you provide.
/// Example cURL request:
/// ```console
- /// curl -s -X POST \
- /// -d '{"input": {"text": "Alice"}}' \
- /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// curl -s -X POST -H 'Prefer: wait' \
+ /// -d '{"input": {"prompt": "A photo of a bear riding a bicycle over the moon"}}' \
+ /// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
/// -H 'Content-Type: application/json' \
- /// "https://api.replicate.com/v1/deployments/replicate/hello-world/predictions"
- /// ```
- /// The response will be the prediction object:
- /// ```json
- /// {
- /// "id": "86b6trbv99rgp0cf1h886f69ew",
- /// "model": "replicate/hello-world",
- /// "version": "dp-8e43d61c333b5ddc7a921130bc3ab3ea",
- /// "input": {
- /// "text": "Alice"
- /// },
- /// "logs": "",
- /// "error": null,
- /// "status": "starting",
- /// "created_at": "2024-04-23T18:55:52.138Z",
- /// "urls": {
- /// "cancel": "https://api.replicate.com/v1/predictions/86b6trbv99rgp0cf1h886f69ew/cancel",
- /// "get": "https://api.replicate.com/v1/predictions/86b6trbv99rgp0cf1h886f69ew"
- /// }
- /// }
+ /// https://api.replicate.com/v1/deployments/acme/my-app-image-generator/predictions
/// ```
- /// As models can take several seconds or more to run, the output will not be available immediately. To get the final result of the prediction you should either provide a `webhook` HTTPS URL for us to call when the results are ready, or poll the [get a prediction](#predictions.get) endpoint until it has finished.
- /// Input and output (including any files) will be automatically deleted after an hour, so you must save a copy of any files in the output if you'd like to continue using them.
- /// Output files are served by `replicate.delivery` and its subdomains. If you use an allow list of external domains for your assets, add `replicate.delivery` and `*.replicate.delivery` to it. + /// The request will wait up to 60 seconds for the model to run. If this time is exceeded the prediction will be returned in a `"starting"` state and need to be retrieved using the `predictions.get` endpiont.
+ /// For a complete overview of the `deployments.predictions.create` API check out our documentation on [creating a prediction](https://replicate.com/docs/topics/predictions/create-a-prediction) which covers a variety of use cases. ///
/// /// + /// + /// Example: wait=5 + /// /// /// The token to cancel the operation with /// @@ -56,52 +31,28 @@ public partial interface IApi string deploymentOwner, string deploymentName, global::G.PredictionRequest request, + string? prefer = default, global::System.Threading.CancellationToken cancellationToken = default); /// /// Create a prediction using a deployment
- /// Start a new prediction for a deployment of a model using inputs you provide.
- /// Example request body:
- /// ```json
- /// {
- /// "input": {
- /// "text": "Alice"
- /// }
- /// }
- /// ```
+ /// Create a prediction for the deployment and inputs you provide.
/// Example cURL request:
/// ```console
- /// curl -s -X POST \
- /// -d '{"input": {"text": "Alice"}}' \
- /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// curl -s -X POST -H 'Prefer: wait' \
+ /// -d '{"input": {"prompt": "A photo of a bear riding a bicycle over the moon"}}' \
+ /// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
/// -H 'Content-Type: application/json' \
- /// "https://api.replicate.com/v1/deployments/replicate/hello-world/predictions"
- /// ```
- /// The response will be the prediction object:
- /// ```json
- /// {
- /// "id": "86b6trbv99rgp0cf1h886f69ew",
- /// "model": "replicate/hello-world",
- /// "version": "dp-8e43d61c333b5ddc7a921130bc3ab3ea",
- /// "input": {
- /// "text": "Alice"
- /// },
- /// "logs": "",
- /// "error": null,
- /// "status": "starting",
- /// "created_at": "2024-04-23T18:55:52.138Z",
- /// "urls": {
- /// "cancel": "https://api.replicate.com/v1/predictions/86b6trbv99rgp0cf1h886f69ew/cancel",
- /// "get": "https://api.replicate.com/v1/predictions/86b6trbv99rgp0cf1h886f69ew"
- /// }
- /// }
+ /// https://api.replicate.com/v1/deployments/acme/my-app-image-generator/predictions
/// ```
- /// As models can take several seconds or more to run, the output will not be available immediately. To get the final result of the prediction you should either provide a `webhook` HTTPS URL for us to call when the results are ready, or poll the [get a prediction](#predictions.get) endpoint until it has finished.
- /// Input and output (including any files) will be automatically deleted after an hour, so you must save a copy of any files in the output if you'd like to continue using them.
- /// Output files are served by `replicate.delivery` and its subdomains. If you use an allow list of external domains for your assets, add `replicate.delivery` and `*.replicate.delivery` to it. + /// The request will wait up to 60 seconds for the model to run. If this time is exceeded the prediction will be returned in a `"starting"` state and need to be retrieved using the `predictions.get` endpiont.
+ /// For a complete overview of the `deployments.predictions.create` API check out our documentation on [creating a prediction](https://replicate.com/docs/topics/predictions/create-a-prediction) which covers a variety of use cases. ///
/// /// + /// + /// Example: wait=5 + /// /// /// The model's input as a JSON object. The input schema depends on what model you are running. To see the available inputs, click the "API" tab on the model you are running or [get the model version](#models.versions.get) and look at its `openapi_schema` property. For example, [stability-ai/sdxl](https://replicate.com/stability-ai/sdxl) takes `prompt` as an input.
/// Files should be passed as HTTP URLs or data URLs.
@@ -146,6 +97,7 @@ public partial interface IApi string deploymentOwner, string deploymentName, object input, + string? prefer = default, bool? stream = default, string? webhook = default, global::System.Collections.Generic.IList? webhookEventsFilter = default, diff --git a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.IApi.CreatePredictionsModels.g.verified.cs b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.IApi.CreatePredictionsModels.g.verified.cs index b27c6b833d..7e42e0c439 100644 --- a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.IApi.CreatePredictionsModels.g.verified.cs +++ b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.IApi.CreatePredictionsModels.g.verified.cs @@ -7,101 +7,52 @@ public partial interface IApi { /// /// Create a prediction using an official model
- /// Start a new prediction for an official model using the inputs you provide.
- /// Example request body:
- /// ```json
- /// {
- /// "input": {
- /// "prompt": "Write a short poem about the weather."
- /// }
- /// }
- /// ```
+ /// Create a prediction for the deployment and inputs you provide.
/// Example cURL request:
/// ```console
- /// curl -s -X POST \
+ /// curl -s -X POST -H 'Prefer: wait' \
/// -d '{"input": {"prompt": "Write a short poem about the weather."}}' \
- /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
/// -H 'Content-Type: application/json' \
/// https://api.replicate.com/v1/models/meta/meta-llama-3-70b-instruct/predictions
/// ```
- /// The response will be the prediction object:
- /// ```json
- /// {
- /// "id": "25s2s4n7rdrgg0cf1httb3myk0",
- /// "model": "replicate-internal/llama3-70b-chat-vllm-unquantized",
- /// "version": "dp-cf04fe09351e25db628e8b6181276547",
- /// "input": {
- /// "prompt": "Write a short poem about the weather."
- /// },
- /// "logs": "",
- /// "error": null,
- /// "status": "starting",
- /// "created_at": "2024-04-23T19:36:28.355Z",
- /// "urls": {
- /// "cancel": "https://api.replicate.com/v1/predictions/25s2s4n7rdrgg0cf1httb3myk0/cancel",
- /// "get": "https://api.replicate.com/v1/predictions/25s2s4n7rdrgg0cf1httb3myk0"
- /// }
- /// }
- /// ```
- /// As models can take several seconds or more to run, the output will not be available immediately. To get the final result of the prediction you should either provide a `webhook` HTTPS URL for us to call when the results are ready, or poll the [get a prediction](#predictions.get) endpoint until it has finished.
- /// All input parameters, output values, and logs are automatically removed after an hour, by default, for predictions created through the API.
- /// Output files are served by `replicate.delivery` and its subdomains. If you use an allow list of external domains for your assets, add `replicate.delivery` and `*.replicate.delivery` to it. + /// The request will wait up to 60 seconds for the model to run. If this time is exceeded the prediction will be returned in a `"starting"` state and need to be retrieved using the `predictions.get` endpiont.
+ /// For a complete overview of the `deployments.predictions.create` API check out our documentation on [creating a prediction](https://replicate.com/docs/topics/predictions/create-a-prediction) which covers a variety of use cases. ///
/// /// + /// + /// Example: wait=5 + /// /// /// The token to cancel the operation with /// - global::System.Threading.Tasks.Task CreatePredictionsModelsAsync( + global::System.Threading.Tasks.Task CreatePredictionsModelsAsync( string modelOwner, string modelName, global::G.PredictionRequest request, + string? prefer = default, global::System.Threading.CancellationToken cancellationToken = default); /// /// Create a prediction using an official model
- /// Start a new prediction for an official model using the inputs you provide.
- /// Example request body:
- /// ```json
- /// {
- /// "input": {
- /// "prompt": "Write a short poem about the weather."
- /// }
- /// }
- /// ```
+ /// Create a prediction for the deployment and inputs you provide.
/// Example cURL request:
/// ```console
- /// curl -s -X POST \
+ /// curl -s -X POST -H 'Prefer: wait' \
/// -d '{"input": {"prompt": "Write a short poem about the weather."}}' \
- /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
/// -H 'Content-Type: application/json' \
/// https://api.replicate.com/v1/models/meta/meta-llama-3-70b-instruct/predictions
/// ```
- /// The response will be the prediction object:
- /// ```json
- /// {
- /// "id": "25s2s4n7rdrgg0cf1httb3myk0",
- /// "model": "replicate-internal/llama3-70b-chat-vllm-unquantized",
- /// "version": "dp-cf04fe09351e25db628e8b6181276547",
- /// "input": {
- /// "prompt": "Write a short poem about the weather."
- /// },
- /// "logs": "",
- /// "error": null,
- /// "status": "starting",
- /// "created_at": "2024-04-23T19:36:28.355Z",
- /// "urls": {
- /// "cancel": "https://api.replicate.com/v1/predictions/25s2s4n7rdrgg0cf1httb3myk0/cancel",
- /// "get": "https://api.replicate.com/v1/predictions/25s2s4n7rdrgg0cf1httb3myk0"
- /// }
- /// }
- /// ```
- /// As models can take several seconds or more to run, the output will not be available immediately. To get the final result of the prediction you should either provide a `webhook` HTTPS URL for us to call when the results are ready, or poll the [get a prediction](#predictions.get) endpoint until it has finished.
- /// All input parameters, output values, and logs are automatically removed after an hour, by default, for predictions created through the API.
- /// Output files are served by `replicate.delivery` and its subdomains. If you use an allow list of external domains for your assets, add `replicate.delivery` and `*.replicate.delivery` to it. + /// The request will wait up to 60 seconds for the model to run. If this time is exceeded the prediction will be returned in a `"starting"` state and need to be retrieved using the `predictions.get` endpiont.
+ /// For a complete overview of the `deployments.predictions.create` API check out our documentation on [creating a prediction](https://replicate.com/docs/topics/predictions/create-a-prediction) which covers a variety of use cases. ///
/// /// + /// + /// Example: wait=5 + /// /// /// The model's input as a JSON object. The input schema depends on what model you are running. To see the available inputs, click the "API" tab on the model you are running or [get the model version](#models.versions.get) and look at its `openapi_schema` property. For example, [stability-ai/sdxl](https://replicate.com/stability-ai/sdxl) takes `prompt` as an input.
/// Files should be passed as HTTP URLs or data URLs.
@@ -142,10 +93,11 @@ public partial interface IApi /// /// The token to cancel the operation with /// - global::System.Threading.Tasks.Task CreatePredictionsModelsAsync( + global::System.Threading.Tasks.Task CreatePredictionsModelsAsync( string modelOwner, string modelName, object input, + string? prefer = default, bool? stream = default, string? webhook = default, global::System.Collections.Generic.IList? webhookEventsFilter = default, diff --git a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.IApi.CreateTrainings.g.verified.cs b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.IApi.CreateTrainings.g.verified.cs index 1ed4259eb9..9506b800f6 100644 --- a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.IApi.CreateTrainings.g.verified.cs +++ b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.IApi.CreateTrainings.g.verified.cs @@ -22,7 +22,7 @@ public partial interface IApi /// ```console
/// curl -s -X POST \
/// -d '{"destination": "{new_owner}/{new_name}", "input": {"input_images": "https://example.com/my-input-images.zip"}}' \
- /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
/// -H 'Content-Type: application/json' \
/// https://api.replicate.com/v1/models/stability-ai/sdxl/versions/da77bc59ee60423279fd632efb4795ab731d9e3ca9705ef3341091fb989b7eaf/trainings
/// ```
@@ -79,7 +79,7 @@ public partial interface IApi /// ```console
/// curl -s -X POST \
/// -d '{"destination": "{new_owner}/{new_name}", "input": {"input_images": "https://example.com/my-input-images.zip"}}' \
- /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
/// -H 'Content-Type: application/json' \
/// https://api.replicate.com/v1/models/stability-ai/sdxl/versions/da77bc59ee60423279fd632efb4795ab731d9e3ca9705ef3341091fb989b7eaf/trainings
/// ```
diff --git a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.IApi.DeleteDeployments.g.verified.cs b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.IApi.DeleteDeployments.g.verified.cs index 9782b0fcd8..7d6e9d0b15 100644 --- a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.IApi.DeleteDeployments.g.verified.cs +++ b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.IApi.DeleteDeployments.g.verified.cs @@ -13,7 +13,7 @@ public partial interface IApi /// Example cURL request:
/// ```command
/// curl -s -X DELETE \
- /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
/// https://api.replicate.com/v1/deployments/acme/my-app-image-generator
/// ```
/// The response will be an empty 204, indicating the deployment has been deleted. diff --git a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.IApi.DeleteModels.g.verified.cs b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.IApi.DeleteModels.g.verified.cs index 5ad1c63e6e..107b5bf6c3 100644 --- a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.IApi.DeleteModels.g.verified.cs +++ b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.IApi.DeleteModels.g.verified.cs @@ -15,7 +15,7 @@ public partial interface IApi /// Example cURL request:
/// ```command
/// curl -s -X DELETE \
- /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
/// https://api.replicate.com/v1/models/replicate/hello-world
/// ```
/// The response will be an empty 204, indicating the model has been deleted. diff --git a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.IApi.DeleteVersionsModels.g.verified.cs b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.IApi.DeleteVersionsModels.g.verified.cs index 7e1f5d315e..c5e57d0825 100644 --- a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.IApi.DeleteVersionsModels.g.verified.cs +++ b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.IApi.DeleteVersionsModels.g.verified.cs @@ -18,7 +18,7 @@ public partial interface IApi /// Example cURL request:
/// ```command
/// curl -s -X DELETE \
- /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
/// https://api.replicate.com/v1/models/replicate/hello-world/versions/5c7d5dc6dd8bf75c1acaa8565735e7986bc5b66206b55cca93cb72c9bf15ccaa
/// ```
/// The response will be an empty 202, indicating the deletion request has been accepted. It might take a few minutes to be processed. diff --git a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.IApi.GetAccount.g.verified.cs b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.IApi.GetAccount.g.verified.cs index a5eca1c3d9..1b94e1a256 100644 --- a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.IApi.GetAccount.g.verified.cs +++ b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.IApi.GetAccount.g.verified.cs @@ -11,7 +11,7 @@ public partial interface IApi /// Example cURL request:
/// ```console
/// curl -s \
- /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
/// https://api.replicate.com/v1/account
/// ```
/// The response will be a JSON object describing the account:
diff --git a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.IApi.GetCollections.g.verified.cs b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.IApi.GetCollections.g.verified.cs index c07111c8f8..4f91279bce 100644 --- a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.IApi.GetCollections.g.verified.cs +++ b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.IApi.GetCollections.g.verified.cs @@ -10,7 +10,7 @@ public partial interface IApi /// Example cURL request:
/// ```console
/// curl -s \
- /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
/// https://api.replicate.com/v1/collections/super-resolution
/// ```
/// The response will be a collection object with a nested list of the models in that collection:
diff --git a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.IApi.GetDeployments.g.verified.cs b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.IApi.GetDeployments.g.verified.cs index 64fd187348..d31bcaabe0 100644 --- a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.IApi.GetDeployments.g.verified.cs +++ b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.IApi.GetDeployments.g.verified.cs @@ -11,7 +11,7 @@ public partial interface IApi /// Example cURL request:
/// ```console
/// curl -s \
- /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
/// https://api.replicate.com/v1/deployments/replicate/my-app-image-generator
/// ```
/// The response will be a JSON object describing the deployment:
diff --git a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.IApi.GetModels.g.verified.cs b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.IApi.GetModels.g.verified.cs index 44871cfaa5..f7dad4b97f 100644 --- a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.IApi.GetModels.g.verified.cs +++ b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.IApi.GetModels.g.verified.cs @@ -10,7 +10,7 @@ public partial interface IApi /// Example cURL request:
/// ```console
/// curl -s \
- /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
/// https://api.replicate.com/v1/models/replicate/hello-world
/// ```
/// The response will be a model object in the following format:
diff --git a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.IApi.GetPredictions.g.verified.cs b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.IApi.GetPredictions.g.verified.cs index bb4b58f0b6..216872ae96 100644 --- a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.IApi.GetPredictions.g.verified.cs +++ b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.IApi.GetPredictions.g.verified.cs @@ -11,7 +11,7 @@ public partial interface IApi /// Example cURL request:
/// ```console
/// curl -s \
- /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
/// https://api.replicate.com/v1/predictions/gm3qorzdhgbfurvjtvhg6dckhu
/// ```
/// The response will be the prediction object:
@@ -56,7 +56,7 @@ public partial interface IApi /// /// The token to cancel the operation with /// - global::System.Threading.Tasks.Task GetPredictionsAsync( + global::System.Threading.Tasks.Task GetPredictionsAsync( string predictionId, global::System.Threading.CancellationToken cancellationToken = default); } diff --git a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.IApi.GetSecretDefaultWebhooks.g.verified.cs b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.IApi.GetSecretDefaultWebhooks.g.verified.cs index 3235b81678..87248fb83d 100644 --- a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.IApi.GetSecretDefaultWebhooks.g.verified.cs +++ b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.IApi.GetSecretDefaultWebhooks.g.verified.cs @@ -11,7 +11,7 @@ public partial interface IApi /// Example cURL request:
/// ```console
/// curl -s \
- /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
/// https://api.replicate.com/v1/webhooks/default/secret
/// ```
/// The response will be a JSON object with a `key` property:
diff --git a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.IApi.GetTrainings.g.verified.cs b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.IApi.GetTrainings.g.verified.cs index 108c012941..cacb9751e7 100644 --- a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.IApi.GetTrainings.g.verified.cs +++ b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.IApi.GetTrainings.g.verified.cs @@ -11,7 +11,7 @@ public partial interface IApi /// Example cURL request:
/// ```console
/// curl -s \
- /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
/// https://api.replicate.com/v1/trainings/zz4ibbonubfz7carwiefibzgga
/// ```
/// The response will be the training object:
diff --git a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.IApi.GetVersionsModels.g.verified.cs b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.IApi.GetVersionsModels.g.verified.cs index c8ab027a99..8845a5e827 100644 --- a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.IApi.GetVersionsModels.g.verified.cs +++ b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.IApi.GetVersionsModels.g.verified.cs @@ -10,7 +10,7 @@ public partial interface IApi /// Example cURL request:
/// ```console
/// curl -s \
- /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
/// https://api.replicate.com/v1/models/replicate/hello-world/versions/5c7d5dc6dd8bf75c1acaa8565735e7986bc5b66206b55cca93cb72c9bf15ccaa
/// ```
/// The response will be the version object:
diff --git a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.IApi.ListCollections.g.verified.cs b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.IApi.ListCollections.g.verified.cs index 1aa3f13fde..3ef45f959f 100644 --- a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.IApi.ListCollections.g.verified.cs +++ b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.IApi.ListCollections.g.verified.cs @@ -10,7 +10,7 @@ public partial interface IApi /// Example cURL request:
/// ```console
/// curl -s \
- /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
/// https://api.replicate.com/v1/collections
/// ```
/// The response will be a paginated JSON list of collection objects:
diff --git a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.IApi.ListDeployments.g.verified.cs b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.IApi.ListDeployments.g.verified.cs index 00e3438809..b414b64162 100644 --- a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.IApi.ListDeployments.g.verified.cs +++ b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.IApi.ListDeployments.g.verified.cs @@ -11,7 +11,7 @@ public partial interface IApi /// Example cURL request:
/// ```console
/// curl -s \
- /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
/// https://api.replicate.com/v1/deployments
/// ```
/// The response will be a paginated JSON array of deployment objects, sorted with the most recent deployment first:
diff --git a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.IApi.ListHardware.g.verified.cs b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.IApi.ListHardware.g.verified.cs index 4489452841..ff8e4fe531 100644 --- a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.IApi.ListHardware.g.verified.cs +++ b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.IApi.ListHardware.g.verified.cs @@ -10,7 +10,7 @@ public partial interface IApi /// Example cURL request:
/// ```console
/// curl -s \
- /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
/// https://api.replicate.com/v1/hardware
/// ```
/// The response will be a JSON array of hardware objects:
diff --git a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.IApi.ListModels.g.verified.cs b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.IApi.ListModels.g.verified.cs index 2807539cf4..8a37a89585 100644 --- a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.IApi.ListModels.g.verified.cs +++ b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.IApi.ListModels.g.verified.cs @@ -11,7 +11,7 @@ public partial interface IApi /// Example cURL request:
/// ```console
/// curl -s \
- /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
/// https://api.replicate.com/v1/models
/// ```
/// The response will be a paginated JSON array of model objects:
diff --git a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.IApi.ListPredictions.g.verified.cs b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.IApi.ListPredictions.g.verified.cs index d81da97f8a..00afaab2ea 100644 --- a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.IApi.ListPredictions.g.verified.cs +++ b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.IApi.ListPredictions.g.verified.cs @@ -11,7 +11,7 @@ public partial interface IApi /// Example cURL request:
/// ```console
/// curl -s \
- /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
/// https://api.replicate.com/v1/predictions
/// ```
/// The response will be a paginated JSON array of prediction objects, sorted with the most recent prediction first:
diff --git a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.IApi.ListTrainings.g.verified.cs b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.IApi.ListTrainings.g.verified.cs index f9df446cad..949a9beca6 100644 --- a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.IApi.ListTrainings.g.verified.cs +++ b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.IApi.ListTrainings.g.verified.cs @@ -11,7 +11,7 @@ public partial interface IApi /// Example cURL request:
/// ```console
/// curl -s \
- /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
/// https://api.replicate.com/v1/trainings
/// ```
/// The response will be a paginated JSON array of training objects, sorted with the most recent training first:
diff --git a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.IApi.ListVersionsModels.g.verified.cs b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.IApi.ListVersionsModels.g.verified.cs index 444ecf78eb..e223555693 100644 --- a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.IApi.ListVersionsModels.g.verified.cs +++ b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.IApi.ListVersionsModels.g.verified.cs @@ -10,7 +10,7 @@ public partial interface IApi /// Example cURL request:
/// ```console
/// curl -s \
- /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
/// https://api.replicate.com/v1/models/replicate/hello-world/versions
/// ```
/// The response will be a JSON array of model version objects, sorted with the most recent version first:
diff --git a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.IApi.UpdateDeployments.g.verified.cs b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.IApi.UpdateDeployments.g.verified.cs index dbf142198a..37ee6691ba 100644 --- a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.IApi.UpdateDeployments.g.verified.cs +++ b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.IApi.UpdateDeployments.g.verified.cs @@ -12,7 +12,7 @@ public partial interface IApi /// ```console
/// curl -s \
/// -X PATCH \
- /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
/// -H "Content-Type: application/json" \
/// -d '{"min_instances": 3, "max_instances": 10}' \
/// https://api.replicate.com/v1/deployments/acme/my-app-image-generator
@@ -61,7 +61,7 @@ public partial interface IApi /// ```console
/// curl -s \
/// -X PATCH \
- /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
/// -H "Content-Type: application/json" \
/// -d '{"min_instances": 3, "max_instances": 10}' \
/// https://api.replicate.com/v1/deployments/acme/my-app-image-generator
diff --git a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.Models.PredictionResponse.Json.g.verified.cs b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.Models.PredictionResponse.Json.g.verified.cs deleted file mode 100644 index cca87cff2e..0000000000 --- a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.Models.PredictionResponse.Json.g.verified.cs +++ /dev/null @@ -1,56 +0,0 @@ -//HintName: G.Models.PredictionResponse.Json.g.cs -#nullable enable - -namespace G -{ - public sealed partial class PredictionResponse - { - /// - /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. - /// -#if NET8_0_OR_GREATER - [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] - [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] -#endif - public string ToJson( - global::Newtonsoft.Json.JsonSerializerSettings? jsonSerializerOptions = null) - { - return global::Newtonsoft.Json.JsonConvert.SerializeObject( - this, - jsonSerializerOptions); - } - - /// - /// Deserializes a JSON string using the provided JsonSerializerOptions. - /// -#if NET8_0_OR_GREATER - [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] - [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] -#endif - public static global::G.PredictionResponse? FromJson( - string json, - global::Newtonsoft.Json.JsonSerializerSettings? jsonSerializerOptions = null) - { - return global::Newtonsoft.Json.JsonConvert.DeserializeObject( - json, - jsonSerializerOptions); - } - - /// - /// Deserializes a JSON stream using the provided JsonSerializerOptions. - /// -#if NET8_0_OR_GREATER - [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] - [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] -#endif - public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( - global::System.IO.Stream jsonStream, - global::Newtonsoft.Json.JsonSerializerSettings? jsonSerializerOptions = null) - { - using var streamReader = new global::System.IO.StreamReader(jsonStream); - using var jsonReader = new global::Newtonsoft.Json.JsonTextReader(streamReader); - var serializer = global::Newtonsoft.Json.JsonSerializer.Create(jsonSerializerOptions); - return new global::System.Threading.Tasks.ValueTask(serializer.Deserialize(jsonReader)); - } - } -} diff --git a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.Models.PredictionResponse.g.verified.cs b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.Models.PredictionResponse.g.verified.cs deleted file mode 100644 index 56d8b5e5f3..0000000000 --- a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.Models.PredictionResponse.g.verified.cs +++ /dev/null @@ -1,149 +0,0 @@ -//HintName: G.Models.PredictionResponse.g.cs - -#nullable enable - -namespace G -{ - /// - /// - /// - public sealed partial class PredictionResponse - { - /// - /// - /// - [global::Newtonsoft.Json.JsonProperty("completed_at")] - public string? CompletedAt { get; set; } - - /// - /// - /// - [global::Newtonsoft.Json.JsonProperty("created_at")] - public string? CreatedAt { get; set; } - - /// - /// - /// - [global::Newtonsoft.Json.JsonProperty("data_removed")] - public bool? DataRemoved { get; set; } - - /// - /// - /// - [global::Newtonsoft.Json.JsonProperty("error")] - public object? Error { get; set; } - - /// - /// - /// - [global::Newtonsoft.Json.JsonProperty("id")] - public string? Id { get; set; } - - /// - /// - /// - [global::Newtonsoft.Json.JsonProperty("input")] - public global::G.PredictionResponseInput? Input { get; set; } - - /// - /// - /// - [global::Newtonsoft.Json.JsonProperty("logs")] - public string? Logs { get; set; } - - /// - /// - /// - [global::Newtonsoft.Json.JsonProperty("metrics")] - public global::G.PredictionResponseMetrics? Metrics { get; set; } - - /// - /// - /// - [global::Newtonsoft.Json.JsonProperty("output")] - public string? Output { get; set; } - - /// - /// - /// - [global::Newtonsoft.Json.JsonProperty("started_at")] - public string? StartedAt { get; set; } - - /// - /// - /// - [global::Newtonsoft.Json.JsonProperty("status")] - public string? Status { get; set; } - - /// - /// - /// - [global::Newtonsoft.Json.JsonProperty("urls")] - public global::G.PredictionResponseUrls? Urls { get; set; } - - /// - /// - /// - [global::Newtonsoft.Json.JsonProperty("version")] - public string? Version { get; set; } - - /// - /// Additional properties that are not explicitly defined in the schema - /// - [global::Newtonsoft.Json.JsonExtensionData] - public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); - - /// - /// Initializes a new instance of the class. - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - public PredictionResponse( - string? completedAt, - string? createdAt, - bool? dataRemoved, - object? error, - string? id, - global::G.PredictionResponseInput? input, - string? logs, - global::G.PredictionResponseMetrics? metrics, - string? output, - string? startedAt, - string? status, - global::G.PredictionResponseUrls? urls, - string? version) - { - this.CompletedAt = completedAt; - this.CreatedAt = createdAt; - this.DataRemoved = dataRemoved; - this.Error = error; - this.Id = id; - this.Input = input; - this.Logs = logs; - this.Metrics = metrics; - this.Output = output; - this.StartedAt = startedAt; - this.Status = status; - this.Urls = urls; - this.Version = version; - } - - /// - /// Initializes a new instance of the class. - /// - public PredictionResponse() - { - } - } -} \ No newline at end of file diff --git a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.Models.PredictionResponseInput.Json.g.verified.cs b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.Models.PredictionResponseInput.Json.g.verified.cs deleted file mode 100644 index 6f06f6294a..0000000000 --- a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.Models.PredictionResponseInput.Json.g.verified.cs +++ /dev/null @@ -1,56 +0,0 @@ -//HintName: G.Models.PredictionResponseInput.Json.g.cs -#nullable enable - -namespace G -{ - public sealed partial class PredictionResponseInput - { - /// - /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. - /// -#if NET8_0_OR_GREATER - [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] - [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] -#endif - public string ToJson( - global::Newtonsoft.Json.JsonSerializerSettings? jsonSerializerOptions = null) - { - return global::Newtonsoft.Json.JsonConvert.SerializeObject( - this, - jsonSerializerOptions); - } - - /// - /// Deserializes a JSON string using the provided JsonSerializerOptions. - /// -#if NET8_0_OR_GREATER - [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] - [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] -#endif - public static global::G.PredictionResponseInput? FromJson( - string json, - global::Newtonsoft.Json.JsonSerializerSettings? jsonSerializerOptions = null) - { - return global::Newtonsoft.Json.JsonConvert.DeserializeObject( - json, - jsonSerializerOptions); - } - - /// - /// Deserializes a JSON stream using the provided JsonSerializerOptions. - /// -#if NET8_0_OR_GREATER - [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] - [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] -#endif - public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( - global::System.IO.Stream jsonStream, - global::Newtonsoft.Json.JsonSerializerSettings? jsonSerializerOptions = null) - { - using var streamReader = new global::System.IO.StreamReader(jsonStream); - using var jsonReader = new global::Newtonsoft.Json.JsonTextReader(streamReader); - var serializer = global::Newtonsoft.Json.JsonSerializer.Create(jsonSerializerOptions); - return new global::System.Threading.Tasks.ValueTask(serializer.Deserialize(jsonReader)); - } - } -} diff --git a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.Models.PredictionResponseInput.g.verified.cs b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.Models.PredictionResponseInput.g.verified.cs deleted file mode 100644 index 168fc87c75..0000000000 --- a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.Models.PredictionResponseInput.g.verified.cs +++ /dev/null @@ -1,95 +0,0 @@ -//HintName: G.Models.PredictionResponseInput.g.cs - -#nullable enable - -namespace G -{ - /// - /// - /// - public sealed partial class PredictionResponseInput - { - /// - /// - /// - [global::Newtonsoft.Json.JsonProperty("seed")] - public double? Seed { get; set; } - - /// - /// - /// - [global::Newtonsoft.Json.JsonProperty("steps")] - public double? Steps { get; set; } - - /// - /// - /// - [global::Newtonsoft.Json.JsonProperty("prompt")] - public string? Prompt { get; set; } - - /// - /// - /// - [global::Newtonsoft.Json.JsonProperty("guidance")] - public double? Guidance { get; set; } - - /// - /// - /// - [global::Newtonsoft.Json.JsonProperty("interval")] - public double? Interval { get; set; } - - /// - /// - /// - [global::Newtonsoft.Json.JsonProperty("aspect_ratio")] - public string? AspectRatio { get; set; } - - /// - /// - /// - [global::Newtonsoft.Json.JsonProperty("safety_tolerance")] - public double? SafetyTolerance { get; set; } - - /// - /// Additional properties that are not explicitly defined in the schema - /// - [global::Newtonsoft.Json.JsonExtensionData] - public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); - - /// - /// Initializes a new instance of the class. - /// - /// - /// - /// - /// - /// - /// - /// - public PredictionResponseInput( - double? seed, - double? steps, - string? prompt, - double? guidance, - double? interval, - string? aspectRatio, - double? safetyTolerance) - { - this.Seed = seed; - this.Steps = steps; - this.Prompt = prompt; - this.Guidance = guidance; - this.Interval = interval; - this.AspectRatio = aspectRatio; - this.SafetyTolerance = safetyTolerance; - } - - /// - /// Initializes a new instance of the class. - /// - public PredictionResponseInput() - { - } - } -} \ No newline at end of file diff --git a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.Models.PredictionResponseMetrics.Json.g.verified.cs b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.Models.PredictionResponseMetrics.Json.g.verified.cs deleted file mode 100644 index 7d59482892..0000000000 --- a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.Models.PredictionResponseMetrics.Json.g.verified.cs +++ /dev/null @@ -1,56 +0,0 @@ -//HintName: G.Models.PredictionResponseMetrics.Json.g.cs -#nullable enable - -namespace G -{ - public sealed partial class PredictionResponseMetrics - { - /// - /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. - /// -#if NET8_0_OR_GREATER - [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] - [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] -#endif - public string ToJson( - global::Newtonsoft.Json.JsonSerializerSettings? jsonSerializerOptions = null) - { - return global::Newtonsoft.Json.JsonConvert.SerializeObject( - this, - jsonSerializerOptions); - } - - /// - /// Deserializes a JSON string using the provided JsonSerializerOptions. - /// -#if NET8_0_OR_GREATER - [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] - [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] -#endif - public static global::G.PredictionResponseMetrics? FromJson( - string json, - global::Newtonsoft.Json.JsonSerializerSettings? jsonSerializerOptions = null) - { - return global::Newtonsoft.Json.JsonConvert.DeserializeObject( - json, - jsonSerializerOptions); - } - - /// - /// Deserializes a JSON stream using the provided JsonSerializerOptions. - /// -#if NET8_0_OR_GREATER - [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] - [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] -#endif - public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( - global::System.IO.Stream jsonStream, - global::Newtonsoft.Json.JsonSerializerSettings? jsonSerializerOptions = null) - { - using var streamReader = new global::System.IO.StreamReader(jsonStream); - using var jsonReader = new global::Newtonsoft.Json.JsonTextReader(streamReader); - var serializer = global::Newtonsoft.Json.JsonSerializer.Create(jsonSerializerOptions); - return new global::System.Threading.Tasks.ValueTask(serializer.Deserialize(jsonReader)); - } - } -} diff --git a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.Models.PredictionResponseMetrics.g.verified.cs b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.Models.PredictionResponseMetrics.g.verified.cs deleted file mode 100644 index 22771ea420..0000000000 --- a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.Models.PredictionResponseMetrics.g.verified.cs +++ /dev/null @@ -1,59 +0,0 @@ -//HintName: G.Models.PredictionResponseMetrics.g.cs - -#nullable enable - -namespace G -{ - /// - /// - /// - public sealed partial class PredictionResponseMetrics - { - /// - /// - /// - [global::Newtonsoft.Json.JsonProperty("image_count")] - public double? ImageCount { get; set; } - - /// - /// - /// - [global::Newtonsoft.Json.JsonProperty("predict_time")] - public double? PredictTime { get; set; } - - /// - /// - /// - [global::Newtonsoft.Json.JsonProperty("total_time")] - public double? TotalTime { get; set; } - - /// - /// Additional properties that are not explicitly defined in the schema - /// - [global::Newtonsoft.Json.JsonExtensionData] - public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); - - /// - /// Initializes a new instance of the class. - /// - /// - /// - /// - public PredictionResponseMetrics( - double? imageCount, - double? predictTime, - double? totalTime) - { - this.ImageCount = imageCount; - this.PredictTime = predictTime; - this.TotalTime = totalTime; - } - - /// - /// Initializes a new instance of the class. - /// - public PredictionResponseMetrics() - { - } - } -} \ No newline at end of file diff --git a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.Models.PredictionResponseUrls.Json.g.verified.cs b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.Models.PredictionResponseUrls.Json.g.verified.cs deleted file mode 100644 index 86b1d0597e..0000000000 --- a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.Models.PredictionResponseUrls.Json.g.verified.cs +++ /dev/null @@ -1,56 +0,0 @@ -//HintName: G.Models.PredictionResponseUrls.Json.g.cs -#nullable enable - -namespace G -{ - public sealed partial class PredictionResponseUrls - { - /// - /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. - /// -#if NET8_0_OR_GREATER - [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] - [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] -#endif - public string ToJson( - global::Newtonsoft.Json.JsonSerializerSettings? jsonSerializerOptions = null) - { - return global::Newtonsoft.Json.JsonConvert.SerializeObject( - this, - jsonSerializerOptions); - } - - /// - /// Deserializes a JSON string using the provided JsonSerializerOptions. - /// -#if NET8_0_OR_GREATER - [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] - [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] -#endif - public static global::G.PredictionResponseUrls? FromJson( - string json, - global::Newtonsoft.Json.JsonSerializerSettings? jsonSerializerOptions = null) - { - return global::Newtonsoft.Json.JsonConvert.DeserializeObject( - json, - jsonSerializerOptions); - } - - /// - /// Deserializes a JSON stream using the provided JsonSerializerOptions. - /// -#if NET8_0_OR_GREATER - [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] - [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] -#endif - public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( - global::System.IO.Stream jsonStream, - global::Newtonsoft.Json.JsonSerializerSettings? jsonSerializerOptions = null) - { - using var streamReader = new global::System.IO.StreamReader(jsonStream); - using var jsonReader = new global::Newtonsoft.Json.JsonTextReader(streamReader); - var serializer = global::Newtonsoft.Json.JsonSerializer.Create(jsonSerializerOptions); - return new global::System.Threading.Tasks.ValueTask(serializer.Deserialize(jsonReader)); - } - } -} diff --git a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.Models.PredictionResponseUrls.g.verified.cs b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.Models.PredictionResponseUrls.g.verified.cs deleted file mode 100644 index 6960ae4d39..0000000000 --- a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.Models.PredictionResponseUrls.g.verified.cs +++ /dev/null @@ -1,50 +0,0 @@ -//HintName: G.Models.PredictionResponseUrls.g.cs - -#nullable enable - -namespace G -{ - /// - /// - /// - public sealed partial class PredictionResponseUrls - { - /// - /// - /// - [global::Newtonsoft.Json.JsonProperty("get")] - public string? Get { get; set; } - - /// - /// - /// - [global::Newtonsoft.Json.JsonProperty("cancel")] - public string? Cancel { get; set; } - - /// - /// Additional properties that are not explicitly defined in the schema - /// - [global::Newtonsoft.Json.JsonExtensionData] - public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); - - /// - /// Initializes a new instance of the class. - /// - /// - /// - public PredictionResponseUrls( - string? get, - string? cancel) - { - this.Get = get; - this.Cancel = cancel; - } - - /// - /// Initializes a new instance of the class. - /// - public PredictionResponseUrls() - { - } - } -} \ No newline at end of file diff --git a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.Api.CreateDeployments.g.verified.cs b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.Api.CreateDeployments.g.verified.cs index fd14ca509c..49514b780b 100644 --- a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.Api.CreateDeployments.g.verified.cs +++ b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.Api.CreateDeployments.g.verified.cs @@ -29,7 +29,7 @@ partial void ProcessCreateDeploymentsResponseContent( /// ```console
/// curl -s \
/// -X POST \
- /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
/// -H "Content-Type: application/json" \
/// -d '{
/// "name": "my-app-image-generator",
@@ -204,7 +204,7 @@ partial void ProcessCreateDeploymentsResponseContent( /// ```console
/// curl -s \
/// -X POST \
- /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
/// -H "Content-Type: application/json" \
/// -d '{
/// "name": "my-app-image-generator",
diff --git a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.Api.CreateModels.g.verified.cs b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.Api.CreateModels.g.verified.cs index eab866cb7f..c7f5243642 100644 --- a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.Api.CreateModels.g.verified.cs +++ b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.Api.CreateModels.g.verified.cs @@ -23,7 +23,7 @@ partial void ProcessCreateModelsResponse( /// Example cURL request:
/// ```console
/// curl -s -X POST \
- /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
/// -H 'Content-Type: application/json' \
/// -d '{"owner": "alice", "name": "my-model", "description": "An example model", "visibility": "public", "hardware": "cpu"}' \
/// https://api.replicate.com/v1/models
@@ -136,7 +136,7 @@ partial void ProcessCreateModelsResponse( /// Example cURL request:
/// ```console
/// curl -s -X POST \
- /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
/// -H 'Content-Type: application/json' \
/// -d '{"owner": "alice", "name": "my-model", "description": "An example model", "visibility": "public", "hardware": "cpu"}' \
/// https://api.replicate.com/v1/models
diff --git a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.Api.CreatePredictions.g.verified.cs b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.Api.CreatePredictions.g.verified.cs index eea0e59da6..68f62a9e2b 100644 --- a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.Api.CreatePredictions.g.verified.cs +++ b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.Api.CreatePredictions.g.verified.cs @@ -8,10 +8,12 @@ public partial class Api { partial void PrepareCreatePredictionsArguments( global::System.Net.Http.HttpClient httpClient, + ref string? prefer, global::G.VersionPredictionRequest request); partial void PrepareCreatePredictionsRequest( global::System.Net.Http.HttpClient httpClient, global::System.Net.Http.HttpRequestMessage httpRequestMessage, + string? prefer, global::G.VersionPredictionRequest request); partial void ProcessCreatePredictionsResponse( global::System.Net.Http.HttpClient httpClient, @@ -19,53 +21,27 @@ partial void ProcessCreatePredictionsResponse( /// /// Create a prediction
- /// Start a new prediction for the model version and inputs you provide.
- /// Example request body:
- /// ```json
- /// {
- /// "version": "5c7d5dc6dd8bf75c1acaa8565735e7986bc5b66206b55cca93cb72c9bf15ccaa",
- /// "input": {
- /// "text": "Alice"
- /// }
- /// }
- /// ```
+ /// Create a prediction for the model version and inputs you provide.
/// Example cURL request:
/// ```console
- /// curl -s -X POST \
+ /// curl -s -X POST -H 'Prefer: wait' \
/// -d '{"version": "5c7d5dc6dd8bf75c1acaa8565735e7986bc5b66206b55cca93cb72c9bf15ccaa", "input": {"text": "Alice"}}' \
- /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
/// -H 'Content-Type: application/json' \
/// https://api.replicate.com/v1/predictions
/// ```
- /// The response will be the prediction object:
- /// ```json
- /// {
- /// "id": "gm3qorzdhgbfurvjtvhg6dckhu",
- /// "model": "replicate/hello-world",
- /// "version": "5c7d5dc6dd8bf75c1acaa8565735e7986bc5b66206b55cca93cb72c9bf15ccaa",
- /// "input": {
- /// "text": "Alice"
- /// },
- /// "output": null,
- /// "logs": "",
- /// "error": null,
- /// "status": "starting",
- /// "created_at": "2023-09-08T16:19:34.765994657Z",
- /// "urls": {
- /// "cancel": "https://api.replicate.com/v1/predictions/gm3qorzdhgbfurvjtvhg6dckhu/cancel",
- /// "get": "https://api.replicate.com/v1/predictions/gm3qorzdhgbfurvjtvhg6dckhu"
- /// }
- /// }
- /// ```
- /// As models can take several seconds or more to run, the output will not be available immediately. To get the final result of the prediction you should either provide a `webhook` HTTPS URL for us to call when the results are ready, or poll the [get a prediction](#predictions.get) endpoint until it has finished.
- /// Input and output (including any files) will be automatically deleted after an hour, so you must save a copy of any files in the output if you'd like to continue using them.
- /// Output files are served by `replicate.delivery` and its subdomains. If you use an allow list of external domains for your assets, add `replicate.delivery` and `*.replicate.delivery` to it. + /// The request will wait up to 60 seconds for the model to run. If this time is exceeded the prediction will be returned in a `"starting"` state and need to be retrieved using the `predictions.get` endpiont.
+ /// For a complete overview of the `predictions.create` API check out our documentation on [creating a prediction](https://replicate.com/docs/topics/predictions/create-a-prediction) which covers a variety of use cases. ///
+ /// + /// Example: wait=5 + /// /// /// The token to cancel the operation with /// public async global::System.Threading.Tasks.Task CreatePredictionsAsync( global::G.VersionPredictionRequest request, + string? prefer = default, global::System.Threading.CancellationToken cancellationToken = default) { request = request ?? throw new global::System.ArgumentNullException(nameof(request)); @@ -74,6 +50,7 @@ partial void ProcessCreatePredictionsResponse( client: HttpClient); PrepareCreatePredictionsArguments( httpClient: HttpClient, + prefer: ref prefer, request: request); var __pathBuilder = new PathBuilder( @@ -99,6 +76,12 @@ partial void ProcessCreatePredictionsResponse( __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); } } + + if (prefer != default) + { + __httpRequest.Headers.TryAddWithoutValidation("Prefer", prefer.ToString()); + } + var __httpRequestContentBody = request.ToJson(JsonSerializerOptions); var __httpRequestContent = new global::System.Net.Http.StringContent( content: __httpRequestContentBody, @@ -112,6 +95,7 @@ partial void ProcessCreatePredictionsResponse( PrepareCreatePredictionsRequest( httpClient: HttpClient, httpRequestMessage: __httpRequest, + prefer: prefer, request: request); using var __response = await HttpClient.SendAsync( @@ -146,48 +130,21 @@ partial void ProcessCreatePredictionsResponse( /// /// Create a prediction
- /// Start a new prediction for the model version and inputs you provide.
- /// Example request body:
- /// ```json
- /// {
- /// "version": "5c7d5dc6dd8bf75c1acaa8565735e7986bc5b66206b55cca93cb72c9bf15ccaa",
- /// "input": {
- /// "text": "Alice"
- /// }
- /// }
- /// ```
+ /// Create a prediction for the model version and inputs you provide.
/// Example cURL request:
/// ```console
- /// curl -s -X POST \
+ /// curl -s -X POST -H 'Prefer: wait' \
/// -d '{"version": "5c7d5dc6dd8bf75c1acaa8565735e7986bc5b66206b55cca93cb72c9bf15ccaa", "input": {"text": "Alice"}}' \
- /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
/// -H 'Content-Type: application/json' \
/// https://api.replicate.com/v1/predictions
/// ```
- /// The response will be the prediction object:
- /// ```json
- /// {
- /// "id": "gm3qorzdhgbfurvjtvhg6dckhu",
- /// "model": "replicate/hello-world",
- /// "version": "5c7d5dc6dd8bf75c1acaa8565735e7986bc5b66206b55cca93cb72c9bf15ccaa",
- /// "input": {
- /// "text": "Alice"
- /// },
- /// "output": null,
- /// "logs": "",
- /// "error": null,
- /// "status": "starting",
- /// "created_at": "2023-09-08T16:19:34.765994657Z",
- /// "urls": {
- /// "cancel": "https://api.replicate.com/v1/predictions/gm3qorzdhgbfurvjtvhg6dckhu/cancel",
- /// "get": "https://api.replicate.com/v1/predictions/gm3qorzdhgbfurvjtvhg6dckhu"
- /// }
- /// }
- /// ```
- /// As models can take several seconds or more to run, the output will not be available immediately. To get the final result of the prediction you should either provide a `webhook` HTTPS URL for us to call when the results are ready, or poll the [get a prediction](#predictions.get) endpoint until it has finished.
- /// Input and output (including any files) will be automatically deleted after an hour, so you must save a copy of any files in the output if you'd like to continue using them.
- /// Output files are served by `replicate.delivery` and its subdomains. If you use an allow list of external domains for your assets, add `replicate.delivery` and `*.replicate.delivery` to it. + /// The request will wait up to 60 seconds for the model to run. If this time is exceeded the prediction will be returned in a `"starting"` state and need to be retrieved using the `predictions.get` endpiont.
+ /// For a complete overview of the `predictions.create` API check out our documentation on [creating a prediction](https://replicate.com/docs/topics/predictions/create-a-prediction) which covers a variety of use cases. ///
+ /// + /// Example: wait=5 + /// /// /// The model's input as a JSON object. The input schema depends on what model you are running. To see the available inputs, click the "API" tab on the model you are running or [get the model version](#models.versions.get) and look at its `openapi_schema` property. For example, [stability-ai/sdxl](https://replicate.com/stability-ai/sdxl) takes `prompt` as an input.
/// Files should be passed as HTTP URLs or data URLs.
@@ -235,6 +192,7 @@ partial void ProcessCreatePredictionsResponse( public async global::System.Threading.Tasks.Task CreatePredictionsAsync( object input, string version, + string? prefer = default, bool? stream = default, string? webhook = default, global::System.Collections.Generic.IList? webhookEventsFilter = default, @@ -250,6 +208,7 @@ partial void ProcessCreatePredictionsResponse( }; await CreatePredictionsAsync( + prefer: prefer, request: __request, cancellationToken: cancellationToken).ConfigureAwait(false); } diff --git a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.Api.CreatePredictionsDeployments.g.verified.cs b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.Api.CreatePredictionsDeployments.g.verified.cs index 2ae913eee4..a0dac0cec0 100644 --- a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.Api.CreatePredictionsDeployments.g.verified.cs +++ b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.Api.CreatePredictionsDeployments.g.verified.cs @@ -10,12 +10,14 @@ partial void PrepareCreatePredictionsDeploymentsArguments( global::System.Net.Http.HttpClient httpClient, ref string deploymentOwner, ref string deploymentName, + ref string? prefer, global::G.PredictionRequest request); partial void PrepareCreatePredictionsDeploymentsRequest( global::System.Net.Http.HttpClient httpClient, global::System.Net.Http.HttpRequestMessage httpRequestMessage, string deploymentOwner, string deploymentName, + string? prefer, global::G.PredictionRequest request); partial void ProcessCreatePredictionsDeploymentsResponse( global::System.Net.Http.HttpClient httpClient, @@ -23,48 +25,23 @@ partial void ProcessCreatePredictionsDeploymentsResponse( /// /// Create a prediction using a deployment
- /// Start a new prediction for a deployment of a model using inputs you provide.
- /// Example request body:
- /// ```json
- /// {
- /// "input": {
- /// "text": "Alice"
- /// }
- /// }
- /// ```
+ /// Create a prediction for the deployment and inputs you provide.
/// Example cURL request:
/// ```console
- /// curl -s -X POST \
- /// -d '{"input": {"text": "Alice"}}' \
- /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// curl -s -X POST -H 'Prefer: wait' \
+ /// -d '{"input": {"prompt": "A photo of a bear riding a bicycle over the moon"}}' \
+ /// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
/// -H 'Content-Type: application/json' \
- /// "https://api.replicate.com/v1/deployments/replicate/hello-world/predictions"
- /// ```
- /// The response will be the prediction object:
- /// ```json
- /// {
- /// "id": "86b6trbv99rgp0cf1h886f69ew",
- /// "model": "replicate/hello-world",
- /// "version": "dp-8e43d61c333b5ddc7a921130bc3ab3ea",
- /// "input": {
- /// "text": "Alice"
- /// },
- /// "logs": "",
- /// "error": null,
- /// "status": "starting",
- /// "created_at": "2024-04-23T18:55:52.138Z",
- /// "urls": {
- /// "cancel": "https://api.replicate.com/v1/predictions/86b6trbv99rgp0cf1h886f69ew/cancel",
- /// "get": "https://api.replicate.com/v1/predictions/86b6trbv99rgp0cf1h886f69ew"
- /// }
- /// }
+ /// https://api.replicate.com/v1/deployments/acme/my-app-image-generator/predictions
/// ```
- /// As models can take several seconds or more to run, the output will not be available immediately. To get the final result of the prediction you should either provide a `webhook` HTTPS URL for us to call when the results are ready, or poll the [get a prediction](#predictions.get) endpoint until it has finished.
- /// Input and output (including any files) will be automatically deleted after an hour, so you must save a copy of any files in the output if you'd like to continue using them.
- /// Output files are served by `replicate.delivery` and its subdomains. If you use an allow list of external domains for your assets, add `replicate.delivery` and `*.replicate.delivery` to it. + /// The request will wait up to 60 seconds for the model to run. If this time is exceeded the prediction will be returned in a `"starting"` state and need to be retrieved using the `predictions.get` endpiont.
+ /// For a complete overview of the `deployments.predictions.create` API check out our documentation on [creating a prediction](https://replicate.com/docs/topics/predictions/create-a-prediction) which covers a variety of use cases. ///
/// /// + /// + /// Example: wait=5 + /// /// /// The token to cancel the operation with /// @@ -72,6 +49,7 @@ partial void ProcessCreatePredictionsDeploymentsResponse( string deploymentOwner, string deploymentName, global::G.PredictionRequest request, + string? prefer = default, global::System.Threading.CancellationToken cancellationToken = default) { request = request ?? throw new global::System.ArgumentNullException(nameof(request)); @@ -82,6 +60,7 @@ partial void ProcessCreatePredictionsDeploymentsResponse( httpClient: HttpClient, deploymentOwner: ref deploymentOwner, deploymentName: ref deploymentName, + prefer: ref prefer, request: request); var __pathBuilder = new PathBuilder( @@ -107,6 +86,12 @@ partial void ProcessCreatePredictionsDeploymentsResponse( __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); } } + + if (prefer != default) + { + __httpRequest.Headers.TryAddWithoutValidation("Prefer", prefer.ToString()); + } + var __httpRequestContentBody = request.ToJson(JsonSerializerOptions); var __httpRequestContent = new global::System.Net.Http.StringContent( content: __httpRequestContentBody, @@ -122,6 +107,7 @@ partial void ProcessCreatePredictionsDeploymentsResponse( httpRequestMessage: __httpRequest, deploymentOwner: deploymentOwner, deploymentName: deploymentName, + prefer: prefer, request: request); using var __response = await HttpClient.SendAsync( @@ -156,48 +142,23 @@ partial void ProcessCreatePredictionsDeploymentsResponse( /// /// Create a prediction using a deployment
- /// Start a new prediction for a deployment of a model using inputs you provide.
- /// Example request body:
- /// ```json
- /// {
- /// "input": {
- /// "text": "Alice"
- /// }
- /// }
- /// ```
+ /// Create a prediction for the deployment and inputs you provide.
/// Example cURL request:
/// ```console
- /// curl -s -X POST \
- /// -d '{"input": {"text": "Alice"}}' \
- /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// curl -s -X POST -H 'Prefer: wait' \
+ /// -d '{"input": {"prompt": "A photo of a bear riding a bicycle over the moon"}}' \
+ /// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
/// -H 'Content-Type: application/json' \
- /// "https://api.replicate.com/v1/deployments/replicate/hello-world/predictions"
+ /// https://api.replicate.com/v1/deployments/acme/my-app-image-generator/predictions
/// ```
- /// The response will be the prediction object:
- /// ```json
- /// {
- /// "id": "86b6trbv99rgp0cf1h886f69ew",
- /// "model": "replicate/hello-world",
- /// "version": "dp-8e43d61c333b5ddc7a921130bc3ab3ea",
- /// "input": {
- /// "text": "Alice"
- /// },
- /// "logs": "",
- /// "error": null,
- /// "status": "starting",
- /// "created_at": "2024-04-23T18:55:52.138Z",
- /// "urls": {
- /// "cancel": "https://api.replicate.com/v1/predictions/86b6trbv99rgp0cf1h886f69ew/cancel",
- /// "get": "https://api.replicate.com/v1/predictions/86b6trbv99rgp0cf1h886f69ew"
- /// }
- /// }
- /// ```
- /// As models can take several seconds or more to run, the output will not be available immediately. To get the final result of the prediction you should either provide a `webhook` HTTPS URL for us to call when the results are ready, or poll the [get a prediction](#predictions.get) endpoint until it has finished.
- /// Input and output (including any files) will be automatically deleted after an hour, so you must save a copy of any files in the output if you'd like to continue using them.
- /// Output files are served by `replicate.delivery` and its subdomains. If you use an allow list of external domains for your assets, add `replicate.delivery` and `*.replicate.delivery` to it. + /// The request will wait up to 60 seconds for the model to run. If this time is exceeded the prediction will be returned in a `"starting"` state and need to be retrieved using the `predictions.get` endpiont.
+ /// For a complete overview of the `deployments.predictions.create` API check out our documentation on [creating a prediction](https://replicate.com/docs/topics/predictions/create-a-prediction) which covers a variety of use cases. ///
/// /// + /// + /// Example: wait=5 + /// /// /// The model's input as a JSON object. The input schema depends on what model you are running. To see the available inputs, click the "API" tab on the model you are running or [get the model version](#models.versions.get) and look at its `openapi_schema` property. For example, [stability-ai/sdxl](https://replicate.com/stability-ai/sdxl) takes `prompt` as an input.
/// Files should be passed as HTTP URLs or data URLs.
@@ -242,6 +203,7 @@ partial void ProcessCreatePredictionsDeploymentsResponse( string deploymentOwner, string deploymentName, object input, + string? prefer = default, bool? stream = default, string? webhook = default, global::System.Collections.Generic.IList? webhookEventsFilter = default, @@ -258,6 +220,7 @@ partial void ProcessCreatePredictionsDeploymentsResponse( await CreatePredictionsDeploymentsAsync( deploymentOwner: deploymentOwner, deploymentName: deploymentName, + prefer: prefer, request: __request, cancellationToken: cancellationToken).ConfigureAwait(false); } diff --git a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.Api.CreatePredictionsModels.g.verified.cs b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.Api.CreatePredictionsModels.g.verified.cs index c2fc51d105..94ddf78e95 100644 --- a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.Api.CreatePredictionsModels.g.verified.cs +++ b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.Api.CreatePredictionsModels.g.verified.cs @@ -10,73 +10,46 @@ partial void PrepareCreatePredictionsModelsArguments( global::System.Net.Http.HttpClient httpClient, ref string modelOwner, ref string modelName, + ref string? prefer, global::G.PredictionRequest request); partial void PrepareCreatePredictionsModelsRequest( global::System.Net.Http.HttpClient httpClient, global::System.Net.Http.HttpRequestMessage httpRequestMessage, string modelOwner, string modelName, + string? prefer, global::G.PredictionRequest request); partial void ProcessCreatePredictionsModelsResponse( global::System.Net.Http.HttpClient httpClient, global::System.Net.Http.HttpResponseMessage httpResponseMessage); - partial void ProcessCreatePredictionsModelsResponseContent( - global::System.Net.Http.HttpClient httpClient, - global::System.Net.Http.HttpResponseMessage httpResponseMessage, - ref string content); - /// /// Create a prediction using an official model
- /// Start a new prediction for an official model using the inputs you provide.
- /// Example request body:
- /// ```json
- /// {
- /// "input": {
- /// "prompt": "Write a short poem about the weather."
- /// }
- /// }
- /// ```
+ /// Create a prediction for the deployment and inputs you provide.
/// Example cURL request:
/// ```console
- /// curl -s -X POST \
+ /// curl -s -X POST -H 'Prefer: wait' \
/// -d '{"input": {"prompt": "Write a short poem about the weather."}}' \
- /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
/// -H 'Content-Type: application/json' \
/// https://api.replicate.com/v1/models/meta/meta-llama-3-70b-instruct/predictions
/// ```
- /// The response will be the prediction object:
- /// ```json
- /// {
- /// "id": "25s2s4n7rdrgg0cf1httb3myk0",
- /// "model": "replicate-internal/llama3-70b-chat-vllm-unquantized",
- /// "version": "dp-cf04fe09351e25db628e8b6181276547",
- /// "input": {
- /// "prompt": "Write a short poem about the weather."
- /// },
- /// "logs": "",
- /// "error": null,
- /// "status": "starting",
- /// "created_at": "2024-04-23T19:36:28.355Z",
- /// "urls": {
- /// "cancel": "https://api.replicate.com/v1/predictions/25s2s4n7rdrgg0cf1httb3myk0/cancel",
- /// "get": "https://api.replicate.com/v1/predictions/25s2s4n7rdrgg0cf1httb3myk0"
- /// }
- /// }
- /// ```
- /// As models can take several seconds or more to run, the output will not be available immediately. To get the final result of the prediction you should either provide a `webhook` HTTPS URL for us to call when the results are ready, or poll the [get a prediction](#predictions.get) endpoint until it has finished.
- /// All input parameters, output values, and logs are automatically removed after an hour, by default, for predictions created through the API.
- /// Output files are served by `replicate.delivery` and its subdomains. If you use an allow list of external domains for your assets, add `replicate.delivery` and `*.replicate.delivery` to it. + /// The request will wait up to 60 seconds for the model to run. If this time is exceeded the prediction will be returned in a `"starting"` state and need to be retrieved using the `predictions.get` endpiont.
+ /// For a complete overview of the `deployments.predictions.create` API check out our documentation on [creating a prediction](https://replicate.com/docs/topics/predictions/create-a-prediction) which covers a variety of use cases. ///
/// /// + /// + /// Example: wait=5 + /// /// /// The token to cancel the operation with /// - public async global::System.Threading.Tasks.Task CreatePredictionsModelsAsync( + public async global::System.Threading.Tasks.Task CreatePredictionsModelsAsync( string modelOwner, string modelName, global::G.PredictionRequest request, + string? prefer = default, global::System.Threading.CancellationToken cancellationToken = default) { request = request ?? throw new global::System.ArgumentNullException(nameof(request)); @@ -87,6 +60,7 @@ partial void ProcessCreatePredictionsModelsResponseContent( httpClient: HttpClient, modelOwner: ref modelOwner, modelName: ref modelName, + prefer: ref prefer, request: request); var __pathBuilder = new PathBuilder( @@ -112,6 +86,12 @@ partial void ProcessCreatePredictionsModelsResponseContent( __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); } } + + if (prefer != default) + { + __httpRequest.Headers.TryAddWithoutValidation("Prefer", prefer.ToString()); + } + var __httpRequestContentBody = request.ToJson(JsonSerializerOptions); var __httpRequestContent = new global::System.Net.Http.StringContent( content: __httpRequestContentBody, @@ -127,6 +107,7 @@ partial void ProcessCreatePredictionsModelsResponseContent( httpRequestMessage: __httpRequest, modelOwner: modelOwner, modelName: modelName, + prefer: prefer, request: request); using var __response = await HttpClient.SendAsync( @@ -140,117 +121,44 @@ partial void ProcessCreatePredictionsModelsResponseContent( ProcessCreatePredictionsModelsResponse( httpClient: HttpClient, httpResponseMessage: __response); - - if (ReadResponseAsString) + try { - var __content = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - - ProcessResponseContent( - client: HttpClient, - response: __response, - content: ref __content); - ProcessCreatePredictionsModelsResponseContent( - httpClient: HttpClient, - httpResponseMessage: __response, - content: ref __content); - - try - { - __response.EnsureSuccessStatusCode(); - } - catch (global::System.Net.Http.HttpRequestException __ex) - { - throw new global::G.ApiException( - message: __content ?? __response.ReasonPhrase ?? string.Empty, - innerException: __ex, - statusCode: __response.StatusCode) - { - ResponseBody = __content, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - - return - global::G.PredictionResponse.FromJson(__content, JsonSerializerOptions) ?? - throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + __response.EnsureSuccessStatusCode(); } - else + catch (global::System.Net.Http.HttpRequestException __ex) { - try - { - __response.EnsureSuccessStatusCode(); - } - catch (global::System.Net.Http.HttpRequestException __ex) + throw new global::G.ApiException( + message: __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + statusCode: __response.StatusCode) { - throw new global::G.ApiException( - message: __response.ReasonPhrase ?? string.Empty, - innerException: __ex, - statusCode: __response.StatusCode) - { - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - - using var __responseStream = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - - var __responseValue = await global::G.PredictionResponse.FromJsonStreamAsync(__responseStream, JsonSerializerOptions).ConfigureAwait(false); - - return - __responseValue ?? - throw new global::System.InvalidOperationException("Response deserialization failed."); + ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value), + }; } } /// /// Create a prediction using an official model
- /// Start a new prediction for an official model using the inputs you provide.
- /// Example request body:
- /// ```json
- /// {
- /// "input": {
- /// "prompt": "Write a short poem about the weather."
- /// }
- /// }
- /// ```
+ /// Create a prediction for the deployment and inputs you provide.
/// Example cURL request:
/// ```console
- /// curl -s -X POST \
+ /// curl -s -X POST -H 'Prefer: wait' \
/// -d '{"input": {"prompt": "Write a short poem about the weather."}}' \
- /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
/// -H 'Content-Type: application/json' \
/// https://api.replicate.com/v1/models/meta/meta-llama-3-70b-instruct/predictions
/// ```
- /// The response will be the prediction object:
- /// ```json
- /// {
- /// "id": "25s2s4n7rdrgg0cf1httb3myk0",
- /// "model": "replicate-internal/llama3-70b-chat-vllm-unquantized",
- /// "version": "dp-cf04fe09351e25db628e8b6181276547",
- /// "input": {
- /// "prompt": "Write a short poem about the weather."
- /// },
- /// "logs": "",
- /// "error": null,
- /// "status": "starting",
- /// "created_at": "2024-04-23T19:36:28.355Z",
- /// "urls": {
- /// "cancel": "https://api.replicate.com/v1/predictions/25s2s4n7rdrgg0cf1httb3myk0/cancel",
- /// "get": "https://api.replicate.com/v1/predictions/25s2s4n7rdrgg0cf1httb3myk0"
- /// }
- /// }
- /// ```
- /// As models can take several seconds or more to run, the output will not be available immediately. To get the final result of the prediction you should either provide a `webhook` HTTPS URL for us to call when the results are ready, or poll the [get a prediction](#predictions.get) endpoint until it has finished.
- /// All input parameters, output values, and logs are automatically removed after an hour, by default, for predictions created through the API.
- /// Output files are served by `replicate.delivery` and its subdomains. If you use an allow list of external domains for your assets, add `replicate.delivery` and `*.replicate.delivery` to it. + /// The request will wait up to 60 seconds for the model to run. If this time is exceeded the prediction will be returned in a `"starting"` state and need to be retrieved using the `predictions.get` endpiont.
+ /// For a complete overview of the `deployments.predictions.create` API check out our documentation on [creating a prediction](https://replicate.com/docs/topics/predictions/create-a-prediction) which covers a variety of use cases. ///
/// /// + /// + /// Example: wait=5 + /// /// /// The model's input as a JSON object. The input schema depends on what model you are running. To see the available inputs, click the "API" tab on the model you are running or [get the model version](#models.versions.get) and look at its `openapi_schema` property. For example, [stability-ai/sdxl](https://replicate.com/stability-ai/sdxl) takes `prompt` as an input.
/// Files should be passed as HTTP URLs or data URLs.
@@ -291,10 +199,11 @@ partial void ProcessCreatePredictionsModelsResponseContent( /// /// The token to cancel the operation with /// - public async global::System.Threading.Tasks.Task CreatePredictionsModelsAsync( + public async global::System.Threading.Tasks.Task CreatePredictionsModelsAsync( string modelOwner, string modelName, object input, + string? prefer = default, bool? stream = default, string? webhook = default, global::System.Collections.Generic.IList? webhookEventsFilter = default, @@ -308,9 +217,10 @@ partial void ProcessCreatePredictionsModelsResponseContent( WebhookEventsFilter = webhookEventsFilter, }; - return await CreatePredictionsModelsAsync( + await CreatePredictionsModelsAsync( modelOwner: modelOwner, modelName: modelName, + prefer: prefer, request: __request, cancellationToken: cancellationToken).ConfigureAwait(false); } diff --git a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.Api.CreateTrainings.g.verified.cs b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.Api.CreateTrainings.g.verified.cs index bc49b37042..55faed1530 100644 --- a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.Api.CreateTrainings.g.verified.cs +++ b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.Api.CreateTrainings.g.verified.cs @@ -40,7 +40,7 @@ partial void ProcessCreateTrainingsResponse( /// ```console
/// curl -s -X POST \
/// -d '{"destination": "{new_owner}/{new_name}", "input": {"input_images": "https://example.com/my-input-images.zip"}}' \
- /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
/// -H 'Content-Type: application/json' \
/// https://api.replicate.com/v1/models/stability-ai/sdxl/versions/da77bc59ee60423279fd632efb4795ab731d9e3ca9705ef3341091fb989b7eaf/trainings
/// ```
@@ -179,7 +179,7 @@ partial void ProcessCreateTrainingsResponse( /// ```console
/// curl -s -X POST \
/// -d '{"destination": "{new_owner}/{new_name}", "input": {"input_images": "https://example.com/my-input-images.zip"}}' \
- /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
/// -H 'Content-Type: application/json' \
/// https://api.replicate.com/v1/models/stability-ai/sdxl/versions/da77bc59ee60423279fd632efb4795ab731d9e3ca9705ef3341091fb989b7eaf/trainings
/// ```
diff --git a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.Api.DeleteDeployments.g.verified.cs b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.Api.DeleteDeployments.g.verified.cs index ee6f5e4526..01db3c760a 100644 --- a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.Api.DeleteDeployments.g.verified.cs +++ b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.Api.DeleteDeployments.g.verified.cs @@ -27,7 +27,7 @@ partial void ProcessDeleteDeploymentsResponse( /// Example cURL request:
/// ```command
/// curl -s -X DELETE \
- /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
/// https://api.replicate.com/v1/deployments/acme/my-app-image-generator
/// ```
/// The response will be an empty 204, indicating the deployment has been deleted. diff --git a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.Api.DeleteModels.g.verified.cs b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.Api.DeleteModels.g.verified.cs index 098ae68aa1..fdfcc5a6ff 100644 --- a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.Api.DeleteModels.g.verified.cs +++ b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.Api.DeleteModels.g.verified.cs @@ -29,7 +29,7 @@ partial void ProcessDeleteModelsResponse( /// Example cURL request:
/// ```command
/// curl -s -X DELETE \
- /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
/// https://api.replicate.com/v1/models/replicate/hello-world
/// ```
/// The response will be an empty 204, indicating the model has been deleted. diff --git a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.Api.DeleteVersionsModels.g.verified.cs b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.Api.DeleteVersionsModels.g.verified.cs index 7c00782f58..7114eefc97 100644 --- a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.Api.DeleteVersionsModels.g.verified.cs +++ b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.Api.DeleteVersionsModels.g.verified.cs @@ -34,7 +34,7 @@ partial void ProcessDeleteVersionsModelsResponse( /// Example cURL request:
/// ```command
/// curl -s -X DELETE \
- /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
/// https://api.replicate.com/v1/models/replicate/hello-world/versions/5c7d5dc6dd8bf75c1acaa8565735e7986bc5b66206b55cca93cb72c9bf15ccaa
/// ```
/// The response will be an empty 202, indicating the deletion request has been accepted. It might take a few minutes to be processed. diff --git a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.Api.GetAccount.g.verified.cs b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.Api.GetAccount.g.verified.cs index 9322a31b3e..de2993c7c4 100644 --- a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.Api.GetAccount.g.verified.cs +++ b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.Api.GetAccount.g.verified.cs @@ -26,7 +26,7 @@ partial void ProcessGetAccountResponseContent( /// Example cURL request:
/// ```console
/// curl -s \
- /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
/// https://api.replicate.com/v1/account
/// ```
/// The response will be a JSON object describing the account:
diff --git a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.Api.GetCollections.g.verified.cs b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.Api.GetCollections.g.verified.cs index a58811b50b..dab7f78ba7 100644 --- a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.Api.GetCollections.g.verified.cs +++ b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.Api.GetCollections.g.verified.cs @@ -22,7 +22,7 @@ partial void ProcessGetCollectionsResponse( /// Example cURL request:
/// ```console
/// curl -s \
- /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
/// https://api.replicate.com/v1/collections/super-resolution
/// ```
/// The response will be a collection object with a nested list of the models in that collection:
diff --git a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.Api.GetDeployments.g.verified.cs b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.Api.GetDeployments.g.verified.cs index b1d4992f2e..6e160a09a2 100644 --- a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.Api.GetDeployments.g.verified.cs +++ b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.Api.GetDeployments.g.verified.cs @@ -30,7 +30,7 @@ partial void ProcessGetDeploymentsResponseContent( /// Example cURL request:
/// ```console
/// curl -s \
- /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
/// https://api.replicate.com/v1/deployments/replicate/my-app-image-generator
/// ```
/// The response will be a JSON object describing the deployment:
diff --git a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.Api.GetModels.g.verified.cs b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.Api.GetModels.g.verified.cs index f75dc65d53..cc34525938 100644 --- a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.Api.GetModels.g.verified.cs +++ b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.Api.GetModels.g.verified.cs @@ -24,7 +24,7 @@ partial void ProcessGetModelsResponse( /// Example cURL request:
/// ```console
/// curl -s \
- /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
/// https://api.replicate.com/v1/models/replicate/hello-world
/// ```
/// The response will be a model object in the following format:
diff --git a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.Api.GetPredictions.g.verified.cs b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.Api.GetPredictions.g.verified.cs index d618df9970..53033e414d 100644 --- a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.Api.GetPredictions.g.verified.cs +++ b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.Api.GetPredictions.g.verified.cs @@ -17,18 +17,13 @@ partial void ProcessGetPredictionsResponse( global::System.Net.Http.HttpClient httpClient, global::System.Net.Http.HttpResponseMessage httpResponseMessage); - partial void ProcessGetPredictionsResponseContent( - global::System.Net.Http.HttpClient httpClient, - global::System.Net.Http.HttpResponseMessage httpResponseMessage, - ref string content); - /// /// Get a prediction
/// Get the current state of a prediction.
/// Example cURL request:
/// ```console
/// curl -s \
- /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
/// https://api.replicate.com/v1/predictions/gm3qorzdhgbfurvjtvhg6dckhu
/// ```
/// The response will be the prediction object:
@@ -73,7 +68,7 @@ partial void ProcessGetPredictionsResponseContent( /// /// The token to cancel the operation with /// - public async global::System.Threading.Tasks.Task GetPredictionsAsync( + public async global::System.Threading.Tasks.Task GetPredictionsAsync( string predictionId, global::System.Threading.CancellationToken cancellationToken = default) { @@ -126,70 +121,22 @@ partial void ProcessGetPredictionsResponseContent( ProcessGetPredictionsResponse( httpClient: HttpClient, httpResponseMessage: __response); - - if (ReadResponseAsString) + try { - var __content = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - - ProcessResponseContent( - client: HttpClient, - response: __response, - content: ref __content); - ProcessGetPredictionsResponseContent( - httpClient: HttpClient, - httpResponseMessage: __response, - content: ref __content); - - try - { - __response.EnsureSuccessStatusCode(); - } - catch (global::System.Net.Http.HttpRequestException __ex) - { - throw new global::G.ApiException( - message: __content ?? __response.ReasonPhrase ?? string.Empty, - innerException: __ex, - statusCode: __response.StatusCode) - { - ResponseBody = __content, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - - return - global::G.PredictionResponse.FromJson(__content, JsonSerializerOptions) ?? - throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + __response.EnsureSuccessStatusCode(); } - else + catch (global::System.Net.Http.HttpRequestException __ex) { - try - { - __response.EnsureSuccessStatusCode(); - } - catch (global::System.Net.Http.HttpRequestException __ex) + throw new global::G.ApiException( + message: __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + statusCode: __response.StatusCode) { - throw new global::G.ApiException( - message: __response.ReasonPhrase ?? string.Empty, - innerException: __ex, - statusCode: __response.StatusCode) - { - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - - using var __responseStream = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - - var __responseValue = await global::G.PredictionResponse.FromJsonStreamAsync(__responseStream, JsonSerializerOptions).ConfigureAwait(false); - - return - __responseValue ?? - throw new global::System.InvalidOperationException("Response deserialization failed."); + ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value), + }; } } } diff --git a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.Api.GetSecretDefaultWebhooks.g.verified.cs b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.Api.GetSecretDefaultWebhooks.g.verified.cs index 070eb0b557..7c19dcfc98 100644 --- a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.Api.GetSecretDefaultWebhooks.g.verified.cs +++ b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.Api.GetSecretDefaultWebhooks.g.verified.cs @@ -26,7 +26,7 @@ partial void ProcessGetSecretDefaultWebhooksResponseContent( /// Example cURL request:
/// ```console
/// curl -s \
- /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
/// https://api.replicate.com/v1/webhooks/default/secret
/// ```
/// The response will be a JSON object with a `key` property:
diff --git a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.Api.GetTrainings.g.verified.cs b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.Api.GetTrainings.g.verified.cs index 742366f625..4f9076d543 100644 --- a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.Api.GetTrainings.g.verified.cs +++ b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.Api.GetTrainings.g.verified.cs @@ -23,7 +23,7 @@ partial void ProcessGetTrainingsResponse( /// Example cURL request:
/// ```console
/// curl -s \
- /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
/// https://api.replicate.com/v1/trainings/zz4ibbonubfz7carwiefibzgga
/// ```
/// The response will be the training object:
diff --git a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.Api.GetVersionsModels.g.verified.cs b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.Api.GetVersionsModels.g.verified.cs index c3bd14938e..3278c2f990 100644 --- a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.Api.GetVersionsModels.g.verified.cs +++ b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.Api.GetVersionsModels.g.verified.cs @@ -26,7 +26,7 @@ partial void ProcessGetVersionsModelsResponse( /// Example cURL request:
/// ```console
/// curl -s \
- /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
/// https://api.replicate.com/v1/models/replicate/hello-world/versions/5c7d5dc6dd8bf75c1acaa8565735e7986bc5b66206b55cca93cb72c9bf15ccaa
/// ```
/// The response will be the version object:
diff --git a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.Api.ListCollections.g.verified.cs b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.Api.ListCollections.g.verified.cs index dddd5b6e50..7abd9d48a6 100644 --- a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.Api.ListCollections.g.verified.cs +++ b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.Api.ListCollections.g.verified.cs @@ -20,7 +20,7 @@ partial void ProcessListCollectionsResponse( /// Example cURL request:
/// ```console
/// curl -s \
- /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
/// https://api.replicate.com/v1/collections
/// ```
/// The response will be a paginated JSON list of collection objects:
diff --git a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.Api.ListDeployments.g.verified.cs b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.Api.ListDeployments.g.verified.cs index e3a33e724d..f97bb9f44a 100644 --- a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.Api.ListDeployments.g.verified.cs +++ b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.Api.ListDeployments.g.verified.cs @@ -26,7 +26,7 @@ partial void ProcessListDeploymentsResponseContent( /// Example cURL request:
/// ```console
/// curl -s \
- /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
/// https://api.replicate.com/v1/deployments
/// ```
/// The response will be a paginated JSON array of deployment objects, sorted with the most recent deployment first:
diff --git a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.Api.ListHardware.g.verified.cs b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.Api.ListHardware.g.verified.cs index 24b3b70176..57ebb6633e 100644 --- a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.Api.ListHardware.g.verified.cs +++ b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.Api.ListHardware.g.verified.cs @@ -25,7 +25,7 @@ partial void ProcessListHardwareResponseContent( /// Example cURL request:
/// ```console
/// curl -s \
- /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
/// https://api.replicate.com/v1/hardware
/// ```
/// The response will be a JSON array of hardware objects:
diff --git a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.Api.ListModels.g.verified.cs b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.Api.ListModels.g.verified.cs index f533bc1a14..683e036c97 100644 --- a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.Api.ListModels.g.verified.cs +++ b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.Api.ListModels.g.verified.cs @@ -21,7 +21,7 @@ partial void ProcessListModelsResponse( /// Example cURL request:
/// ```console
/// curl -s \
- /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
/// https://api.replicate.com/v1/models
/// ```
/// The response will be a paginated JSON array of model objects:
diff --git a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.Api.ListPredictions.g.verified.cs b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.Api.ListPredictions.g.verified.cs index 4f3af29812..6af6826314 100644 --- a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.Api.ListPredictions.g.verified.cs +++ b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.Api.ListPredictions.g.verified.cs @@ -21,7 +21,7 @@ partial void ProcessListPredictionsResponse( /// Example cURL request:
/// ```console
/// curl -s \
- /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
/// https://api.replicate.com/v1/predictions
/// ```
/// The response will be a paginated JSON array of prediction objects, sorted with the most recent prediction first:
diff --git a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.Api.ListTrainings.g.verified.cs b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.Api.ListTrainings.g.verified.cs index 1fd36db3ac..7152d7088b 100644 --- a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.Api.ListTrainings.g.verified.cs +++ b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.Api.ListTrainings.g.verified.cs @@ -21,7 +21,7 @@ partial void ProcessListTrainingsResponse( /// Example cURL request:
/// ```console
/// curl -s \
- /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
/// https://api.replicate.com/v1/trainings
/// ```
/// The response will be a paginated JSON array of training objects, sorted with the most recent training first:
diff --git a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.Api.ListVersionsModels.g.verified.cs b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.Api.ListVersionsModels.g.verified.cs index 950f64fd16..789d27045e 100644 --- a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.Api.ListVersionsModels.g.verified.cs +++ b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.Api.ListVersionsModels.g.verified.cs @@ -24,7 +24,7 @@ partial void ProcessListVersionsModelsResponse( /// Example cURL request:
/// ```console
/// curl -s \
- /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
/// https://api.replicate.com/v1/models/replicate/hello-world/versions
/// ```
/// The response will be a JSON array of model version objects, sorted with the most recent version first:
diff --git a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.Api.UpdateDeployments.g.verified.cs b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.Api.UpdateDeployments.g.verified.cs index 640f29e461..4ee4c4b84b 100644 --- a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.Api.UpdateDeployments.g.verified.cs +++ b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.Api.UpdateDeployments.g.verified.cs @@ -33,7 +33,7 @@ partial void ProcessUpdateDeploymentsResponseContent( /// ```console
/// curl -s \
/// -X PATCH \
- /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
/// -H "Content-Type: application/json" \
/// -d '{"min_instances": 3, "max_instances": 10}' \
/// https://api.replicate.com/v1/deployments/acme/my-app-image-generator
@@ -210,7 +210,7 @@ partial void ProcessUpdateDeploymentsResponseContent( /// ```console
/// curl -s \
/// -X PATCH \
- /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
/// -H "Content-Type: application/json" \
/// -d '{"min_instances": 3, "max_instances": 10}' \
/// https://api.replicate.com/v1/deployments/acme/my-app-image-generator
diff --git a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.IApi.CreateDeployments.g.verified.cs b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.IApi.CreateDeployments.g.verified.cs index fdefcdf686..57275382b7 100644 --- a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.IApi.CreateDeployments.g.verified.cs +++ b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.IApi.CreateDeployments.g.verified.cs @@ -12,7 +12,7 @@ public partial interface IApi /// ```console
/// curl -s \
/// -X POST \
- /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
/// -H "Content-Type: application/json" \
/// -d '{
/// "name": "my-app-image-generator",
@@ -63,7 +63,7 @@ public partial interface IApi /// ```console
/// curl -s \
/// -X POST \
- /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
/// -H "Content-Type: application/json" \
/// -d '{
/// "name": "my-app-image-generator",
diff --git a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.IApi.CreateModels.g.verified.cs b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.IApi.CreateModels.g.verified.cs index 44d5ae4704..3b721c600d 100644 --- a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.IApi.CreateModels.g.verified.cs +++ b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.IApi.CreateModels.g.verified.cs @@ -11,7 +11,7 @@ public partial interface IApi /// Example cURL request:
/// ```console
/// curl -s -X POST \
- /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
/// -H 'Content-Type: application/json' \
/// -d '{"owner": "alice", "name": "my-model", "description": "An example model", "visibility": "public", "hardware": "cpu"}' \
/// https://api.replicate.com/v1/models
@@ -48,7 +48,7 @@ public partial interface IApi /// Example cURL request:
/// ```console
/// curl -s -X POST \
- /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
/// -H 'Content-Type: application/json' \
/// -d '{"owner": "alice", "name": "my-model", "description": "An example model", "visibility": "public", "hardware": "cpu"}' \
/// https://api.replicate.com/v1/models
diff --git a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.IApi.CreatePredictions.g.verified.cs b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.IApi.CreatePredictions.g.verified.cs index a0250facf3..15227106d7 100644 --- a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.IApi.CreatePredictions.g.verified.cs +++ b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.IApi.CreatePredictions.g.verified.cs @@ -7,99 +7,46 @@ public partial interface IApi { /// /// Create a prediction
- /// Start a new prediction for the model version and inputs you provide.
- /// Example request body:
- /// ```json
- /// {
- /// "version": "5c7d5dc6dd8bf75c1acaa8565735e7986bc5b66206b55cca93cb72c9bf15ccaa",
- /// "input": {
- /// "text": "Alice"
- /// }
- /// }
- /// ```
+ /// Create a prediction for the model version and inputs you provide.
/// Example cURL request:
/// ```console
- /// curl -s -X POST \
+ /// curl -s -X POST -H 'Prefer: wait' \
/// -d '{"version": "5c7d5dc6dd8bf75c1acaa8565735e7986bc5b66206b55cca93cb72c9bf15ccaa", "input": {"text": "Alice"}}' \
- /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
/// -H 'Content-Type: application/json' \
/// https://api.replicate.com/v1/predictions
/// ```
- /// The response will be the prediction object:
- /// ```json
- /// {
- /// "id": "gm3qorzdhgbfurvjtvhg6dckhu",
- /// "model": "replicate/hello-world",
- /// "version": "5c7d5dc6dd8bf75c1acaa8565735e7986bc5b66206b55cca93cb72c9bf15ccaa",
- /// "input": {
- /// "text": "Alice"
- /// },
- /// "output": null,
- /// "logs": "",
- /// "error": null,
- /// "status": "starting",
- /// "created_at": "2023-09-08T16:19:34.765994657Z",
- /// "urls": {
- /// "cancel": "https://api.replicate.com/v1/predictions/gm3qorzdhgbfurvjtvhg6dckhu/cancel",
- /// "get": "https://api.replicate.com/v1/predictions/gm3qorzdhgbfurvjtvhg6dckhu"
- /// }
- /// }
- /// ```
- /// As models can take several seconds or more to run, the output will not be available immediately. To get the final result of the prediction you should either provide a `webhook` HTTPS URL for us to call when the results are ready, or poll the [get a prediction](#predictions.get) endpoint until it has finished.
- /// Input and output (including any files) will be automatically deleted after an hour, so you must save a copy of any files in the output if you'd like to continue using them.
- /// Output files are served by `replicate.delivery` and its subdomains. If you use an allow list of external domains for your assets, add `replicate.delivery` and `*.replicate.delivery` to it. + /// The request will wait up to 60 seconds for the model to run. If this time is exceeded the prediction will be returned in a `"starting"` state and need to be retrieved using the `predictions.get` endpiont.
+ /// For a complete overview of the `predictions.create` API check out our documentation on [creating a prediction](https://replicate.com/docs/topics/predictions/create-a-prediction) which covers a variety of use cases. ///
+ /// + /// Example: wait=5 + /// /// /// The token to cancel the operation with /// global::System.Threading.Tasks.Task CreatePredictionsAsync( global::G.VersionPredictionRequest request, + string? prefer = default, global::System.Threading.CancellationToken cancellationToken = default); /// /// Create a prediction
- /// Start a new prediction for the model version and inputs you provide.
- /// Example request body:
- /// ```json
- /// {
- /// "version": "5c7d5dc6dd8bf75c1acaa8565735e7986bc5b66206b55cca93cb72c9bf15ccaa",
- /// "input": {
- /// "text": "Alice"
- /// }
- /// }
- /// ```
+ /// Create a prediction for the model version and inputs you provide.
/// Example cURL request:
/// ```console
- /// curl -s -X POST \
+ /// curl -s -X POST -H 'Prefer: wait' \
/// -d '{"version": "5c7d5dc6dd8bf75c1acaa8565735e7986bc5b66206b55cca93cb72c9bf15ccaa", "input": {"text": "Alice"}}' \
- /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
/// -H 'Content-Type: application/json' \
/// https://api.replicate.com/v1/predictions
/// ```
- /// The response will be the prediction object:
- /// ```json
- /// {
- /// "id": "gm3qorzdhgbfurvjtvhg6dckhu",
- /// "model": "replicate/hello-world",
- /// "version": "5c7d5dc6dd8bf75c1acaa8565735e7986bc5b66206b55cca93cb72c9bf15ccaa",
- /// "input": {
- /// "text": "Alice"
- /// },
- /// "output": null,
- /// "logs": "",
- /// "error": null,
- /// "status": "starting",
- /// "created_at": "2023-09-08T16:19:34.765994657Z",
- /// "urls": {
- /// "cancel": "https://api.replicate.com/v1/predictions/gm3qorzdhgbfurvjtvhg6dckhu/cancel",
- /// "get": "https://api.replicate.com/v1/predictions/gm3qorzdhgbfurvjtvhg6dckhu"
- /// }
- /// }
- /// ```
- /// As models can take several seconds or more to run, the output will not be available immediately. To get the final result of the prediction you should either provide a `webhook` HTTPS URL for us to call when the results are ready, or poll the [get a prediction](#predictions.get) endpoint until it has finished.
- /// Input and output (including any files) will be automatically deleted after an hour, so you must save a copy of any files in the output if you'd like to continue using them.
- /// Output files are served by `replicate.delivery` and its subdomains. If you use an allow list of external domains for your assets, add `replicate.delivery` and `*.replicate.delivery` to it. + /// The request will wait up to 60 seconds for the model to run. If this time is exceeded the prediction will be returned in a `"starting"` state and need to be retrieved using the `predictions.get` endpiont.
+ /// For a complete overview of the `predictions.create` API check out our documentation on [creating a prediction](https://replicate.com/docs/topics/predictions/create-a-prediction) which covers a variety of use cases. ///
+ /// + /// Example: wait=5 + /// /// /// The model's input as a JSON object. The input schema depends on what model you are running. To see the available inputs, click the "API" tab on the model you are running or [get the model version](#models.versions.get) and look at its `openapi_schema` property. For example, [stability-ai/sdxl](https://replicate.com/stability-ai/sdxl) takes `prompt` as an input.
/// Files should be passed as HTTP URLs or data URLs.
@@ -147,6 +94,7 @@ public partial interface IApi global::System.Threading.Tasks.Task CreatePredictionsAsync( object input, string version, + string? prefer = default, bool? stream = default, string? webhook = default, global::System.Collections.Generic.IList? webhookEventsFilter = default, diff --git a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.IApi.CreatePredictionsDeployments.g.verified.cs b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.IApi.CreatePredictionsDeployments.g.verified.cs index 75eb561b03..4c61f97df8 100644 --- a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.IApi.CreatePredictionsDeployments.g.verified.cs +++ b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.IApi.CreatePredictionsDeployments.g.verified.cs @@ -7,48 +7,23 @@ public partial interface IApi { /// /// Create a prediction using a deployment
- /// Start a new prediction for a deployment of a model using inputs you provide.
- /// Example request body:
- /// ```json
- /// {
- /// "input": {
- /// "text": "Alice"
- /// }
- /// }
- /// ```
+ /// Create a prediction for the deployment and inputs you provide.
/// Example cURL request:
/// ```console
- /// curl -s -X POST \
- /// -d '{"input": {"text": "Alice"}}' \
- /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// curl -s -X POST -H 'Prefer: wait' \
+ /// -d '{"input": {"prompt": "A photo of a bear riding a bicycle over the moon"}}' \
+ /// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
/// -H 'Content-Type: application/json' \
- /// "https://api.replicate.com/v1/deployments/replicate/hello-world/predictions"
- /// ```
- /// The response will be the prediction object:
- /// ```json
- /// {
- /// "id": "86b6trbv99rgp0cf1h886f69ew",
- /// "model": "replicate/hello-world",
- /// "version": "dp-8e43d61c333b5ddc7a921130bc3ab3ea",
- /// "input": {
- /// "text": "Alice"
- /// },
- /// "logs": "",
- /// "error": null,
- /// "status": "starting",
- /// "created_at": "2024-04-23T18:55:52.138Z",
- /// "urls": {
- /// "cancel": "https://api.replicate.com/v1/predictions/86b6trbv99rgp0cf1h886f69ew/cancel",
- /// "get": "https://api.replicate.com/v1/predictions/86b6trbv99rgp0cf1h886f69ew"
- /// }
- /// }
+ /// https://api.replicate.com/v1/deployments/acme/my-app-image-generator/predictions
/// ```
- /// As models can take several seconds or more to run, the output will not be available immediately. To get the final result of the prediction you should either provide a `webhook` HTTPS URL for us to call when the results are ready, or poll the [get a prediction](#predictions.get) endpoint until it has finished.
- /// Input and output (including any files) will be automatically deleted after an hour, so you must save a copy of any files in the output if you'd like to continue using them.
- /// Output files are served by `replicate.delivery` and its subdomains. If you use an allow list of external domains for your assets, add `replicate.delivery` and `*.replicate.delivery` to it. + /// The request will wait up to 60 seconds for the model to run. If this time is exceeded the prediction will be returned in a `"starting"` state and need to be retrieved using the `predictions.get` endpiont.
+ /// For a complete overview of the `deployments.predictions.create` API check out our documentation on [creating a prediction](https://replicate.com/docs/topics/predictions/create-a-prediction) which covers a variety of use cases. ///
/// /// + /// + /// Example: wait=5 + /// /// /// The token to cancel the operation with /// @@ -56,52 +31,28 @@ public partial interface IApi string deploymentOwner, string deploymentName, global::G.PredictionRequest request, + string? prefer = default, global::System.Threading.CancellationToken cancellationToken = default); /// /// Create a prediction using a deployment
- /// Start a new prediction for a deployment of a model using inputs you provide.
- /// Example request body:
- /// ```json
- /// {
- /// "input": {
- /// "text": "Alice"
- /// }
- /// }
- /// ```
+ /// Create a prediction for the deployment and inputs you provide.
/// Example cURL request:
/// ```console
- /// curl -s -X POST \
- /// -d '{"input": {"text": "Alice"}}' \
- /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// curl -s -X POST -H 'Prefer: wait' \
+ /// -d '{"input": {"prompt": "A photo of a bear riding a bicycle over the moon"}}' \
+ /// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
/// -H 'Content-Type: application/json' \
- /// "https://api.replicate.com/v1/deployments/replicate/hello-world/predictions"
- /// ```
- /// The response will be the prediction object:
- /// ```json
- /// {
- /// "id": "86b6trbv99rgp0cf1h886f69ew",
- /// "model": "replicate/hello-world",
- /// "version": "dp-8e43d61c333b5ddc7a921130bc3ab3ea",
- /// "input": {
- /// "text": "Alice"
- /// },
- /// "logs": "",
- /// "error": null,
- /// "status": "starting",
- /// "created_at": "2024-04-23T18:55:52.138Z",
- /// "urls": {
- /// "cancel": "https://api.replicate.com/v1/predictions/86b6trbv99rgp0cf1h886f69ew/cancel",
- /// "get": "https://api.replicate.com/v1/predictions/86b6trbv99rgp0cf1h886f69ew"
- /// }
- /// }
+ /// https://api.replicate.com/v1/deployments/acme/my-app-image-generator/predictions
/// ```
- /// As models can take several seconds or more to run, the output will not be available immediately. To get the final result of the prediction you should either provide a `webhook` HTTPS URL for us to call when the results are ready, or poll the [get a prediction](#predictions.get) endpoint until it has finished.
- /// Input and output (including any files) will be automatically deleted after an hour, so you must save a copy of any files in the output if you'd like to continue using them.
- /// Output files are served by `replicate.delivery` and its subdomains. If you use an allow list of external domains for your assets, add `replicate.delivery` and `*.replicate.delivery` to it. + /// The request will wait up to 60 seconds for the model to run. If this time is exceeded the prediction will be returned in a `"starting"` state and need to be retrieved using the `predictions.get` endpiont.
+ /// For a complete overview of the `deployments.predictions.create` API check out our documentation on [creating a prediction](https://replicate.com/docs/topics/predictions/create-a-prediction) which covers a variety of use cases. ///
/// /// + /// + /// Example: wait=5 + /// /// /// The model's input as a JSON object. The input schema depends on what model you are running. To see the available inputs, click the "API" tab on the model you are running or [get the model version](#models.versions.get) and look at its `openapi_schema` property. For example, [stability-ai/sdxl](https://replicate.com/stability-ai/sdxl) takes `prompt` as an input.
/// Files should be passed as HTTP URLs or data URLs.
@@ -146,6 +97,7 @@ public partial interface IApi string deploymentOwner, string deploymentName, object input, + string? prefer = default, bool? stream = default, string? webhook = default, global::System.Collections.Generic.IList? webhookEventsFilter = default, diff --git a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.IApi.CreatePredictionsModels.g.verified.cs b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.IApi.CreatePredictionsModels.g.verified.cs index b27c6b833d..7e42e0c439 100644 --- a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.IApi.CreatePredictionsModels.g.verified.cs +++ b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.IApi.CreatePredictionsModels.g.verified.cs @@ -7,101 +7,52 @@ public partial interface IApi { /// /// Create a prediction using an official model
- /// Start a new prediction for an official model using the inputs you provide.
- /// Example request body:
- /// ```json
- /// {
- /// "input": {
- /// "prompt": "Write a short poem about the weather."
- /// }
- /// }
- /// ```
+ /// Create a prediction for the deployment and inputs you provide.
/// Example cURL request:
/// ```console
- /// curl -s -X POST \
+ /// curl -s -X POST -H 'Prefer: wait' \
/// -d '{"input": {"prompt": "Write a short poem about the weather."}}' \
- /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
/// -H 'Content-Type: application/json' \
/// https://api.replicate.com/v1/models/meta/meta-llama-3-70b-instruct/predictions
/// ```
- /// The response will be the prediction object:
- /// ```json
- /// {
- /// "id": "25s2s4n7rdrgg0cf1httb3myk0",
- /// "model": "replicate-internal/llama3-70b-chat-vllm-unquantized",
- /// "version": "dp-cf04fe09351e25db628e8b6181276547",
- /// "input": {
- /// "prompt": "Write a short poem about the weather."
- /// },
- /// "logs": "",
- /// "error": null,
- /// "status": "starting",
- /// "created_at": "2024-04-23T19:36:28.355Z",
- /// "urls": {
- /// "cancel": "https://api.replicate.com/v1/predictions/25s2s4n7rdrgg0cf1httb3myk0/cancel",
- /// "get": "https://api.replicate.com/v1/predictions/25s2s4n7rdrgg0cf1httb3myk0"
- /// }
- /// }
- /// ```
- /// As models can take several seconds or more to run, the output will not be available immediately. To get the final result of the prediction you should either provide a `webhook` HTTPS URL for us to call when the results are ready, or poll the [get a prediction](#predictions.get) endpoint until it has finished.
- /// All input parameters, output values, and logs are automatically removed after an hour, by default, for predictions created through the API.
- /// Output files are served by `replicate.delivery` and its subdomains. If you use an allow list of external domains for your assets, add `replicate.delivery` and `*.replicate.delivery` to it. + /// The request will wait up to 60 seconds for the model to run. If this time is exceeded the prediction will be returned in a `"starting"` state and need to be retrieved using the `predictions.get` endpiont.
+ /// For a complete overview of the `deployments.predictions.create` API check out our documentation on [creating a prediction](https://replicate.com/docs/topics/predictions/create-a-prediction) which covers a variety of use cases. ///
/// /// + /// + /// Example: wait=5 + /// /// /// The token to cancel the operation with /// - global::System.Threading.Tasks.Task CreatePredictionsModelsAsync( + global::System.Threading.Tasks.Task CreatePredictionsModelsAsync( string modelOwner, string modelName, global::G.PredictionRequest request, + string? prefer = default, global::System.Threading.CancellationToken cancellationToken = default); /// /// Create a prediction using an official model
- /// Start a new prediction for an official model using the inputs you provide.
- /// Example request body:
- /// ```json
- /// {
- /// "input": {
- /// "prompt": "Write a short poem about the weather."
- /// }
- /// }
- /// ```
+ /// Create a prediction for the deployment and inputs you provide.
/// Example cURL request:
/// ```console
- /// curl -s -X POST \
+ /// curl -s -X POST -H 'Prefer: wait' \
/// -d '{"input": {"prompt": "Write a short poem about the weather."}}' \
- /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
/// -H 'Content-Type: application/json' \
/// https://api.replicate.com/v1/models/meta/meta-llama-3-70b-instruct/predictions
/// ```
- /// The response will be the prediction object:
- /// ```json
- /// {
- /// "id": "25s2s4n7rdrgg0cf1httb3myk0",
- /// "model": "replicate-internal/llama3-70b-chat-vllm-unquantized",
- /// "version": "dp-cf04fe09351e25db628e8b6181276547",
- /// "input": {
- /// "prompt": "Write a short poem about the weather."
- /// },
- /// "logs": "",
- /// "error": null,
- /// "status": "starting",
- /// "created_at": "2024-04-23T19:36:28.355Z",
- /// "urls": {
- /// "cancel": "https://api.replicate.com/v1/predictions/25s2s4n7rdrgg0cf1httb3myk0/cancel",
- /// "get": "https://api.replicate.com/v1/predictions/25s2s4n7rdrgg0cf1httb3myk0"
- /// }
- /// }
- /// ```
- /// As models can take several seconds or more to run, the output will not be available immediately. To get the final result of the prediction you should either provide a `webhook` HTTPS URL for us to call when the results are ready, or poll the [get a prediction](#predictions.get) endpoint until it has finished.
- /// All input parameters, output values, and logs are automatically removed after an hour, by default, for predictions created through the API.
- /// Output files are served by `replicate.delivery` and its subdomains. If you use an allow list of external domains for your assets, add `replicate.delivery` and `*.replicate.delivery` to it. + /// The request will wait up to 60 seconds for the model to run. If this time is exceeded the prediction will be returned in a `"starting"` state and need to be retrieved using the `predictions.get` endpiont.
+ /// For a complete overview of the `deployments.predictions.create` API check out our documentation on [creating a prediction](https://replicate.com/docs/topics/predictions/create-a-prediction) which covers a variety of use cases. ///
/// /// + /// + /// Example: wait=5 + /// /// /// The model's input as a JSON object. The input schema depends on what model you are running. To see the available inputs, click the "API" tab on the model you are running or [get the model version](#models.versions.get) and look at its `openapi_schema` property. For example, [stability-ai/sdxl](https://replicate.com/stability-ai/sdxl) takes `prompt` as an input.
/// Files should be passed as HTTP URLs or data URLs.
@@ -142,10 +93,11 @@ public partial interface IApi /// /// The token to cancel the operation with /// - global::System.Threading.Tasks.Task CreatePredictionsModelsAsync( + global::System.Threading.Tasks.Task CreatePredictionsModelsAsync( string modelOwner, string modelName, object input, + string? prefer = default, bool? stream = default, string? webhook = default, global::System.Collections.Generic.IList? webhookEventsFilter = default, diff --git a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.IApi.CreateTrainings.g.verified.cs b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.IApi.CreateTrainings.g.verified.cs index 1ed4259eb9..9506b800f6 100644 --- a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.IApi.CreateTrainings.g.verified.cs +++ b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.IApi.CreateTrainings.g.verified.cs @@ -22,7 +22,7 @@ public partial interface IApi /// ```console
/// curl -s -X POST \
/// -d '{"destination": "{new_owner}/{new_name}", "input": {"input_images": "https://example.com/my-input-images.zip"}}' \
- /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
/// -H 'Content-Type: application/json' \
/// https://api.replicate.com/v1/models/stability-ai/sdxl/versions/da77bc59ee60423279fd632efb4795ab731d9e3ca9705ef3341091fb989b7eaf/trainings
/// ```
@@ -79,7 +79,7 @@ public partial interface IApi /// ```console
/// curl -s -X POST \
/// -d '{"destination": "{new_owner}/{new_name}", "input": {"input_images": "https://example.com/my-input-images.zip"}}' \
- /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
/// -H 'Content-Type: application/json' \
/// https://api.replicate.com/v1/models/stability-ai/sdxl/versions/da77bc59ee60423279fd632efb4795ab731d9e3ca9705ef3341091fb989b7eaf/trainings
/// ```
diff --git a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.IApi.DeleteDeployments.g.verified.cs b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.IApi.DeleteDeployments.g.verified.cs index 9782b0fcd8..7d6e9d0b15 100644 --- a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.IApi.DeleteDeployments.g.verified.cs +++ b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.IApi.DeleteDeployments.g.verified.cs @@ -13,7 +13,7 @@ public partial interface IApi /// Example cURL request:
/// ```command
/// curl -s -X DELETE \
- /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
/// https://api.replicate.com/v1/deployments/acme/my-app-image-generator
/// ```
/// The response will be an empty 204, indicating the deployment has been deleted. diff --git a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.IApi.DeleteModels.g.verified.cs b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.IApi.DeleteModels.g.verified.cs index 5ad1c63e6e..107b5bf6c3 100644 --- a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.IApi.DeleteModels.g.verified.cs +++ b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.IApi.DeleteModels.g.verified.cs @@ -15,7 +15,7 @@ public partial interface IApi /// Example cURL request:
/// ```command
/// curl -s -X DELETE \
- /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
/// https://api.replicate.com/v1/models/replicate/hello-world
/// ```
/// The response will be an empty 204, indicating the model has been deleted. diff --git a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.IApi.DeleteVersionsModels.g.verified.cs b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.IApi.DeleteVersionsModels.g.verified.cs index 7e1f5d315e..c5e57d0825 100644 --- a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.IApi.DeleteVersionsModels.g.verified.cs +++ b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.IApi.DeleteVersionsModels.g.verified.cs @@ -18,7 +18,7 @@ public partial interface IApi /// Example cURL request:
/// ```command
/// curl -s -X DELETE \
- /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
/// https://api.replicate.com/v1/models/replicate/hello-world/versions/5c7d5dc6dd8bf75c1acaa8565735e7986bc5b66206b55cca93cb72c9bf15ccaa
/// ```
/// The response will be an empty 202, indicating the deletion request has been accepted. It might take a few minutes to be processed. diff --git a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.IApi.GetAccount.g.verified.cs b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.IApi.GetAccount.g.verified.cs index a5eca1c3d9..1b94e1a256 100644 --- a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.IApi.GetAccount.g.verified.cs +++ b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.IApi.GetAccount.g.verified.cs @@ -11,7 +11,7 @@ public partial interface IApi /// Example cURL request:
/// ```console
/// curl -s \
- /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
/// https://api.replicate.com/v1/account
/// ```
/// The response will be a JSON object describing the account:
diff --git a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.IApi.GetCollections.g.verified.cs b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.IApi.GetCollections.g.verified.cs index c07111c8f8..4f91279bce 100644 --- a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.IApi.GetCollections.g.verified.cs +++ b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.IApi.GetCollections.g.verified.cs @@ -10,7 +10,7 @@ public partial interface IApi /// Example cURL request:
/// ```console
/// curl -s \
- /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
/// https://api.replicate.com/v1/collections/super-resolution
/// ```
/// The response will be a collection object with a nested list of the models in that collection:
diff --git a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.IApi.GetDeployments.g.verified.cs b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.IApi.GetDeployments.g.verified.cs index 64fd187348..d31bcaabe0 100644 --- a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.IApi.GetDeployments.g.verified.cs +++ b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.IApi.GetDeployments.g.verified.cs @@ -11,7 +11,7 @@ public partial interface IApi /// Example cURL request:
/// ```console
/// curl -s \
- /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
/// https://api.replicate.com/v1/deployments/replicate/my-app-image-generator
/// ```
/// The response will be a JSON object describing the deployment:
diff --git a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.IApi.GetModels.g.verified.cs b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.IApi.GetModels.g.verified.cs index 44871cfaa5..f7dad4b97f 100644 --- a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.IApi.GetModels.g.verified.cs +++ b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.IApi.GetModels.g.verified.cs @@ -10,7 +10,7 @@ public partial interface IApi /// Example cURL request:
/// ```console
/// curl -s \
- /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
/// https://api.replicate.com/v1/models/replicate/hello-world
/// ```
/// The response will be a model object in the following format:
diff --git a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.IApi.GetPredictions.g.verified.cs b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.IApi.GetPredictions.g.verified.cs index bb4b58f0b6..216872ae96 100644 --- a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.IApi.GetPredictions.g.verified.cs +++ b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.IApi.GetPredictions.g.verified.cs @@ -11,7 +11,7 @@ public partial interface IApi /// Example cURL request:
/// ```console
/// curl -s \
- /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
/// https://api.replicate.com/v1/predictions/gm3qorzdhgbfurvjtvhg6dckhu
/// ```
/// The response will be the prediction object:
@@ -56,7 +56,7 @@ public partial interface IApi /// /// The token to cancel the operation with /// - global::System.Threading.Tasks.Task GetPredictionsAsync( + global::System.Threading.Tasks.Task GetPredictionsAsync( string predictionId, global::System.Threading.CancellationToken cancellationToken = default); } diff --git a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.IApi.GetSecretDefaultWebhooks.g.verified.cs b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.IApi.GetSecretDefaultWebhooks.g.verified.cs index 3235b81678..87248fb83d 100644 --- a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.IApi.GetSecretDefaultWebhooks.g.verified.cs +++ b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.IApi.GetSecretDefaultWebhooks.g.verified.cs @@ -11,7 +11,7 @@ public partial interface IApi /// Example cURL request:
/// ```console
/// curl -s \
- /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
/// https://api.replicate.com/v1/webhooks/default/secret
/// ```
/// The response will be a JSON object with a `key` property:
diff --git a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.IApi.GetTrainings.g.verified.cs b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.IApi.GetTrainings.g.verified.cs index 108c012941..cacb9751e7 100644 --- a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.IApi.GetTrainings.g.verified.cs +++ b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.IApi.GetTrainings.g.verified.cs @@ -11,7 +11,7 @@ public partial interface IApi /// Example cURL request:
/// ```console
/// curl -s \
- /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
/// https://api.replicate.com/v1/trainings/zz4ibbonubfz7carwiefibzgga
/// ```
/// The response will be the training object:
diff --git a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.IApi.GetVersionsModels.g.verified.cs b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.IApi.GetVersionsModels.g.verified.cs index c8ab027a99..8845a5e827 100644 --- a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.IApi.GetVersionsModels.g.verified.cs +++ b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.IApi.GetVersionsModels.g.verified.cs @@ -10,7 +10,7 @@ public partial interface IApi /// Example cURL request:
/// ```console
/// curl -s \
- /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
/// https://api.replicate.com/v1/models/replicate/hello-world/versions/5c7d5dc6dd8bf75c1acaa8565735e7986bc5b66206b55cca93cb72c9bf15ccaa
/// ```
/// The response will be the version object:
diff --git a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.IApi.ListCollections.g.verified.cs b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.IApi.ListCollections.g.verified.cs index 1aa3f13fde..3ef45f959f 100644 --- a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.IApi.ListCollections.g.verified.cs +++ b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.IApi.ListCollections.g.verified.cs @@ -10,7 +10,7 @@ public partial interface IApi /// Example cURL request:
/// ```console
/// curl -s \
- /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
/// https://api.replicate.com/v1/collections
/// ```
/// The response will be a paginated JSON list of collection objects:
diff --git a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.IApi.ListDeployments.g.verified.cs b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.IApi.ListDeployments.g.verified.cs index 00e3438809..b414b64162 100644 --- a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.IApi.ListDeployments.g.verified.cs +++ b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.IApi.ListDeployments.g.verified.cs @@ -11,7 +11,7 @@ public partial interface IApi /// Example cURL request:
/// ```console
/// curl -s \
- /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
/// https://api.replicate.com/v1/deployments
/// ```
/// The response will be a paginated JSON array of deployment objects, sorted with the most recent deployment first:
diff --git a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.IApi.ListHardware.g.verified.cs b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.IApi.ListHardware.g.verified.cs index 4489452841..ff8e4fe531 100644 --- a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.IApi.ListHardware.g.verified.cs +++ b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.IApi.ListHardware.g.verified.cs @@ -10,7 +10,7 @@ public partial interface IApi /// Example cURL request:
/// ```console
/// curl -s \
- /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
/// https://api.replicate.com/v1/hardware
/// ```
/// The response will be a JSON array of hardware objects:
diff --git a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.IApi.ListModels.g.verified.cs b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.IApi.ListModels.g.verified.cs index 2807539cf4..8a37a89585 100644 --- a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.IApi.ListModels.g.verified.cs +++ b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.IApi.ListModels.g.verified.cs @@ -11,7 +11,7 @@ public partial interface IApi /// Example cURL request:
/// ```console
/// curl -s \
- /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
/// https://api.replicate.com/v1/models
/// ```
/// The response will be a paginated JSON array of model objects:
diff --git a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.IApi.ListPredictions.g.verified.cs b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.IApi.ListPredictions.g.verified.cs index d81da97f8a..00afaab2ea 100644 --- a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.IApi.ListPredictions.g.verified.cs +++ b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.IApi.ListPredictions.g.verified.cs @@ -11,7 +11,7 @@ public partial interface IApi /// Example cURL request:
/// ```console
/// curl -s \
- /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
/// https://api.replicate.com/v1/predictions
/// ```
/// The response will be a paginated JSON array of prediction objects, sorted with the most recent prediction first:
diff --git a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.IApi.ListTrainings.g.verified.cs b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.IApi.ListTrainings.g.verified.cs index f9df446cad..949a9beca6 100644 --- a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.IApi.ListTrainings.g.verified.cs +++ b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.IApi.ListTrainings.g.verified.cs @@ -11,7 +11,7 @@ public partial interface IApi /// Example cURL request:
/// ```console
/// curl -s \
- /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
/// https://api.replicate.com/v1/trainings
/// ```
/// The response will be a paginated JSON array of training objects, sorted with the most recent training first:
diff --git a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.IApi.ListVersionsModels.g.verified.cs b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.IApi.ListVersionsModels.g.verified.cs index 444ecf78eb..e223555693 100644 --- a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.IApi.ListVersionsModels.g.verified.cs +++ b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.IApi.ListVersionsModels.g.verified.cs @@ -10,7 +10,7 @@ public partial interface IApi /// Example cURL request:
/// ```console
/// curl -s \
- /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
/// https://api.replicate.com/v1/models/replicate/hello-world/versions
/// ```
/// The response will be a JSON array of model version objects, sorted with the most recent version first:
diff --git a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.IApi.UpdateDeployments.g.verified.cs b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.IApi.UpdateDeployments.g.verified.cs index dbf142198a..37ee6691ba 100644 --- a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.IApi.UpdateDeployments.g.verified.cs +++ b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.IApi.UpdateDeployments.g.verified.cs @@ -12,7 +12,7 @@ public partial interface IApi /// ```console
/// curl -s \
/// -X PATCH \
- /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
/// -H "Content-Type: application/json" \
/// -d '{"min_instances": 3, "max_instances": 10}' \
/// https://api.replicate.com/v1/deployments/acme/my-app-image-generator
@@ -61,7 +61,7 @@ public partial interface IApi /// ```console
/// curl -s \
/// -X PATCH \
- /// -H "Authorization: Bearer <paste-your-token-here>" \
+ /// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
/// -H "Content-Type: application/json" \
/// -d '{"min_instances": 3, "max_instances": 10}' \
/// https://api.replicate.com/v1/deployments/acme/my-app-image-generator
diff --git a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.Models.PredictionResponse.Json.g.verified.cs b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.Models.PredictionResponse.Json.g.verified.cs deleted file mode 100644 index 62e1ef3cfe..0000000000 --- a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.Models.PredictionResponse.Json.g.verified.cs +++ /dev/null @@ -1,93 +0,0 @@ -//HintName: G.Models.PredictionResponse.Json.g.cs -#nullable enable - -namespace G -{ - public sealed partial class PredictionResponse - { - /// - /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. - /// - public string ToJson( - global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) - { - return global::System.Text.Json.JsonSerializer.Serialize( - this, - this.GetType(), - jsonSerializerContext); - } - - /// - /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. - /// -#if NET8_0_OR_GREATER - [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] - [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] -#endif - public string ToJson( - global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) - { - return global::System.Text.Json.JsonSerializer.Serialize( - this, - jsonSerializerOptions); - } - - /// - /// Deserializes a JSON string using the provided JsonSerializerContext. - /// - public static global::G.PredictionResponse? FromJson( - string json, - global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) - { - return global::System.Text.Json.JsonSerializer.Deserialize( - json, - typeof(global::G.PredictionResponse), - jsonSerializerContext) as global::G.PredictionResponse; - } - - /// - /// Deserializes a JSON string using the provided JsonSerializerOptions. - /// -#if NET8_0_OR_GREATER - [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] - [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] -#endif - public static global::G.PredictionResponse? FromJson( - string json, - global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) - { - return global::System.Text.Json.JsonSerializer.Deserialize( - json, - jsonSerializerOptions); - } - - /// - /// Deserializes a JSON stream using the provided JsonSerializerContext. - /// - public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( - global::System.IO.Stream jsonStream, - global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) - { - return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( - jsonStream, - typeof(global::G.PredictionResponse), - jsonSerializerContext).ConfigureAwait(false)) as global::G.PredictionResponse; - } - - /// - /// Deserializes a JSON stream using the provided JsonSerializerOptions. - /// -#if NET8_0_OR_GREATER - [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] - [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] -#endif - public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( - global::System.IO.Stream jsonStream, - global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) - { - return global::System.Text.Json.JsonSerializer.DeserializeAsync( - jsonStream, - jsonSerializerOptions); - } - } -} diff --git a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.Models.PredictionResponse.g.verified.cs b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.Models.PredictionResponse.g.verified.cs deleted file mode 100644 index c9a291e080..0000000000 --- a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.Models.PredictionResponse.g.verified.cs +++ /dev/null @@ -1,150 +0,0 @@ -//HintName: G.Models.PredictionResponse.g.cs - -#nullable enable - -namespace G -{ - /// - /// - /// - public sealed partial class PredictionResponse - { - /// - /// - /// - [global::System.Text.Json.Serialization.JsonPropertyName("completed_at")] - public string? CompletedAt { get; set; } - - /// - /// - /// - [global::System.Text.Json.Serialization.JsonPropertyName("created_at")] - public string? CreatedAt { get; set; } - - /// - /// - /// - [global::System.Text.Json.Serialization.JsonPropertyName("data_removed")] - public bool? DataRemoved { get; set; } - - /// - /// - /// - [global::System.Text.Json.Serialization.JsonPropertyName("error")] - public object? Error { get; set; } - - /// - /// - /// - [global::System.Text.Json.Serialization.JsonPropertyName("id")] - public string? Id { get; set; } - - /// - /// - /// - [global::System.Text.Json.Serialization.JsonPropertyName("input")] - public global::G.PredictionResponseInput? Input { get; set; } - - /// - /// - /// - [global::System.Text.Json.Serialization.JsonPropertyName("logs")] - public string? Logs { get; set; } - - /// - /// - /// - [global::System.Text.Json.Serialization.JsonPropertyName("metrics")] - public global::G.PredictionResponseMetrics? Metrics { get; set; } - - /// - /// - /// - [global::System.Text.Json.Serialization.JsonPropertyName("output")] - public string? Output { get; set; } - - /// - /// - /// - [global::System.Text.Json.Serialization.JsonPropertyName("started_at")] - public string? StartedAt { get; set; } - - /// - /// - /// - [global::System.Text.Json.Serialization.JsonPropertyName("status")] - public string? Status { get; set; } - - /// - /// - /// - [global::System.Text.Json.Serialization.JsonPropertyName("urls")] - public global::G.PredictionResponseUrls? Urls { get; set; } - - /// - /// - /// - [global::System.Text.Json.Serialization.JsonPropertyName("version")] - public string? Version { get; set; } - - /// - /// Additional properties that are not explicitly defined in the schema - /// - [global::System.Text.Json.Serialization.JsonExtensionData] - public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); - - /// - /// Initializes a new instance of the class. - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] - public PredictionResponse( - string? completedAt, - string? createdAt, - bool? dataRemoved, - object? error, - string? id, - global::G.PredictionResponseInput? input, - string? logs, - global::G.PredictionResponseMetrics? metrics, - string? output, - string? startedAt, - string? status, - global::G.PredictionResponseUrls? urls, - string? version) - { - this.CompletedAt = completedAt; - this.CreatedAt = createdAt; - this.DataRemoved = dataRemoved; - this.Error = error; - this.Id = id; - this.Input = input; - this.Logs = logs; - this.Metrics = metrics; - this.Output = output; - this.StartedAt = startedAt; - this.Status = status; - this.Urls = urls; - this.Version = version; - } - - /// - /// Initializes a new instance of the class. - /// - public PredictionResponse() - { - } - } -} \ No newline at end of file diff --git a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.Models.PredictionResponseInput.Json.g.verified.cs b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.Models.PredictionResponseInput.Json.g.verified.cs deleted file mode 100644 index e09de32ba6..0000000000 --- a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.Models.PredictionResponseInput.Json.g.verified.cs +++ /dev/null @@ -1,93 +0,0 @@ -//HintName: G.Models.PredictionResponseInput.Json.g.cs -#nullable enable - -namespace G -{ - public sealed partial class PredictionResponseInput - { - /// - /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. - /// - public string ToJson( - global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) - { - return global::System.Text.Json.JsonSerializer.Serialize( - this, - this.GetType(), - jsonSerializerContext); - } - - /// - /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. - /// -#if NET8_0_OR_GREATER - [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] - [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] -#endif - public string ToJson( - global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) - { - return global::System.Text.Json.JsonSerializer.Serialize( - this, - jsonSerializerOptions); - } - - /// - /// Deserializes a JSON string using the provided JsonSerializerContext. - /// - public static global::G.PredictionResponseInput? FromJson( - string json, - global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) - { - return global::System.Text.Json.JsonSerializer.Deserialize( - json, - typeof(global::G.PredictionResponseInput), - jsonSerializerContext) as global::G.PredictionResponseInput; - } - - /// - /// Deserializes a JSON string using the provided JsonSerializerOptions. - /// -#if NET8_0_OR_GREATER - [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] - [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] -#endif - public static global::G.PredictionResponseInput? FromJson( - string json, - global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) - { - return global::System.Text.Json.JsonSerializer.Deserialize( - json, - jsonSerializerOptions); - } - - /// - /// Deserializes a JSON stream using the provided JsonSerializerContext. - /// - public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( - global::System.IO.Stream jsonStream, - global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) - { - return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( - jsonStream, - typeof(global::G.PredictionResponseInput), - jsonSerializerContext).ConfigureAwait(false)) as global::G.PredictionResponseInput; - } - - /// - /// Deserializes a JSON stream using the provided JsonSerializerOptions. - /// -#if NET8_0_OR_GREATER - [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] - [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] -#endif - public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( - global::System.IO.Stream jsonStream, - global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) - { - return global::System.Text.Json.JsonSerializer.DeserializeAsync( - jsonStream, - jsonSerializerOptions); - } - } -} diff --git a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.Models.PredictionResponseInput.g.verified.cs b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.Models.PredictionResponseInput.g.verified.cs deleted file mode 100644 index 1ee5d794c7..0000000000 --- a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.Models.PredictionResponseInput.g.verified.cs +++ /dev/null @@ -1,96 +0,0 @@ -//HintName: G.Models.PredictionResponseInput.g.cs - -#nullable enable - -namespace G -{ - /// - /// - /// - public sealed partial class PredictionResponseInput - { - /// - /// - /// - [global::System.Text.Json.Serialization.JsonPropertyName("seed")] - public double? Seed { get; set; } - - /// - /// - /// - [global::System.Text.Json.Serialization.JsonPropertyName("steps")] - public double? Steps { get; set; } - - /// - /// - /// - [global::System.Text.Json.Serialization.JsonPropertyName("prompt")] - public string? Prompt { get; set; } - - /// - /// - /// - [global::System.Text.Json.Serialization.JsonPropertyName("guidance")] - public double? Guidance { get; set; } - - /// - /// - /// - [global::System.Text.Json.Serialization.JsonPropertyName("interval")] - public double? Interval { get; set; } - - /// - /// - /// - [global::System.Text.Json.Serialization.JsonPropertyName("aspect_ratio")] - public string? AspectRatio { get; set; } - - /// - /// - /// - [global::System.Text.Json.Serialization.JsonPropertyName("safety_tolerance")] - public double? SafetyTolerance { get; set; } - - /// - /// Additional properties that are not explicitly defined in the schema - /// - [global::System.Text.Json.Serialization.JsonExtensionData] - public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); - - /// - /// Initializes a new instance of the class. - /// - /// - /// - /// - /// - /// - /// - /// - [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] - public PredictionResponseInput( - double? seed, - double? steps, - string? prompt, - double? guidance, - double? interval, - string? aspectRatio, - double? safetyTolerance) - { - this.Seed = seed; - this.Steps = steps; - this.Prompt = prompt; - this.Guidance = guidance; - this.Interval = interval; - this.AspectRatio = aspectRatio; - this.SafetyTolerance = safetyTolerance; - } - - /// - /// Initializes a new instance of the class. - /// - public PredictionResponseInput() - { - } - } -} \ No newline at end of file diff --git a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.Models.PredictionResponseMetrics.Json.g.verified.cs b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.Models.PredictionResponseMetrics.Json.g.verified.cs deleted file mode 100644 index 44653eb894..0000000000 --- a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.Models.PredictionResponseMetrics.Json.g.verified.cs +++ /dev/null @@ -1,93 +0,0 @@ -//HintName: G.Models.PredictionResponseMetrics.Json.g.cs -#nullable enable - -namespace G -{ - public sealed partial class PredictionResponseMetrics - { - /// - /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. - /// - public string ToJson( - global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) - { - return global::System.Text.Json.JsonSerializer.Serialize( - this, - this.GetType(), - jsonSerializerContext); - } - - /// - /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. - /// -#if NET8_0_OR_GREATER - [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] - [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] -#endif - public string ToJson( - global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) - { - return global::System.Text.Json.JsonSerializer.Serialize( - this, - jsonSerializerOptions); - } - - /// - /// Deserializes a JSON string using the provided JsonSerializerContext. - /// - public static global::G.PredictionResponseMetrics? FromJson( - string json, - global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) - { - return global::System.Text.Json.JsonSerializer.Deserialize( - json, - typeof(global::G.PredictionResponseMetrics), - jsonSerializerContext) as global::G.PredictionResponseMetrics; - } - - /// - /// Deserializes a JSON string using the provided JsonSerializerOptions. - /// -#if NET8_0_OR_GREATER - [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] - [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] -#endif - public static global::G.PredictionResponseMetrics? FromJson( - string json, - global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) - { - return global::System.Text.Json.JsonSerializer.Deserialize( - json, - jsonSerializerOptions); - } - - /// - /// Deserializes a JSON stream using the provided JsonSerializerContext. - /// - public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( - global::System.IO.Stream jsonStream, - global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) - { - return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( - jsonStream, - typeof(global::G.PredictionResponseMetrics), - jsonSerializerContext).ConfigureAwait(false)) as global::G.PredictionResponseMetrics; - } - - /// - /// Deserializes a JSON stream using the provided JsonSerializerOptions. - /// -#if NET8_0_OR_GREATER - [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] - [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] -#endif - public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( - global::System.IO.Stream jsonStream, - global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) - { - return global::System.Text.Json.JsonSerializer.DeserializeAsync( - jsonStream, - jsonSerializerOptions); - } - } -} diff --git a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.Models.PredictionResponseMetrics.g.verified.cs b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.Models.PredictionResponseMetrics.g.verified.cs deleted file mode 100644 index 381f33d2ff..0000000000 --- a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.Models.PredictionResponseMetrics.g.verified.cs +++ /dev/null @@ -1,60 +0,0 @@ -//HintName: G.Models.PredictionResponseMetrics.g.cs - -#nullable enable - -namespace G -{ - /// - /// - /// - public sealed partial class PredictionResponseMetrics - { - /// - /// - /// - [global::System.Text.Json.Serialization.JsonPropertyName("image_count")] - public double? ImageCount { get; set; } - - /// - /// - /// - [global::System.Text.Json.Serialization.JsonPropertyName("predict_time")] - public double? PredictTime { get; set; } - - /// - /// - /// - [global::System.Text.Json.Serialization.JsonPropertyName("total_time")] - public double? TotalTime { get; set; } - - /// - /// Additional properties that are not explicitly defined in the schema - /// - [global::System.Text.Json.Serialization.JsonExtensionData] - public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); - - /// - /// Initializes a new instance of the class. - /// - /// - /// - /// - [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] - public PredictionResponseMetrics( - double? imageCount, - double? predictTime, - double? totalTime) - { - this.ImageCount = imageCount; - this.PredictTime = predictTime; - this.TotalTime = totalTime; - } - - /// - /// Initializes a new instance of the class. - /// - public PredictionResponseMetrics() - { - } - } -} \ No newline at end of file diff --git a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.Models.PredictionResponseUrls.Json.g.verified.cs b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.Models.PredictionResponseUrls.Json.g.verified.cs deleted file mode 100644 index c72b226e28..0000000000 --- a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.Models.PredictionResponseUrls.Json.g.verified.cs +++ /dev/null @@ -1,93 +0,0 @@ -//HintName: G.Models.PredictionResponseUrls.Json.g.cs -#nullable enable - -namespace G -{ - public sealed partial class PredictionResponseUrls - { - /// - /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. - /// - public string ToJson( - global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) - { - return global::System.Text.Json.JsonSerializer.Serialize( - this, - this.GetType(), - jsonSerializerContext); - } - - /// - /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. - /// -#if NET8_0_OR_GREATER - [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] - [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] -#endif - public string ToJson( - global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) - { - return global::System.Text.Json.JsonSerializer.Serialize( - this, - jsonSerializerOptions); - } - - /// - /// Deserializes a JSON string using the provided JsonSerializerContext. - /// - public static global::G.PredictionResponseUrls? FromJson( - string json, - global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) - { - return global::System.Text.Json.JsonSerializer.Deserialize( - json, - typeof(global::G.PredictionResponseUrls), - jsonSerializerContext) as global::G.PredictionResponseUrls; - } - - /// - /// Deserializes a JSON string using the provided JsonSerializerOptions. - /// -#if NET8_0_OR_GREATER - [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] - [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] -#endif - public static global::G.PredictionResponseUrls? FromJson( - string json, - global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) - { - return global::System.Text.Json.JsonSerializer.Deserialize( - json, - jsonSerializerOptions); - } - - /// - /// Deserializes a JSON stream using the provided JsonSerializerContext. - /// - public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( - global::System.IO.Stream jsonStream, - global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) - { - return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( - jsonStream, - typeof(global::G.PredictionResponseUrls), - jsonSerializerContext).ConfigureAwait(false)) as global::G.PredictionResponseUrls; - } - - /// - /// Deserializes a JSON stream using the provided JsonSerializerOptions. - /// -#if NET8_0_OR_GREATER - [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] - [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] -#endif - public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( - global::System.IO.Stream jsonStream, - global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) - { - return global::System.Text.Json.JsonSerializer.DeserializeAsync( - jsonStream, - jsonSerializerOptions); - } - } -} diff --git a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.Models.PredictionResponseUrls.g.verified.cs b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.Models.PredictionResponseUrls.g.verified.cs deleted file mode 100644 index f6143ef9d7..0000000000 --- a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#G.Models.PredictionResponseUrls.g.verified.cs +++ /dev/null @@ -1,51 +0,0 @@ -//HintName: G.Models.PredictionResponseUrls.g.cs - -#nullable enable - -namespace G -{ - /// - /// - /// - public sealed partial class PredictionResponseUrls - { - /// - /// - /// - [global::System.Text.Json.Serialization.JsonPropertyName("get")] - public string? Get { get; set; } - - /// - /// - /// - [global::System.Text.Json.Serialization.JsonPropertyName("cancel")] - public string? Cancel { get; set; } - - /// - /// Additional properties that are not explicitly defined in the schema - /// - [global::System.Text.Json.Serialization.JsonExtensionData] - public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); - - /// - /// Initializes a new instance of the class. - /// - /// - /// - [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] - public PredictionResponseUrls( - string? get, - string? cancel) - { - this.Get = get; - this.Cancel = cancel; - } - - /// - /// Initializes a new instance of the class. - /// - public PredictionResponseUrls() - { - } - } -} \ No newline at end of file diff --git a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#JsonSerializerContextTypes.g.verified.cs b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#JsonSerializerContextTypes.g.verified.cs index 87d2a00a5e..356b2b2039 100644 --- a/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#JsonSerializerContextTypes.g.verified.cs +++ b/src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/SystemTextJson/_#JsonSerializerContextTypes.g.verified.cs @@ -67,154 +67,134 @@ public sealed partial class JsonSerializerContextTypes /// /// /// - public global::G.PredictionResponse? Type12 { get; set; } + public global::G.DeploymentsCreateRequest? Type12 { get; set; } /// /// /// - public global::G.PredictionResponseInput? Type13 { get; set; } + public int? Type13 { get; set; } /// /// /// - public double? Type14 { get; set; } + public global::G.DeploymentsUpdateRequest? Type14 { get; set; } /// /// /// - public global::G.PredictionResponseMetrics? Type15 { get; set; } + public global::G.ModelsCreateRequest? Type15 { get; set; } /// /// /// - public global::G.PredictionResponseUrls? Type16 { get; set; } + public global::G.ModelsCreateRequestVisibility? Type16 { get; set; } /// /// /// - public global::G.DeploymentsCreateRequest? Type17 { get; set; } + public global::G.AccountGetResponse? Type17 { get; set; } /// /// /// - public int? Type18 { get; set; } + public global::G.AccountGetResponseType? Type18 { get; set; } /// /// /// - public global::G.DeploymentsUpdateRequest? Type19 { get; set; } + public global::G.DeploymentsListResponse? Type19 { get; set; } /// /// /// - public global::G.ModelsCreateRequest? Type20 { get; set; } + public global::System.Collections.Generic.IList? Type20 { get; set; } /// /// /// - public global::G.ModelsCreateRequestVisibility? Type21 { get; set; } + public global::G.DeploymentsListResponseResult? Type21 { get; set; } /// /// /// - public global::G.AccountGetResponse? Type22 { get; set; } + public global::G.DeploymentsListResponseResultCurrentRelease? Type22 { get; set; } /// /// /// - public global::G.AccountGetResponseType? Type23 { get; set; } + public global::G.DeploymentsListResponseResultCurrentReleaseConfiguration? Type23 { get; set; } /// /// /// - public global::G.DeploymentsListResponse? Type24 { get; set; } + public global::System.DateTime? Type24 { get; set; } /// /// /// - public global::System.Collections.Generic.IList? Type25 { get; set; } + public global::G.DeploymentsListResponseResultCurrentReleaseCreatedBy? Type25 { get; set; } /// /// /// - public global::G.DeploymentsListResponseResult? Type26 { get; set; } + public global::G.DeploymentsListResponseResultCurrentReleaseCreatedByType? Type26 { get; set; } /// /// /// - public global::G.DeploymentsListResponseResultCurrentRelease? Type27 { get; set; } + public global::G.DeploymentsCreateResponse? Type27 { get; set; } /// /// /// - public global::G.DeploymentsListResponseResultCurrentReleaseConfiguration? Type28 { get; set; } + public global::G.DeploymentsCreateResponseCurrentRelease? Type28 { get; set; } /// /// /// - public global::System.DateTime? Type29 { get; set; } + public global::G.DeploymentsCreateResponseCurrentReleaseConfiguration? Type29 { get; set; } /// /// /// - public global::G.DeploymentsListResponseResultCurrentReleaseCreatedBy? Type30 { get; set; } + public global::G.DeploymentsCreateResponseCurrentReleaseCreatedBy? Type30 { get; set; } /// /// /// - public global::G.DeploymentsListResponseResultCurrentReleaseCreatedByType? Type31 { get; set; } + public global::G.DeploymentsCreateResponseCurrentReleaseCreatedByType? Type31 { get; set; } /// /// /// - public global::G.DeploymentsCreateResponse? Type32 { get; set; } + public global::G.DeploymentsGetResponse? Type32 { get; set; } /// /// /// - public global::G.DeploymentsCreateResponseCurrentRelease? Type33 { get; set; } + public global::G.DeploymentsGetResponseCurrentRelease? Type33 { get; set; } /// /// /// - public global::G.DeploymentsCreateResponseCurrentReleaseConfiguration? Type34 { get; set; } + public global::G.DeploymentsGetResponseCurrentReleaseConfiguration? Type34 { get; set; } /// /// /// - public global::G.DeploymentsCreateResponseCurrentReleaseCreatedBy? Type35 { get; set; } + public global::G.DeploymentsGetResponseCurrentReleaseCreatedBy? Type35 { get; set; } /// /// /// - public global::G.DeploymentsCreateResponseCurrentReleaseCreatedByType? Type36 { get; set; } + public global::G.DeploymentsGetResponseCurrentReleaseCreatedByType? Type36 { get; set; } /// /// /// - public global::G.DeploymentsGetResponse? Type37 { get; set; } + public global::G.DeploymentsUpdateResponse? Type37 { get; set; } /// /// /// - public global::G.DeploymentsGetResponseCurrentRelease? Type38 { get; set; } + public global::G.DeploymentsUpdateResponseCurrentRelease? Type38 { get; set; } /// /// /// - public global::G.DeploymentsGetResponseCurrentReleaseConfiguration? Type39 { get; set; } + public global::G.DeploymentsUpdateResponseCurrentReleaseConfiguration? Type39 { get; set; } /// /// /// - public global::G.DeploymentsGetResponseCurrentReleaseCreatedBy? Type40 { get; set; } + public global::G.DeploymentsUpdateResponseCurrentReleaseCreatedBy? Type40 { get; set; } /// /// /// - public global::G.DeploymentsGetResponseCurrentReleaseCreatedByType? Type41 { get; set; } + public global::G.DeploymentsUpdateResponseCurrentReleaseCreatedByType? Type41 { get; set; } /// /// /// - public global::G.DeploymentsUpdateResponse? Type42 { get; set; } + public global::System.Collections.Generic.IList? Type42 { get; set; } /// /// /// - public global::G.DeploymentsUpdateResponseCurrentRelease? Type43 { get; set; } + public global::G.HardwareListResponseItem? Type43 { get; set; } /// /// /// - public global::G.DeploymentsUpdateResponseCurrentReleaseConfiguration? Type44 { get; set; } - /// - /// - /// - public global::G.DeploymentsUpdateResponseCurrentReleaseCreatedBy? Type45 { get; set; } - /// - /// - /// - public global::G.DeploymentsUpdateResponseCurrentReleaseCreatedByType? Type46 { get; set; } - /// - /// - /// - public global::System.Collections.Generic.IList? Type47 { get; set; } - /// - /// - /// - public global::G.HardwareListResponseItem? Type48 { get; set; } - /// - /// - /// - public global::G.WebhooksDefaultSecretGetResponse? Type49 { get; set; } + public global::G.WebhooksDefaultSecretGetResponse? Type44 { get; set; } } } \ No newline at end of file diff --git a/src/tests/AutoSDK.SnapshotTests/Tests.cs b/src/tests/AutoSDK.SnapshotTests/Tests.cs index d5795f605b..aab9255daa 100644 --- a/src/tests/AutoSDK.SnapshotTests/Tests.cs +++ b/src/tests/AutoSDK.SnapshotTests/Tests.cs @@ -37,8 +37,8 @@ public partial class Tests [DataRow("OpenAi", "openai.yaml", JsonSerializerType.SystemTextJson)] [DataRow("PetStore", "petstore.yaml", JsonSerializerType.NewtonsoftJson)] [DataRow("PetStore", "petstore.yaml", JsonSerializerType.SystemTextJson)] - [DataRow("Replicate", "replicate.yaml", JsonSerializerType.NewtonsoftJson)] - [DataRow("Replicate", "replicate.yaml", JsonSerializerType.SystemTextJson)] + [DataRow("Replicate", "replicate.json", JsonSerializerType.NewtonsoftJson)] + [DataRow("Replicate", "replicate.json", JsonSerializerType.SystemTextJson)] [DataRow("SpecialCases", "special-cases.yaml", JsonSerializerType.NewtonsoftJson)] [DataRow("SpecialCases", "special-cases.yaml", JsonSerializerType.SystemTextJson)] [DataRow("Together", "together.yaml", JsonSerializerType.NewtonsoftJson)] @@ -91,6 +91,7 @@ public Task SdkGenerator(string callerName, string fileName, JsonSerializerType "Replicate" => new Dictionary { ["build_property.AutoSDK_MethodNamingConvention"] = "OperationIdWithDots", + ["build_property.AutoSDK_IgnoreOpenApiErrors"] = "true", //["build_property.AutoSDK_GenerateSdk"] = "false", //["build_property.AutoSDK_GenerateModels"] = "true", //["build_property.AutoSDK_IncludeModels"] = "prediction_request", diff --git a/src/tests/AutoSDK.UnitTests/DataTests.cs b/src/tests/AutoSDK.UnitTests/DataTests.cs index c2895a8a12..da6502c9de 100644 --- a/src/tests/AutoSDK.UnitTests/DataTests.cs +++ b/src/tests/AutoSDK.UnitTests/DataTests.cs @@ -19,7 +19,7 @@ public partial class DataTests [DataRow("ollama.yaml")] [DataRow("openai.yaml")] [DataRow("petstore.yaml")] - [DataRow("replicate.yaml")] + [DataRow("replicate.json")] [DataRow("special-cases.yaml")] [DataRow("together.yaml")] [DataRow("mystic.yaml")] @@ -44,13 +44,14 @@ DefaultSettings with MethodNamingConvention = resourceName switch { "mystic.yaml" => MethodNamingConvention.Summary, - "replicate.yaml" => MethodNamingConvention.OperationIdWithDots, + "replicate.json" => MethodNamingConvention.OperationIdWithDots, _ => default, }, IgnoreOpenApiErrors = resourceName switch { "elevenlabs.json" => true, "ai21.json" => true, + "replicate.json" => true, _ => false, }, })), diff --git a/src/tests/AutoSDK.UnitTests/Snapshots/Replicate/ResolvedSchemas/_.verified.txt b/src/tests/AutoSDK.UnitTests/Snapshots/Replicate/ResolvedSchemas/_.verified.txt index a85bd18405..c0958075b4 100644 --- a/src/tests/AutoSDK.UnitTests/Snapshots/Replicate/ResolvedSchemas/_.verified.txt +++ b/src/tests/AutoSDK.UnitTests/Snapshots/Replicate/ResolvedSchemas/_.verified.txt @@ -18,32 +18,6 @@ Webhook(string)[], WebhookEventsFilter(array)[], VersionPredictionRequestWebhookEventsFilterItem(enum)[], - PredictionResponse(class)[], - CompletedAt(string)[], - CreatedAt(string)[], - DataRemoved(bool)[], - Error(null)[], - Id(string)[], - PredictionResponseInput(class)[], - Seed(double)[], - Steps(double)[], - Prompt(string)[], - Guidance(double)[], - Interval(double)[], - AspectRatio(string)[], - SafetyTolerance(double)[], - Logs(string)[], - PredictionResponseMetrics(class)[], - ImageCount(double)[], - PredictTime(double)[], - TotalTime(double)[], - Output(string)[], - StartedAt(string)[], - Status(string)[], - PredictionResponseUrls(class)[], - Get(string)[], - Cancel(string)[], - Version(string)[], DeploymentsCreateRequest(class)[], Hardware(string)[], MaxInstances(int)[], @@ -79,12 +53,14 @@ DeploymentsUpdateDeploymentName(string)[], DeploymentsPredictionsCreateDeploymentOwner(string)[], DeploymentsPredictionsCreateDeploymentName(string)[], + DeploymentsPredictionsCreatePrefer(string)[], ModelsDeleteModelOwner(string)[], ModelsDeleteModelName(string)[], ModelsGetModelOwner(string)[], ModelsGetModelName(string)[], ModelsPredictionsCreateModelOwner(string)[], ModelsPredictionsCreateModelName(string)[], + ModelsPredictionsCreatePrefer(string)[], ModelsVersionsListModelOwner(string)[], ModelsVersionsListModelName(string)[], ModelsVersionsDeleteModelOwner(string)[], @@ -96,6 +72,7 @@ TrainingsCreateModelOwner(string)[], TrainingsCreateModelName(string)[], TrainingsCreateVersionId(string)[], + PredictionsCreatePrefer(string)[], PredictionsGetPredictionId(string)[], PredictionsCancelPredictionId(string)[], TrainingsGetTrainingId(string)[], @@ -181,8 +158,6 @@ HardwareListResponseItem(class)[], Name(string)[], Sku(string)[], - PredictionResponse(ref)[], - PredictionResponse(ref)[], WebhooksDefaultSecretGetResponse(class)[], Key(string)[] ] \ No newline at end of file diff --git a/src/tests/AutoSDK.UnitTests/Snapshots/Replicate/Schemas/_.verified.txt b/src/tests/AutoSDK.UnitTests/Snapshots/Replicate/Schemas/_.verified.txt index aecb0e10b2..f11b6b95f4 100644 --- a/src/tests/AutoSDK.UnitTests/Snapshots/Replicate/Schemas/_.verified.txt +++ b/src/tests/AutoSDK.UnitTests/Snapshots/Replicate/Schemas/_.verified.txt @@ -18,32 +18,6 @@ Webhook(string), WebhookEventsFilter(array), VersionPredictionRequestWebhookEventsFilterItem(enum), - PredictionResponse(class), - CompletedAt(string), - CreatedAt(string), - DataRemoved(bool), - Error(null), - Id(string), - PredictionResponseInput(class), - Seed(double), - Steps(double), - Prompt(string), - Guidance(double), - Interval(double), - AspectRatio(string), - SafetyTolerance(double), - Logs(string), - PredictionResponseMetrics(class), - ImageCount(double), - PredictTime(double), - TotalTime(double), - Output(string), - StartedAt(string), - Status(string), - PredictionResponseUrls(class), - Get(string), - Cancel(string), - Version(string), DeploymentsCreateRequest(class), Hardware(string), MaxInstances(int), @@ -79,12 +53,14 @@ DeploymentsUpdateDeploymentName(string), DeploymentsPredictionsCreateDeploymentOwner(string), DeploymentsPredictionsCreateDeploymentName(string), + DeploymentsPredictionsCreatePrefer(string), ModelsDeleteModelOwner(string), ModelsDeleteModelName(string), ModelsGetModelOwner(string), ModelsGetModelName(string), ModelsPredictionsCreateModelOwner(string), ModelsPredictionsCreateModelName(string), + ModelsPredictionsCreatePrefer(string), ModelsVersionsListModelOwner(string), ModelsVersionsListModelName(string), ModelsVersionsDeleteModelOwner(string), @@ -96,6 +72,7 @@ TrainingsCreateModelOwner(string), TrainingsCreateModelName(string), TrainingsCreateVersionId(string), + PredictionsCreatePrefer(string), PredictionsGetPredictionId(string), PredictionsCancelPredictionId(string), TrainingsGetTrainingId(string), @@ -181,8 +158,6 @@ HardwareListResponseItem(class), Name(string), Sku(string), - PredictionResponse(ref), - PredictionResponse(ref), WebhooksDefaultSecretGetResponse(class), Key(string) ] \ No newline at end of file diff --git a/src/tests/AutoSDK.UnitTests/Snapshots/Validation/ConvertedSpecs/replicate.json/ValidationTests.Validation_NewErrors.verified.txt b/src/tests/AutoSDK.UnitTests/Snapshots/Validation/ConvertedSpecs/replicate.json/ValidationTests.Validation_NewErrors.verified.txt new file mode 100644 index 0000000000..2180fdc34b --- /dev/null +++ b/src/tests/AutoSDK.UnitTests/Snapshots/Validation/ConvertedSpecs/replicate.json/ValidationTests.Validation_NewErrors.verified.txt @@ -0,0 +1,6 @@ +[ + { + Message: query is not a valid property at #/paths/~1models, + Pointer: + } +] \ No newline at end of file diff --git a/src/tests/AutoSDK.UnitTests/Snapshots/Validation/ConvertedSpecs/replicate.json/ValidationTests.Validation_NewWarnings.verified.txt b/src/tests/AutoSDK.UnitTests/Snapshots/Validation/ConvertedSpecs/replicate.json/ValidationTests.Validation_NewWarnings.verified.txt new file mode 100644 index 0000000000..ad47dbb93f --- /dev/null +++ b/src/tests/AutoSDK.UnitTests/Snapshots/Validation/ConvertedSpecs/replicate.json/ValidationTests.Validation_NewWarnings.verified.txt @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/src/tests/AutoSDK.UnitTests/Snapshots/Validation/ConvertedSpecs/replicate.json/ValidationTests.Validation_OriginalErrors.verified.txt b/src/tests/AutoSDK.UnitTests/Snapshots/Validation/ConvertedSpecs/replicate.json/ValidationTests.Validation_OriginalErrors.verified.txt new file mode 100644 index 0000000000..2c7c7cc2c1 --- /dev/null +++ b/src/tests/AutoSDK.UnitTests/Snapshots/Validation/ConvertedSpecs/replicate.json/ValidationTests.Validation_OriginalErrors.verified.txt @@ -0,0 +1,6 @@ +[ + { + Message: OpenAPI specification version '3.1.0' is not supported., + Pointer: + } +] \ No newline at end of file diff --git a/src/tests/AutoSDK.UnitTests/Snapshots/Validation/ConvertedSpecs/replicate.json/ValidationTests.Validation_OriginalWarnings.verified.txt b/src/tests/AutoSDK.UnitTests/Snapshots/Validation/ConvertedSpecs/replicate.json/ValidationTests.Validation_OriginalWarnings.verified.txt new file mode 100644 index 0000000000..ad47dbb93f --- /dev/null +++ b/src/tests/AutoSDK.UnitTests/Snapshots/Validation/ConvertedSpecs/replicate.json/ValidationTests.Validation_OriginalWarnings.verified.txt @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/src/tests/AutoSDK.UnitTests/Snapshots/Validation/ConvertedSpecs/replicate.json/_.verified.txt b/src/tests/AutoSDK.UnitTests/Snapshots/Validation/ConvertedSpecs/replicate.json/_.verified.txt new file mode 100644 index 0000000000..c6621fe351 --- /dev/null +++ b/src/tests/AutoSDK.UnitTests/Snapshots/Validation/ConvertedSpecs/replicate.json/_.verified.txt @@ -0,0 +1,1392 @@ +{ + "components": { + "parameters": { + "prefer_header": { + "description": "Leave the request open and wait for the model to finish generating output. Set to \u0060wait=n\u0060 where n is a number of seconds between 1 and 60.\n\nSee https://replicate.com/docs/topics/predictions/create-a-prediction#sync-mode for more information.", + "in": "header", + "name": "Prefer", + "schema": { + "example": "wait=5", + "pattern": "^wait(=([1-9]|[1-9][0-9]|60))?$", + "type": "string" + } + } + }, + "schemas": { + "prediction_request": { + "additionalProperties": false, + "properties": { + "input": { + "description": "The model\u0027s input as a JSON object. The input schema depends on what model you are running. To see the available inputs, click the \u0022API\u0022 tab on the model you are running or [get the model version](#models.versions.get) and look at its \u0060openapi_schema\u0060 property. For example, [stability-ai/sdxl](https://replicate.com/stability-ai/sdxl) takes \u0060prompt\u0060 as an input.\n\nFiles should be passed as HTTP URLs or data URLs.\n\nUse an HTTP URL when:\n\n- you have a large file \u003E 256kb\n- you want to be able to use the file multiple times\n- you want your prediction metadata to be associable with your input files\n\nUse a data URL when:\n\n- you have a small file \u003C= 256kb\n- you don\u0027t want to upload and host the file somewhere\n- you don\u0027t need to use the file again (Replicate will not store it)\n", + "type": "object" + }, + "stream": { + "description": "**This field is deprecated.**\n\nRequest a URL to receive streaming output using [server-sent events (SSE)](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events).\n\nThis field is no longer needed as the returned prediction will always have a \u0060stream\u0060 entry in its \u0060url\u0060 property if the model supports streaming.\n", + "type": "boolean" + }, + "webhook": { + "description": "An HTTPS URL for receiving a webhook when the prediction has new output. The webhook will be a POST request where the request body is the same as the response body of the [get prediction](#predictions.get) operation. If there are network problems, we will retry the webhook a few times, so make sure it can be safely called more than once. Replicate will not follow redirects when sending webhook requests to your service, so be sure to specify a URL that will resolve without redirecting.\n", + "type": "string" + }, + "webhook_events_filter": { + "description": "By default, we will send requests to your webhook URL whenever there are new outputs or the prediction has finished. You can change which events trigger webhook requests by specifying \u0060webhook_events_filter\u0060 in the prediction request:\n\n- \u0060start\u0060: immediately on prediction start\n- \u0060output\u0060: each time a prediction generates an output (note that predictions can generate multiple outputs)\n- \u0060logs\u0060: each time log output is generated by a prediction\n- \u0060completed\u0060: when the prediction reaches a terminal state (succeeded/canceled/failed)\n\nFor example, if you only wanted requests to be sent at the start and end of the prediction, you would provide:\n\n\u0060\u0060\u0060json\n{\n \u0022input\u0022: {\n \u0022text\u0022: \u0022Alice\u0022\n },\n \u0022webhook\u0022: \u0022https://example.com/my-webhook\u0022,\n \u0022webhook_events_filter\u0022: [\u0022start\u0022, \u0022completed\u0022]\n}\n\u0060\u0060\u0060\n\nRequests for event types \u0060output\u0060 and \u0060logs\u0060 will be sent at most once every 500ms. If you request \u0060start\u0060 and \u0060completed\u0060 webhooks, then they\u0027ll always be sent regardless of throttling.\n", + "items": { + "enum": [ + "start", + "output", + "logs", + "completed" + ], + "type": "string" + }, + "type": "array" + } + }, + "required": [ + "input" + ], + "type": "object" + }, + "training_request": { + "properties": { + "destination": { + "description": "A string representing the desired model to push to in the format \u0060{destination_model_owner}/{destination_model_name}\u0060. This should be an existing model owned by the user or organization making the API request. If the destination is invalid, the server will return an appropriate 4XX response.\n", + "type": "string" + }, + "input": { + "description": "An object containing inputs to the Cog model\u0027s \u0060train()\u0060 function.\n", + "type": "object" + }, + "webhook": { + "description": "An HTTPS URL for receiving a webhook when the training completes. The webhook will be a POST request where the request body is the same as the response body of the [get training](#trainings.get) operation. If there are network problems, we will retry the webhook a few times, so make sure it can be safely called more than once. Replicate will not follow redirects when sending webhook requests to your service, so be sure to specify a URL that will resolve without redirecting.", + "type": "string" + }, + "webhook_events_filter": { + "description": "By default, we will send requests to your webhook URL whenever there are new outputs or the training has finished. You can change which events trigger webhook requests by specifying \u0060webhook_events_filter\u0060 in the training request:\n\n- \u0060start\u0060: immediately on training start\n- \u0060output\u0060: each time a training generates an output (note that trainings can generate multiple outputs)\n- \u0060logs\u0060: each time log output is generated by a training\n- \u0060completed\u0060: when the training reaches a terminal state (succeeded/canceled/failed)\n\nFor example, if you only wanted requests to be sent at the start and end of the training, you would provide:\n\n\u0060\u0060\u0060json\n{\n \u0022destination\u0022: \u0022my-organization/my-model\u0022,\n \u0022input\u0022: {\n \u0022text\u0022: \u0022Alice\u0022\n },\n \u0022webhook\u0022: \u0022https://example.com/my-webhook\u0022,\n \u0022webhook_events_filter\u0022: [\u0022start\u0022, \u0022completed\u0022]\n}\n\u0060\u0060\u0060\n\nRequests for event types \u0060output\u0060 and \u0060logs\u0060 will be sent at most once every 500ms. If you request \u0060start\u0060 and \u0060completed\u0060 webhooks, then they\u0027ll always be sent regardless of throttling.\n", + "items": { + "enum": [ + "start", + "output", + "logs", + "completed" + ], + "type": "string" + }, + "type": "array" + } + }, + "required": [ + "destination", + "input" + ], + "type": "object" + }, + "version_prediction_request": { + "additionalProperties": false, + "properties": { + "input": { + "description": "The model\u0027s input as a JSON object. The input schema depends on what model you are running. To see the available inputs, click the \u0022API\u0022 tab on the model you are running or [get the model version](#models.versions.get) and look at its \u0060openapi_schema\u0060 property. For example, [stability-ai/sdxl](https://replicate.com/stability-ai/sdxl) takes \u0060prompt\u0060 as an input.\n\nFiles should be passed as HTTP URLs or data URLs.\n\nUse an HTTP URL when:\n\n- you have a large file \u003E 256kb\n- you want to be able to use the file multiple times\n- you want your prediction metadata to be associable with your input files\n\nUse a data URL when:\n\n- you have a small file \u003C= 256kb\n- you don\u0027t want to upload and host the file somewhere\n- you don\u0027t need to use the file again (Replicate will not store it)\n", + "type": "object" + }, + "stream": { + "description": "**This field is deprecated.**\n\nRequest a URL to receive streaming output using [server-sent events (SSE)](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events).\n\nThis field is no longer needed as the returned prediction will always have a \u0060stream\u0060 entry in its \u0060url\u0060 property if the model supports streaming.\n", + "type": "boolean" + }, + "version": { + "description": "The ID of the model version that you want to run.", + "type": "string" + }, + "webhook": { + "description": "An HTTPS URL for receiving a webhook when the prediction has new output. The webhook will be a POST request where the request body is the same as the response body of the [get prediction](#predictions.get) operation. If there are network problems, we will retry the webhook a few times, so make sure it can be safely called more than once. Replicate will not follow redirects when sending webhook requests to your service, so be sure to specify a URL that will resolve without redirecting.\n", + "type": "string" + }, + "webhook_events_filter": { + "description": "By default, we will send requests to your webhook URL whenever there are new outputs or the prediction has finished. You can change which events trigger webhook requests by specifying \u0060webhook_events_filter\u0060 in the prediction request:\n\n- \u0060start\u0060: immediately on prediction start\n- \u0060output\u0060: each time a prediction generates an output (note that predictions can generate multiple outputs)\n- \u0060logs\u0060: each time log output is generated by a prediction\n- \u0060completed\u0060: when the prediction reaches a terminal state (succeeded/canceled/failed)\n\nFor example, if you only wanted requests to be sent at the start and end of the prediction, you would provide:\n\n\u0060\u0060\u0060json\n{\n \u0022version\u0022: \u00225c7d5dc6dd8bf75c1acaa8565735e7986bc5b66206b55cca93cb72c9bf15ccaa\u0022,\n \u0022input\u0022: {\n \u0022text\u0022: \u0022Alice\u0022\n },\n \u0022webhook\u0022: \u0022https://example.com/my-webhook\u0022,\n \u0022webhook_events_filter\u0022: [\u0022start\u0022, \u0022completed\u0022]\n}\n\u0060\u0060\u0060\n\nRequests for event types \u0060output\u0060 and \u0060logs\u0060 will be sent at most once every 500ms. If you request \u0060start\u0060 and \u0060completed\u0060 webhooks, then they\u0027ll always be sent regardless of throttling.\n", + "items": { + "enum": [ + "start", + "output", + "logs", + "completed" + ], + "type": "string" + }, + "type": "array" + } + }, + "required": [ + "version", + "input" + ], + "type": "object" + } + }, + "securitySchemes": { + "bearerAuth": { + "bearerFormat": "All API requests must include a valid API token in the \u0060Authorization\u0060 request header. The token must be prefixed by \u0022Bearer\u0022, followed by a space and the token value.\nExample: \u0060Authorization: Bearer r8_Hw***********************************\u0060\nFind your tokens at https://replicate.com/account/api-tokens\n", + "scheme": "bearer", + "type": "http" + } + } + }, + "externalDocs": { + "description": "Replicate HTTP API", + "url": "https://replicate.com/docs/reference/http" + }, + "info": { + "contact": { + "email": "team@replicate.com" + }, + "description": "A web service for running Replicate models", + "termsOfService": "https://replicate.com/terms", + "title": "Replicate HTTP API", + "version": "1.0.0-a1" + }, + "openapi": "3.0.3", + "paths": { + "/account": { + "get": { + "description": "Returns information about the user or organization associated with the provided API token.\n\nExample cURL request:\n\n\u0060\u0060\u0060console\ncurl -s \\\n -H \u0022Authorization: Bearer $REPLICATE_API_TOKEN\u0022 \\\n https://api.replicate.com/v1/account\n\u0060\u0060\u0060\n\nThe response will be a JSON object describing the account:\n\n\u0060\u0060\u0060json\n{\n \u0022type\u0022: \u0022organization\u0022,\n \u0022username\u0022: \u0022acme\u0022,\n \u0022name\u0022: \u0022Acme Corp, Inc.\u0022,\n \u0022github_url\u0022: \u0022https://github.com/acme\u0022,\n}\n\u0060\u0060\u0060\n", + "operationId": "account.get", + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "properties": { + "github_url": { + "description": "The GitHub URL of the account.", + "format": "uri", + "type": "string" + }, + "name": { + "description": "The name of the account.", + "type": "string" + }, + "type": { + "description": "The account type. Can be a user or an organization.", + "enum": [ + "organization", + "user" + ], + "type": "string" + }, + "username": { + "description": "The username of the account.", + "type": "string" + } + }, + "type": "object" + } + } + }, + "description": "Success" + } + }, + "summary": "Get the authenticated account" + } + }, + "/collections": { + "get": { + "description": "Example cURL request:\n\n\u0060\u0060\u0060console\ncurl -s \\\n -H \u0022Authorization: Bearer $REPLICATE_API_TOKEN\u0022 \\\n https://api.replicate.com/v1/collections\n\u0060\u0060\u0060\n\nThe response will be a paginated JSON list of collection objects:\n\n\u0060\u0060\u0060json\n{\n \u0022next\u0022: \u0022null\u0022,\n \u0022previous\u0022: null,\n \u0022results\u0022: [\n {\n \u0022name\u0022: \u0022Super resolution\u0022,\n \u0022slug\u0022: \u0022super-resolution\u0022,\n \u0022description\u0022: \u0022Upscaling models that create high-quality images from low-quality images.\u0022\n }\n ]\n}\n\u0060\u0060\u0060\n", + "operationId": "collections.list", + "responses": { + "200": { + "description": "Success" + } + }, + "summary": "List collections of models" + } + }, + "/collections/{collection_slug}": { + "get": { + "description": "Example cURL request:\n\n\u0060\u0060\u0060console\ncurl -s \\\n -H \u0022Authorization: Bearer $REPLICATE_API_TOKEN\u0022 \\\n https://api.replicate.com/v1/collections/super-resolution\n\u0060\u0060\u0060\n\nThe response will be a collection object with a nested list of the models in that collection:\n\n\u0060\u0060\u0060json\n{\n \u0022name\u0022: \u0022Super resolution\u0022,\n \u0022slug\u0022: \u0022super-resolution\u0022,\n \u0022description\u0022: \u0022Upscaling models that create high-quality images from low-quality images.\u0022,\n \u0022models\u0022: [...]\n}\n\u0060\u0060\u0060\n", + "operationId": "collections.get", + "parameters": [ + { + "description": "The slug of the collection, like \u0060super-resolution\u0060 or \u0060image-restoration\u0060. See [replicate.com/collections](https://replicate.com/collections).\n", + "in": "path", + "name": "collection_slug", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Success" + } + }, + "summary": "Get a collection of models" + } + }, + "/deployments": { + "get": { + "description": "Get a list of deployments associated with the current account, including the latest release configuration for each deployment.\n\nExample cURL request:\n\n\u0060\u0060\u0060console\ncurl -s \\\n -H \u0022Authorization: Bearer $REPLICATE_API_TOKEN\u0022 \\\n https://api.replicate.com/v1/deployments\n\u0060\u0060\u0060\n\nThe response will be a paginated JSON array of deployment objects, sorted with the most recent deployment first:\n\n\u0060\u0060\u0060json\n{\n \u0022next\u0022: \u0022http://api.replicate.com/v1/deployments?cursor=cD0yMDIzLTA2LTA2KzIzJTNBNDAlM0EwOC45NjMwMDAlMkIwMCUzQTAw\u0022,\n \u0022previous\u0022: null,\n \u0022results\u0022: [\n {\n \u0022owner\u0022: \u0022replicate\u0022,\n \u0022name\u0022: \u0022my-app-image-generator\u0022,\n \u0022current_release\u0022: {\n \u0022number\u0022: 1,\n \u0022model\u0022: \u0022stability-ai/sdxl\u0022,\n \u0022version\u0022: \u0022da77bc59ee60423279fd632efb4795ab731d9e3ca9705ef3341091fb989b7eaf\u0022,\n \u0022created_at\u0022: \u00222024-02-15T16:32:57.018467Z\u0022,\n \u0022created_by\u0022: {\n \u0022type\u0022: \u0022organization\u0022,\n \u0022username\u0022: \u0022acme\u0022,\n \u0022name\u0022: \u0022Acme Corp, Inc.\u0022,\n \u0022github_url\u0022: \u0022https://github.com/acme\u0022,\n },\n \u0022configuration\u0022: {\n \u0022hardware\u0022: \u0022gpu-t4\u0022,\n \u0022min_instances\u0022: 1,\n \u0022max_instances\u0022: 5\n }\n }\n }\n ]\n}\n\u0060\u0060\u0060\n", + "operationId": "deployments.list", + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "properties": { + "next": { + "description": "A URL pointing to the next page of deployment objects if any", + "nullable": true, + "type": "string" + }, + "previous": { + "description": "A URL pointing to the previous page of deployment objects if any", + "nullable": true, + "type": "string" + }, + "results": { + "description": "An array containing a page of deployment objects", + "items": { + "properties": { + "current_release": { + "properties": { + "configuration": { + "properties": { + "hardware": { + "description": "The SKU for the hardware used to run the model.", + "type": "string" + }, + "max_instances": { + "description": "The maximum number of instances for scaling.", + "type": "integer" + }, + "min_instances": { + "description": "The minimum number of instances for scaling.", + "type": "integer" + } + }, + "type": "object" + }, + "created_at": { + "description": "The time the release was created.", + "format": "date-time", + "type": "string" + }, + "created_by": { + "properties": { + "github_url": { + "description": "The GitHub URL of the account that created the release.", + "format": "uri", + "type": "string" + }, + "name": { + "description": "The name of the account that created the release.", + "type": "string" + }, + "type": { + "description": "The account type of the creator. Can be a user or an organization.", + "enum": [ + "organization", + "user" + ], + "type": "string" + }, + "username": { + "description": "The username of the account that created the release.", + "type": "string" + } + }, + "type": "object" + }, + "model": { + "description": "The model identifier string in the format of \u0060{model_owner}/{model_name}\u0060.", + "type": "string" + }, + "number": { + "description": "The release number. This is an auto-incrementing integer that starts at 1, and is set automatically when a deployment is created.", + "type": "integer" + }, + "version": { + "description": "The ID of the model version used in the release.", + "type": "string" + } + }, + "type": "object" + }, + "name": { + "description": "The name of the deployment.", + "type": "string" + }, + "owner": { + "description": "The owner of the deployment.", + "type": "string" + } + }, + "type": "object" + }, + "type": "array" + } + }, + "type": "object" + } + } + }, + "description": "Success" + } + }, + "summary": "List deployments" + }, + "post": { + "description": "Create a new deployment:\n\nExample cURL request:\n\n\u0060\u0060\u0060console\ncurl -s \\\n -X POST \\\n -H \u0022Authorization: Bearer $REPLICATE_API_TOKEN\u0022 \\\n -H \u0022Content-Type: application/json\u0022 \\\n -d \u0027{\n \u0022name\u0022: \u0022my-app-image-generator\u0022,\n \u0022model\u0022: \u0022stability-ai/sdxl\u0022,\n \u0022version\u0022: \u0022da77bc59ee60423279fd632efb4795ab731d9e3ca9705ef3341091fb989b7eaf\u0022,\n \u0022hardware\u0022: \u0022gpu-t4\u0022,\n \u0022min_instances\u0022: 0,\n \u0022max_instances\u0022: 3\n }\u0027 \\\n https://api.replicate.com/v1/deployments\n\u0060\u0060\u0060\n\nThe response will be a JSON object describing the deployment:\n\n\u0060\u0060\u0060json\n{\n \u0022owner\u0022: \u0022acme\u0022,\n \u0022name\u0022: \u0022my-app-image-generator\u0022,\n \u0022current_release\u0022: {\n \u0022number\u0022: 1,\n \u0022model\u0022: \u0022stability-ai/sdxl\u0022,\n \u0022version\u0022: \u0022da77bc59ee60423279fd632efb4795ab731d9e3ca9705ef3341091fb989b7eaf\u0022,\n \u0022created_at\u0022: \u00222024-02-15T16:32:57.018467Z\u0022,\n \u0022created_by\u0022: {\n \u0022type\u0022: \u0022organization\u0022,\n \u0022username\u0022: \u0022acme\u0022,\n \u0022name\u0022: \u0022Acme Corp, Inc.\u0022,\n \u0022github_url\u0022: \u0022https://github.com/acme\u0022,\n },\n \u0022configuration\u0022: {\n \u0022hardware\u0022: \u0022gpu-t4\u0022,\n \u0022min_instances\u0022: 1,\n \u0022max_instances\u0022: 5\n }\n }\n}\n\u0060\u0060\u0060\n", + "operationId": "deployments.create", + "requestBody": { + "content": { + "application/json": { + "schema": { + "properties": { + "hardware": { + "description": "The SKU for the hardware used to run the model. Possible values can be retrieved from the \u0060hardware.list\u0060 endpoint.", + "type": "string" + }, + "max_instances": { + "description": "The maximum number of instances for scaling.", + "maximum": 20, + "minimum": 0, + "type": "integer" + }, + "min_instances": { + "description": "The minimum number of instances for scaling.", + "maximum": 5, + "minimum": 0, + "type": "integer" + }, + "model": { + "description": "The full name of the model that you want to deploy e.g. stability-ai/sdxl.", + "type": "string" + }, + "name": { + "description": "The name of the deployment.", + "type": "string" + }, + "version": { + "description": "The 64-character string ID of the model version that you want to deploy.", + "type": "string" + } + }, + "required": [ + "name", + "model", + "version", + "hardware", + "min_instances", + "max_instances" + ], + "type": "object" + } + } + }, + "required": true + }, + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "properties": { + "current_release": { + "properties": { + "configuration": { + "properties": { + "hardware": { + "description": "The SKU for the hardware used to run the model.", + "type": "string" + }, + "max_instances": { + "description": "The maximum number of instances for scaling.", + "type": "integer" + }, + "min_instances": { + "description": "The minimum number of instances for scaling.", + "type": "integer" + } + }, + "type": "object" + }, + "created_at": { + "description": "The time the release was created.", + "format": "date-time", + "type": "string" + }, + "created_by": { + "properties": { + "github_url": { + "description": "The GitHub URL of the account that created the release.", + "format": "uri", + "type": "string" + }, + "name": { + "description": "The name of the account that created the release.", + "type": "string" + }, + "type": { + "description": "The account type of the creator. Can be a user or an organization.", + "enum": [ + "organization", + "user" + ], + "type": "string" + }, + "username": { + "description": "The username of the account that created the release.", + "type": "string" + } + }, + "type": "object" + }, + "model": { + "description": "The model identifier string in the format of \u0060{model_owner}/{model_name}\u0060.", + "type": "string" + }, + "number": { + "description": "The release number.", + "type": "integer" + }, + "version": { + "description": "The ID of the model version used in the release.", + "type": "string" + } + }, + "type": "object" + }, + "name": { + "description": "The name of the deployment.", + "type": "string" + }, + "owner": { + "description": "The owner of the deployment.", + "type": "string" + } + }, + "type": "object" + } + } + }, + "description": "Success" + } + }, + "summary": "Create a deployment" + } + }, + "/deployments/{deployment_owner}/{deployment_name}": { + "delete": { + "description": "Delete a deployment\n\nDeployment deletion has some restrictions:\n\n- You can only delete deployments that have been offline and unused for at least 15 minutes.\n\nExample cURL request:\n\n\u0060\u0060\u0060command\ncurl -s -X DELETE \\\n -H \u0022Authorization: Bearer $REPLICATE_API_TOKEN\u0022 \\\n https://api.replicate.com/v1/deployments/acme/my-app-image-generator\n\u0060\u0060\u0060\n\nThe response will be an empty 204, indicating the deployment has been deleted.\n", + "operationId": "deployments.delete", + "parameters": [ + { + "description": "The name of the user or organization that owns the deployment.\n", + "in": "path", + "name": "deployment_owner", + "required": true, + "schema": { + "type": "string" + } + }, + { + "description": "The name of the deployment.\n", + "in": "path", + "name": "deployment_name", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "204": { + "description": "Success" + } + }, + "summary": "Delete a deployment" + }, + "get": { + "description": "Get information about a deployment by name including the current release.\n\nExample cURL request:\n\n\u0060\u0060\u0060console\ncurl -s \\\n -H \u0022Authorization: Bearer $REPLICATE_API_TOKEN\u0022 \\\n https://api.replicate.com/v1/deployments/replicate/my-app-image-generator\n\u0060\u0060\u0060\n\nThe response will be a JSON object describing the deployment:\n\n\u0060\u0060\u0060json\n{\n \u0022owner\u0022: \u0022acme\u0022,\n \u0022name\u0022: \u0022my-app-image-generator\u0022,\n \u0022current_release\u0022: {\n \u0022number\u0022: 1,\n \u0022model\u0022: \u0022stability-ai/sdxl\u0022,\n \u0022version\u0022: \u0022da77bc59ee60423279fd632efb4795ab731d9e3ca9705ef3341091fb989b7eaf\u0022,\n \u0022created_at\u0022: \u00222024-02-15T16:32:57.018467Z\u0022,\n \u0022created_by\u0022: {\n \u0022type\u0022: \u0022organization\u0022,\n \u0022username\u0022: \u0022acme\u0022,\n \u0022name\u0022: \u0022Acme Corp, Inc.\u0022,\n \u0022github_url\u0022: \u0022https://github.com/acme\u0022,\n },\n \u0022configuration\u0022: {\n \u0022hardware\u0022: \u0022gpu-t4\u0022,\n \u0022min_instances\u0022: 1,\n \u0022max_instances\u0022: 5\n }\n }\n}\n\u0060\u0060\u0060\n", + "operationId": "deployments.get", + "parameters": [ + { + "description": "The name of the user or organization that owns the deployment.\n", + "in": "path", + "name": "deployment_owner", + "required": true, + "schema": { + "type": "string" + } + }, + { + "description": "The name of the deployment.\n", + "in": "path", + "name": "deployment_name", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "properties": { + "current_release": { + "properties": { + "configuration": { + "properties": { + "hardware": { + "description": "The SKU for the hardware used to run the model.", + "type": "string" + }, + "max_instances": { + "description": "The maximum number of instances for scaling.", + "type": "integer" + }, + "min_instances": { + "description": "The minimum number of instances for scaling.", + "type": "integer" + } + }, + "type": "object" + }, + "created_at": { + "description": "The time the release was created.", + "format": "date-time", + "type": "string" + }, + "created_by": { + "properties": { + "github_url": { + "description": "The GitHub URL of the account that created the release.", + "format": "uri", + "type": "string" + }, + "name": { + "description": "The name of the account that created the release.", + "type": "string" + }, + "type": { + "description": "The account type of the creator. Can be a user or an organization.", + "enum": [ + "organization", + "user" + ], + "type": "string" + }, + "username": { + "description": "The username of the account that created the release.", + "type": "string" + } + }, + "type": "object" + }, + "model": { + "description": "The model identifier string in the format of \u0060{model_owner}/{model_name}\u0060.", + "type": "string" + }, + "number": { + "description": "The release number.", + "type": "integer" + }, + "version": { + "description": "The ID of the model version used in the release.", + "type": "string" + } + }, + "type": "object" + }, + "name": { + "description": "The name of the deployment.", + "type": "string" + }, + "owner": { + "description": "The owner of the deployment.", + "type": "string" + } + }, + "type": "object" + } + } + }, + "description": "Success" + } + }, + "summary": "Get a deployment" + }, + "patch": { + "description": "Update properties of an existing deployment, including hardware, min/max instances, and the deployment\u0027s underlying model [version](https://replicate.com/docs/how-does-replicate-work#versions).\n\nExample cURL request:\n\n\u0060\u0060\u0060console\ncurl -s \\\n -X PATCH \\\n -H \u0022Authorization: Bearer $REPLICATE_API_TOKEN\u0022 \\\n -H \u0022Content-Type: application/json\u0022 \\\n -d \u0027{\u0022min_instances\u0022: 3, \u0022max_instances\u0022: 10}\u0027 \\\n https://api.replicate.com/v1/deployments/acme/my-app-image-generator\n\u0060\u0060\u0060\n\nThe response will be a JSON object describing the deployment:\n\n\u0060\u0060\u0060json\n{\n \u0022owner\u0022: \u0022acme\u0022,\n \u0022name\u0022: \u0022my-app-image-generator\u0022,\n \u0022current_release\u0022: {\n \u0022number\u0022: 2,\n \u0022model\u0022: \u0022stability-ai/sdxl\u0022,\n \u0022version\u0022: \u0022da77bc59ee60423279fd632efb4795ab731d9e3ca9705ef3341091fb989b7eaf\u0022,\n \u0022created_at\u0022: \u00222024-02-15T16:32:57.018467Z\u0022,\n \u0022created_by\u0022: {\n \u0022type\u0022: \u0022organization\u0022,\n \u0022username\u0022: \u0022acme\u0022,\n \u0022name\u0022: \u0022Acme Corp, Inc.\u0022,\n \u0022github_url\u0022: \u0022https://github.com/acme\u0022,\n },\n \u0022configuration\u0022: {\n \u0022hardware\u0022: \u0022gpu-t4\u0022,\n \u0022min_instances\u0022: 3,\n \u0022max_instances\u0022: 10\n }\n }\n}\n\u0060\u0060\u0060\n\nUpdating any deployment properties will increment the \u0060number\u0060 field of the \u0060current_release\u0060.\n", + "operationId": "deployments.update", + "parameters": [ + { + "description": "The name of the user or organization that owns the deployment.\n", + "in": "path", + "name": "deployment_owner", + "required": true, + "schema": { + "type": "string" + } + }, + { + "description": "The name of the deployment.\n", + "in": "path", + "name": "deployment_name", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "properties": { + "hardware": { + "description": "The SKU for the hardware used to run the model. Possible values can be retrieved from the \u0060hardware.list\u0060 endpoint.", + "type": "string" + }, + "max_instances": { + "description": "The maximum number of instances for scaling.", + "maximum": 20, + "minimum": 0, + "type": "integer" + }, + "min_instances": { + "description": "The minimum number of instances for scaling.", + "maximum": 5, + "minimum": 0, + "type": "integer" + }, + "version": { + "description": "The ID of the model version that you want to deploy", + "type": "string" + } + }, + "type": "object" + } + } + } + }, + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "properties": { + "current_release": { + "properties": { + "configuration": { + "properties": { + "hardware": { + "description": "The SKU for the hardware used to run the model.", + "type": "string" + }, + "max_instances": { + "description": "The maximum number of instances for scaling.", + "type": "integer" + }, + "min_instances": { + "description": "The minimum number of instances for scaling.", + "type": "integer" + } + }, + "type": "object" + }, + "created_at": { + "description": "The time the release was created.", + "format": "date-time", + "type": "string" + }, + "created_by": { + "properties": { + "github_url": { + "description": "The GitHub URL of the account that created the release.", + "format": "uri", + "type": "string" + }, + "name": { + "description": "The name of the account that created the release.", + "type": "string" + }, + "type": { + "description": "The account type of the creator. Can be a user or an organization.", + "enum": [ + "organization", + "user" + ], + "type": "string" + }, + "username": { + "description": "The username of the account that created the release.", + "type": "string" + } + }, + "type": "object" + }, + "model": { + "description": "The model identifier string in the format of \u0060{model_owner}/{model_name}\u0060.", + "type": "string" + }, + "number": { + "description": "The release number.", + "type": "integer" + }, + "version": { + "description": "The ID of the model version used in the release.", + "type": "string" + } + }, + "type": "object" + }, + "name": { + "description": "The name of the deployment.", + "type": "string" + }, + "owner": { + "description": "The owner of the deployment.", + "type": "string" + } + }, + "type": "object" + } + } + }, + "description": "Success" + } + }, + "summary": "Update a deployment" + } + }, + "/deployments/{deployment_owner}/{deployment_name}/predictions": { + "post": { + "description": "Create a prediction for the deployment and inputs you provide.\n\nExample cURL request:\n\n\u0060\u0060\u0060console\ncurl -s -X POST -H \u0027Prefer: wait\u0027 \\\n -d \u0027{\u0022input\u0022: {\u0022prompt\u0022: \u0022A photo of a bear riding a bicycle over the moon\u0022}}\u0027 \\\n -H \u0022Authorization: Bearer $REPLICATE_API_TOKEN\u0022 \\\n -H \u0027Content-Type: application/json\u0027 \\\n https://api.replicate.com/v1/deployments/acme/my-app-image-generator/predictions\n\u0060\u0060\u0060\n\nThe request will wait up to 60 seconds for the model to run. If this time is exceeded the prediction will be returned in a \u0060\u0022starting\u0022\u0060 state and need to be retrieved using the \u0060predictions.get\u0060 endpiont.\n\nFor a complete overview of the \u0060deployments.predictions.create\u0060 API check out our documentation on [creating a prediction](https://replicate.com/docs/topics/predictions/create-a-prediction) which covers a variety of use cases.\n", + "operationId": "deployments.predictions.create", + "parameters": [ + { + "description": "The name of the user or organization that owns the deployment.\n", + "in": "path", + "name": "deployment_owner", + "required": true, + "schema": { + "type": "string" + } + }, + { + "description": "The name of the deployment.\n", + "in": "path", + "name": "deployment_name", + "required": true, + "schema": { + "type": "string" + } + }, + { + "$ref": "#/components/parameters/prefer_header" + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/prediction_request" + } + } + } + }, + "responses": { + "201": { + "description": "Prediction has been created. If the \u0060Prefer: wait\u0060 header is provided it will contain the final output." + }, + "202": { + "description": "Prediction has been created but does not yet have all outputs" + } + }, + "summary": "Create a prediction using a deployment" + } + }, + "/hardware": { + "get": { + "description": "Example cURL request:\n\n\u0060\u0060\u0060console\ncurl -s \\\n -H \u0022Authorization: Bearer $REPLICATE_API_TOKEN\u0022 \\\n https://api.replicate.com/v1/hardware\n\u0060\u0060\u0060\n\nThe response will be a JSON array of hardware objects:\n\n\u0060\u0060\u0060json\n[\n {\u0022name\u0022: \u0022CPU\u0022, \u0022sku\u0022: \u0022cpu\u0022},\n {\u0022name\u0022: \u0022Nvidia T4 GPU\u0022, \u0022sku\u0022: \u0022gpu-t4\u0022},\n {\u0022name\u0022: \u0022Nvidia A40 GPU\u0022, \u0022sku\u0022: \u0022gpu-a40-small\u0022},\n {\u0022name\u0022: \u0022Nvidia A40 (Large) GPU\u0022, \u0022sku\u0022: \u0022gpu-a40-large\u0022},\n]\n\u0060\u0060\u0060\n", + "operationId": "hardware.list", + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "items": { + "properties": { + "name": { + "description": "The name of the hardware.", + "type": "string" + }, + "sku": { + "description": "The SKU of the hardware.", + "type": "string" + } + }, + "type": "object" + }, + "type": "array" + } + } + }, + "description": "Success" + } + }, + "summary": "List available hardware for models" + } + }, + "/models": { + "get": { + "description": "Get a paginated list of public models.\n\nExample cURL request:\n\n\u0060\u0060\u0060console\ncurl -s \\\n -H \u0022Authorization: Bearer $REPLICATE_API_TOKEN\u0022 \\\n https://api.replicate.com/v1/models\n\u0060\u0060\u0060\n\nThe response will be a paginated JSON array of model objects:\n\n\u0060\u0060\u0060json\n{\n \u0022next\u0022: null,\n \u0022previous\u0022: null,\n \u0022results\u0022: [\n {\n \u0022url\u0022: \u0022https://replicate.com/acme/hello-world\u0022,\n \u0022owner\u0022: \u0022acme\u0022,\n \u0022name\u0022: \u0022hello-world\u0022,\n \u0022description\u0022: \u0022A tiny model that says hello\u0022,\n \u0022visibility\u0022: \u0022public\u0022,\n \u0022github_url\u0022: \u0022https://github.com/replicate/cog-examples\u0022,\n \u0022paper_url\u0022: null,\n \u0022license_url\u0022: null,\n \u0022run_count\u0022: 5681081,\n \u0022cover_image_url\u0022: \u0022...\u0022,\n \u0022default_example\u0022: {...},\n \u0022latest_version\u0022: {...}\n }\n ]\n}\n\u0060\u0060\u0060\n\nThe \u0060cover_image_url\u0060 string is an HTTPS URL for an image file. This can be:\n\n- An image uploaded by the model author.\n- The output file of the example prediction, if the model author has not set a cover image.\n- The input file of the example prediction, if the model author has not set a cover image and the example prediction has no output file.\n- A generic fallback image.\n", + "operationId": "models.list", + "responses": { + "200": { + "description": "Success" + } + }, + "summary": "List public models" + }, + "post": { + "description": "Create a model.\n\nExample cURL request:\n\n\u0060\u0060\u0060console\ncurl -s -X POST \\\n -H \u0022Authorization: Bearer $REPLICATE_API_TOKEN\u0022 \\\n -H \u0027Content-Type: application/json\u0027 \\\n -d \u0027{\u0022owner\u0022: \u0022alice\u0022, \u0022name\u0022: \u0022my-model\u0022, \u0022description\u0022: \u0022An example model\u0022, \u0022visibility\u0022: \u0022public\u0022, \u0022hardware\u0022: \u0022cpu\u0022}\u0027 \\\n https://api.replicate.com/v1/models\n\u0060\u0060\u0060\n\nThe response will be a model object in the following format:\n\n\u0060\u0060\u0060json\n{\n \u0022url\u0022: \u0022https://replicate.com/alice/my-model\u0022,\n \u0022owner\u0022: \u0022alice\u0022,\n \u0022name\u0022: \u0022my-model\u0022,\n \u0022description\u0022: \u0022An example model\u0022,\n \u0022visibility\u0022: \u0022public\u0022,\n \u0022github_url\u0022: null,\n \u0022paper_url\u0022: null,\n \u0022license_url\u0022: null,\n \u0022run_count\u0022: 0,\n \u0022cover_image_url\u0022: null,\n \u0022default_example\u0022: null,\n \u0022latest_version\u0022: null,\n}\n\u0060\u0060\u0060\n\nNote that there is a limit of 1,000 models per account. For most purposes, we recommend using a single model and pushing new [versions](https://replicate.com/docs/how-does-replicate-work#versions) of the model as you make changes to it.\n", + "operationId": "models.create", + "requestBody": { + "content": { + "application/json": { + "schema": { + "properties": { + "cover_image_url": { + "description": "A URL for the model\u0027s cover image. This should be an image file.", + "type": "string" + }, + "description": { + "description": "A description of the model.", + "type": "string" + }, + "github_url": { + "description": "A URL for the model\u0027s source code on GitHub.", + "type": "string" + }, + "hardware": { + "description": "The SKU for the hardware used to run the model. Possible values can be retrieved from the \u0060hardware.list\u0060 endpoint.", + "type": "string" + }, + "license_url": { + "description": "A URL for the model\u0027s license.", + "type": "string" + }, + "name": { + "description": "The name of the model. This must be unique among all models owned by the user or organization.", + "type": "string" + }, + "owner": { + "description": "The name of the user or organization that will own the model. This must be the same as the user or organization that is making the API request. In other words, the API token used in the request must belong to this user or organization.", + "type": "string" + }, + "paper_url": { + "description": "A URL for the model\u0027s paper.", + "type": "string" + }, + "visibility": { + "description": "Whether the model should be public or private. A public model can be viewed and run by anyone, whereas a private model can be viewed and run only by the user or organization members that own the model.", + "enum": [ + "public", + "private" + ], + "type": "string" + } + }, + "required": [ + "owner", + "name", + "visibility", + "hardware" + ], + "type": "object" + } + } + }, + "required": true + }, + "responses": { + "201": { + "description": "Success" + } + }, + "summary": "Create a model" + }, + "query": { + "description": "Get a list of public models matching a search query.\n\nExample cURL request:\n\n\u0060\u0060\u0060console\ncurl -s -X QUERY \\\n -H \u0022Authorization: Bearer $REPLICATE_API_TOKEN\u0022 \\\n -H \u0022Content-Type: text/plain\u0022 \\\n -d \u0022hello\u0022 \\\n https://api.replicate.com/v1/models\n\u0060\u0060\u0060\n\nThe response will be a paginated JSON object containing an array of model objects:\n\n\u0060\u0060\u0060json\n{\n \u0022next\u0022: null,\n \u0022previous\u0022: null,\n \u0022results\u0022: [\n {\n \u0022url\u0022: \u0022https://replicate.com/acme/hello-world\u0022,\n \u0022owner\u0022: \u0022acme\u0022,\n \u0022name\u0022: \u0022hello-world\u0022,\n \u0022description\u0022: \u0022A tiny model that says hello\u0022,\n \u0022visibility\u0022: \u0022public\u0022,\n \u0022github_url\u0022: \u0022https://github.com/replicate/cog-examples\u0022,\n \u0022paper_url\u0022: null,\n \u0022license_url\u0022: null,\n \u0022run_count\u0022: 5681081,\n \u0022cover_image_url\u0022: \u0022...\u0022,\n \u0022default_example\u0022: {...},\n \u0022latest_version\u0022: {...}\n }\n ]\n}\n\u0060\u0060\u0060\n\nThe \u0060cover_image_url\u0060 string is an HTTPS URL for an image file. This can be:\n\n- An image uploaded by the model author.\n- The output file of the example prediction, if the model author has not set a cover image.\n- The input file of the example prediction, if the model author has not set a cover image and the example prediction has no output file.\n- A generic fallback image.\n", + "operationId": "models.search", + "requestBody": { + "content": { + "text/plain": { + "schema": { + "description": "The search query", + "type": "string" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "Success" + } + }, + "summary": "Search public models" + } + }, + "/models/{model_owner}/{model_name}": { + "delete": { + "description": "Delete a model\n\nModel deletion has some restrictions:\n\n- You can only delete models you own.\n- You can only delete private models.\n- You can only delete models that have no versions associated with them. Currently you\u0027ll need to [delete the model\u0027s versions](#models.versions.delete) before you can delete the model itself.\n\nExample cURL request:\n\n\u0060\u0060\u0060command\ncurl -s -X DELETE \\\n -H \u0022Authorization: Bearer $REPLICATE_API_TOKEN\u0022 \\\n https://api.replicate.com/v1/models/replicate/hello-world\n\u0060\u0060\u0060\n\nThe response will be an empty 204, indicating the model has been deleted.\n", + "operationId": "models.delete", + "parameters": [ + { + "description": "The name of the user or organization that owns the model.\n", + "in": "path", + "name": "model_owner", + "required": true, + "schema": { + "type": "string" + } + }, + { + "description": "The name of the model.\n", + "in": "path", + "name": "model_name", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "204": { + "description": "Success" + } + }, + "summary": "Delete a model" + }, + "get": { + "description": "Example cURL request:\n\n\u0060\u0060\u0060console\ncurl -s \\\n -H \u0022Authorization: Bearer $REPLICATE_API_TOKEN\u0022 \\\n https://api.replicate.com/v1/models/replicate/hello-world\n\u0060\u0060\u0060\n\nThe response will be a model object in the following format:\n\n\u0060\u0060\u0060json\n{\n \u0022url\u0022: \u0022https://replicate.com/replicate/hello-world\u0022,\n \u0022owner\u0022: \u0022replicate\u0022,\n \u0022name\u0022: \u0022hello-world\u0022,\n \u0022description\u0022: \u0022A tiny model that says hello\u0022,\n \u0022visibility\u0022: \u0022public\u0022,\n \u0022github_url\u0022: \u0022https://github.com/replicate/cog-examples\u0022,\n \u0022paper_url\u0022: null,\n \u0022license_url\u0022: null,\n \u0022run_count\u0022: 5681081,\n \u0022cover_image_url\u0022: \u0022...\u0022,\n \u0022default_example\u0022: {...},\n \u0022latest_version\u0022: {...},\n}\n\u0060\u0060\u0060\n\nThe \u0060cover_image_url\u0060 string is an HTTPS URL for an image file. This can be:\n\n- An image uploaded by the model author.\n- The output file of the example prediction, if the model author has not set a cover image.\n- The input file of the example prediction, if the model author has not set a cover image and the example prediction has no output file.\n- A generic fallback image.\n\nThe \u0060default_example\u0060 object is a [prediction](#predictions.get) created with this model.\n\nThe \u0060latest_version\u0060 object is the model\u0027s most recently pushed [version](#models.versions.get).\n", + "operationId": "models.get", + "parameters": [ + { + "description": "The name of the user or organization that owns the model.\n", + "in": "path", + "name": "model_owner", + "required": true, + "schema": { + "type": "string" + } + }, + { + "description": "The name of the model.\n", + "in": "path", + "name": "model_name", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Success" + } + }, + "summary": "Get a model" + } + }, + "/models/{model_owner}/{model_name}/predictions": { + "post": { + "description": "Create a prediction for the deployment and inputs you provide.\n\nExample cURL request:\n\n\u0060\u0060\u0060console\ncurl -s -X POST -H \u0027Prefer: wait\u0027 \\\n -d \u0027{\u0022input\u0022: {\u0022prompt\u0022: \u0022Write a short poem about the weather.\u0022}}\u0027 \\\n -H \u0022Authorization: Bearer $REPLICATE_API_TOKEN\u0022 \\\n -H \u0027Content-Type: application/json\u0027 \\\n https://api.replicate.com/v1/models/meta/meta-llama-3-70b-instruct/predictions\n\u0060\u0060\u0060\n\nThe request will wait up to 60 seconds for the model to run. If this time is exceeded the prediction will be returned in a \u0060\u0022starting\u0022\u0060 state and need to be retrieved using the \u0060predictions.get\u0060 endpiont.\n\nFor a complete overview of the \u0060deployments.predictions.create\u0060 API check out our documentation on [creating a prediction](https://replicate.com/docs/topics/predictions/create-a-prediction) which covers a variety of use cases.\n", + "operationId": "models.predictions.create", + "parameters": [ + { + "description": "The name of the user or organization that owns the model.\n", + "in": "path", + "name": "model_owner", + "required": true, + "schema": { + "type": "string" + } + }, + { + "description": "The name of the model.\n", + "in": "path", + "name": "model_name", + "required": true, + "schema": { + "type": "string" + } + }, + { + "$ref": "#/components/parameters/prefer_header" + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/prediction_request" + } + } + } + }, + "responses": { + "201": { + "description": "Prediction has been created. If the \u0060Prefer: wait\u0060 header is provided it will contain the final output." + }, + "202": { + "description": "Prediction has been created but does not yet have all outputs" + } + }, + "summary": "Create a prediction using an official model" + } + }, + "/models/{model_owner}/{model_name}/versions": { + "get": { + "description": "Example cURL request:\n\n\u0060\u0060\u0060console\ncurl -s \\\n -H \u0022Authorization: Bearer $REPLICATE_API_TOKEN\u0022 \\\n https://api.replicate.com/v1/models/replicate/hello-world/versions\n\u0060\u0060\u0060\n\nThe response will be a JSON array of model version objects, sorted with the most recent version first:\n\n\u0060\u0060\u0060json\n{\n \u0022next\u0022: null,\n \u0022previous\u0022: null,\n \u0022results\u0022: [\n {\n \u0022id\u0022: \u00225c7d5dc6dd8bf75c1acaa8565735e7986bc5b66206b55cca93cb72c9bf15ccaa\u0022,\n \u0022created_at\u0022: \u00222022-04-26T19:29:04.418669Z\u0022,\n \u0022cog_version\u0022: \u00220.3.0\u0022,\n \u0022openapi_schema\u0022: {...}\n }\n ]\n}\n\u0060\u0060\u0060\n", + "operationId": "models.versions.list", + "parameters": [ + { + "description": "The name of the user or organization that owns the model.\n", + "in": "path", + "name": "model_owner", + "required": true, + "schema": { + "type": "string" + } + }, + { + "description": "The name of the model.\n", + "in": "path", + "name": "model_name", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Success" + } + }, + "summary": "List model versions" + } + }, + "/models/{model_owner}/{model_name}/versions/{version_id}": { + "delete": { + "description": "Delete a model version and all associated predictions, including all output files.\n\nModel version deletion has some restrictions:\n\n- You can only delete versions from models you own.\n- You can only delete versions from private models.\n- You cannot delete a version if someone other than you has run predictions with it.\n- You cannot delete a version if it is being used as the base model for a fine tune/training.\n- You cannot delete a version if it has an associated deployment.\n- You cannot delete a version if another model version is overridden to use it.\n\nExample cURL request:\n\n\u0060\u0060\u0060command\ncurl -s -X DELETE \\\n -H \u0022Authorization: Bearer $REPLICATE_API_TOKEN\u0022 \\\n https://api.replicate.com/v1/models/replicate/hello-world/versions/5c7d5dc6dd8bf75c1acaa8565735e7986bc5b66206b55cca93cb72c9bf15ccaa\n\u0060\u0060\u0060\n\nThe response will be an empty 202, indicating the deletion request has been accepted. It might take a few minutes to be processed.\n", + "operationId": "models.versions.delete", + "parameters": [ + { + "description": "The name of the user or organization that owns the model.\n", + "in": "path", + "name": "model_owner", + "required": true, + "schema": { + "type": "string" + } + }, + { + "description": "The name of the model.\n", + "in": "path", + "name": "model_name", + "required": true, + "schema": { + "type": "string" + } + }, + { + "description": "The ID of the version.\n", + "in": "path", + "name": "version_id", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "202": { + "description": "Deletion request has been accepted. It might take a few minutes to be processed." + } + }, + "summary": "Delete a model version" + }, + "get": { + "description": "Example cURL request:\n\n\u0060\u0060\u0060console\ncurl -s \\\n -H \u0022Authorization: Bearer $REPLICATE_API_TOKEN\u0022 \\\n https://api.replicate.com/v1/models/replicate/hello-world/versions/5c7d5dc6dd8bf75c1acaa8565735e7986bc5b66206b55cca93cb72c9bf15ccaa\n\u0060\u0060\u0060\n\nThe response will be the version object:\n\n\u0060\u0060\u0060json\n{\n \u0022id\u0022: \u00225c7d5dc6dd8bf75c1acaa8565735e7986bc5b66206b55cca93cb72c9bf15ccaa\u0022,\n \u0022created_at\u0022: \u00222022-04-26T19:29:04.418669Z\u0022,\n \u0022cog_version\u0022: \u00220.3.0\u0022,\n \u0022openapi_schema\u0022: {...}\n}\n\u0060\u0060\u0060\n\nEvery model describes its inputs and outputs with [OpenAPI Schema Objects](https://spec.openapis.org/oas/latest.html#schemaObject) in the \u0060openapi_schema\u0060 property.\n\nThe \u0060openapi_schema.components.schemas.Input\u0060 property for the [replicate/hello-world](https://replicate.com/replicate/hello-world) model looks like this:\n\n\u0060\u0060\u0060json\n{\n \u0022type\u0022: \u0022object\u0022,\n \u0022title\u0022: \u0022Input\u0022,\n \u0022required\u0022: [\n \u0022text\u0022\n ],\n \u0022properties\u0022: {\n \u0022text\u0022: {\n \u0022x-order\u0022: 0,\n \u0022type\u0022: \u0022string\u0022,\n \u0022title\u0022: \u0022Text\u0022,\n \u0022description\u0022: \u0022Text to prefix with \u0027hello \u0027\u0022\n }\n }\n}\n\u0060\u0060\u0060\n\nThe \u0060openapi_schema.components.schemas.Output\u0060 property for the [replicate/hello-world](https://replicate.com/replicate/hello-world) model looks like this:\n\n\u0060\u0060\u0060json\n{\n \u0022type\u0022: \u0022string\u0022,\n \u0022title\u0022: \u0022Output\u0022\n}\n\u0060\u0060\u0060\n\nFor more details, see the docs on [Cog\u0027s supported input and output types](https://github.com/replicate/cog/blob/75b7802219e7cd4cee845e34c4c22139558615d4/docs/python.md#input-and-output-types)\n", + "operationId": "models.versions.get", + "parameters": [ + { + "description": "The name of the user or organization that owns the model.\n", + "in": "path", + "name": "model_owner", + "required": true, + "schema": { + "type": "string" + } + }, + { + "description": "The name of the model.\n", + "in": "path", + "name": "model_name", + "required": true, + "schema": { + "type": "string" + } + }, + { + "description": "The ID of the version.\n", + "in": "path", + "name": "version_id", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Success" + } + }, + "summary": "Get a model version" + } + }, + "/models/{model_owner}/{model_name}/versions/{version_id}/trainings": { + "post": { + "description": "Start a new training of the model version you specify.\n\nExample request body:\n\n\u0060\u0060\u0060json\n{\n \u0022destination\u0022: \u0022{new_owner}/{new_name}\u0022,\n \u0022input\u0022: {\n \u0022train_data\u0022: \u0022https://example.com/my-input-images.zip\u0022,\n },\n \u0022webhook\u0022: \u0022https://example.com/my-webhook\u0022,\n}\n\u0060\u0060\u0060\n\nExample cURL request:\n\n\u0060\u0060\u0060console\ncurl -s -X POST \\\n -d \u0027{\u0022destination\u0022: \u0022{new_owner}/{new_name}\u0022, \u0022input\u0022: {\u0022input_images\u0022: \u0022https://example.com/my-input-images.zip\u0022}}\u0027 \\\n -H \u0022Authorization: Bearer $REPLICATE_API_TOKEN\u0022 \\\n -H \u0027Content-Type: application/json\u0027 \\\n https://api.replicate.com/v1/models/stability-ai/sdxl/versions/da77bc59ee60423279fd632efb4795ab731d9e3ca9705ef3341091fb989b7eaf/trainings\n\u0060\u0060\u0060\n\nThe response will be the training object:\n\n\u0060\u0060\u0060json\n{\n \u0022id\u0022: \u0022zz4ibbonubfz7carwiefibzgga\u0022,\n \u0022model\u0022: \u0022stability-ai/sdxl\u0022,\n \u0022version\u0022: \u0022da77bc59ee60423279fd632efb4795ab731d9e3ca9705ef3341091fb989b7eaf\u0022,\n \u0022input\u0022: {\n \u0022input_images\u0022: \u0022https://example.com/my-input-images.zip\u0022\n },\n \u0022logs\u0022: \u0022\u0022,\n \u0022error\u0022: null,\n \u0022status\u0022: \u0022starting\u0022,\n \u0022created_at\u0022: \u00222023-09-08T16:32:56.990893084Z\u0022,\n \u0022urls\u0022: {\n \u0022cancel\u0022: \u0022https://api.replicate.com/v1/predictions/zz4ibbonubfz7carwiefibzgga/cancel\u0022,\n \u0022get\u0022: \u0022https://api.replicate.com/v1/predictions/zz4ibbonubfz7carwiefibzgga\u0022\n }\n}\n\u0060\u0060\u0060\n\nAs models can take several minutes or more to train, the result will not be available immediately. To get the final result of the training you should either provide a \u0060webhook\u0060 HTTPS URL for us to call when the results are ready, or poll the [get a training](#trainings.get) endpoint until it has finished.\n\nWhen a training completes, it creates a new [version](https://replicate.com/docs/how-does-replicate-work#terminology) of the model at the specified destination.\n\nTo find some models to train on, check out the [trainable language models collection](https://replicate.com/collections/trainable-language-models).\n", + "operationId": "trainings.create", + "parameters": [ + { + "description": "The name of the user or organization that owns the model.\n", + "in": "path", + "name": "model_owner", + "required": true, + "schema": { + "type": "string" + } + }, + { + "description": "The name of the model.\n", + "in": "path", + "name": "model_name", + "required": true, + "schema": { + "type": "string" + } + }, + { + "description": "The ID of the version.\n", + "in": "path", + "name": "version_id", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/training_request" + } + } + } + }, + "responses": { + "201": { + "description": "Success" + } + }, + "summary": "Create a training" + } + }, + "/predictions": { + "get": { + "description": "Get a paginated list of predictions that you\u0027ve created. This will include predictions created from the API and the website. It will return 100 records per page.\n\nExample cURL request:\n\n\u0060\u0060\u0060console\ncurl -s \\\n -H \u0022Authorization: Bearer $REPLICATE_API_TOKEN\u0022 \\\n https://api.replicate.com/v1/predictions\n\u0060\u0060\u0060\n\nThe response will be a paginated JSON array of prediction objects, sorted with the most recent prediction first:\n\n\u0060\u0060\u0060json\n{\n \u0022next\u0022: null,\n \u0022previous\u0022: null,\n \u0022results\u0022: [\n {\n \u0022completed_at\u0022: \u00222023-09-08T16:19:34.791859Z\u0022,\n \u0022created_at\u0022: \u00222023-09-08T16:19:34.907244Z\u0022,\n \u0022data_removed\u0022: false,\n \u0022error\u0022: null,\n \u0022id\u0022: \u0022gm3qorzdhgbfurvjtvhg6dckhu\u0022,\n \u0022input\u0022: {\n \u0022text\u0022: \u0022Alice\u0022\n },\n \u0022metrics\u0022: {\n \u0022predict_time\u0022: 0.012683\n },\n \u0022output\u0022: \u0022hello Alice\u0022,\n \u0022started_at\u0022: \u00222023-09-08T16:19:34.779176Z\u0022,\n \u0022source\u0022: \u0022api\u0022,\n \u0022status\u0022: \u0022succeeded\u0022,\n \u0022urls\u0022: {\n \u0022get\u0022: \u0022https://api.replicate.com/v1/predictions/gm3qorzdhgbfurvjtvhg6dckhu\u0022,\n \u0022cancel\u0022: \u0022https://api.replicate.com/v1/predictions/gm3qorzdhgbfurvjtvhg6dckhu/cancel\u0022\n },\n \u0022model\u0022: \u0022replicate/hello-world\u0022,\n \u0022version\u0022: \u00225c7d5dc6dd8bf75c1acaa8565735e7986bc5b66206b55cca93cb72c9bf15ccaa\u0022,\n }\n ]\n}\n\u0060\u0060\u0060\n\n\u0060id\u0060 will be the unique ID of the prediction.\n\n\u0060source\u0060 will indicate how the prediction was created. Possible values are \u0060web\u0060 or \u0060api\u0060.\n\n\u0060status\u0060 will be the status of the prediction. Refer to [get a single prediction](#predictions.get) for possible values.\n\n\u0060urls\u0060 will be a convenience object that can be used to construct new API requests for the given prediction. If the requested model version supports streaming, this will have a \u0060stream\u0060 entry with an HTTPS URL that you can use to construct an [\u0060EventSource\u0060](https://developer.mozilla.org/en-US/docs/Web/API/EventSource).\n\n\u0060model\u0060 will be the model identifier string in the format of \u0060{model_owner}/{model_name}\u0060.\n\n\u0060version\u0060 will be the unique ID of model version used to create the prediction.\n\n\u0060data_removed\u0060 will be \u0060true\u0060 if the input and output data has been deleted.\n", + "operationId": "predictions.list", + "responses": { + "200": { + "description": "Success" + } + }, + "summary": "List predictions" + }, + "post": { + "description": "Create a prediction for the model version and inputs you provide.\n\nExample cURL request:\n\n\u0060\u0060\u0060console\ncurl -s -X POST -H \u0027Prefer: wait\u0027 \\\n -d \u0027{\u0022version\u0022: \u00225c7d5dc6dd8bf75c1acaa8565735e7986bc5b66206b55cca93cb72c9bf15ccaa\u0022, \u0022input\u0022: {\u0022text\u0022: \u0022Alice\u0022}}\u0027 \\\n -H \u0022Authorization: Bearer $REPLICATE_API_TOKEN\u0022 \\\n -H \u0027Content-Type: application/json\u0027 \\\n https://api.replicate.com/v1/predictions\n\u0060\u0060\u0060\n\nThe request will wait up to 60 seconds for the model to run. If this time is exceeded the prediction will be returned in a \u0060\u0022starting\u0022\u0060 state and need to be retrieved using the \u0060predictions.get\u0060 endpiont.\n\nFor a complete overview of the \u0060predictions.create\u0060 API check out our documentation on [creating a prediction](https://replicate.com/docs/topics/predictions/create-a-prediction) which covers a variety of use cases.\n", + "operationId": "predictions.create", + "parameters": [ + { + "$ref": "#/components/parameters/prefer_header" + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/version_prediction_request" + } + } + } + }, + "responses": { + "201": { + "description": "Prediction has been created. If the \u0060Prefer: wait\u0060 header is provided it will contain the final output." + }, + "202": { + "description": "Prediction has been created but does not yet have all outputs" + } + }, + "summary": "Create a prediction" + } + }, + "/predictions/{prediction_id}": { + "get": { + "description": "Get the current state of a prediction.\n\nExample cURL request:\n\n\u0060\u0060\u0060console\ncurl -s \\\n -H \u0022Authorization: Bearer $REPLICATE_API_TOKEN\u0022 \\\n https://api.replicate.com/v1/predictions/gm3qorzdhgbfurvjtvhg6dckhu\n\u0060\u0060\u0060\n\nThe response will be the prediction object:\n\n\u0060\u0060\u0060json\n{\n \u0022id\u0022: \u0022gm3qorzdhgbfurvjtvhg6dckhu\u0022,\n \u0022model\u0022: \u0022replicate/hello-world\u0022,\n \u0022version\u0022: \u00225c7d5dc6dd8bf75c1acaa8565735e7986bc5b66206b55cca93cb72c9bf15ccaa\u0022,\n \u0022input\u0022: {\n \u0022text\u0022: \u0022Alice\u0022\n },\n \u0022logs\u0022: \u0022\u0022,\n \u0022output\u0022: \u0022hello Alice\u0022,\n \u0022error\u0022: null,\n \u0022status\u0022: \u0022succeeded\u0022,\n \u0022created_at\u0022: \u00222023-09-08T16:19:34.765994Z\u0022,\n \u0022data_removed\u0022: false,\n \u0022started_at\u0022: \u00222023-09-08T16:19:34.779176Z\u0022,\n \u0022completed_at\u0022: \u00222023-09-08T16:19:34.791859Z\u0022,\n \u0022metrics\u0022: {\n \u0022predict_time\u0022: 0.012683\n },\n \u0022urls\u0022: {\n \u0022cancel\u0022: \u0022https://api.replicate.com/v1/predictions/gm3qorzdhgbfurvjtvhg6dckhu/cancel\u0022,\n \u0022get\u0022: \u0022https://api.replicate.com/v1/predictions/gm3qorzdhgbfurvjtvhg6dckhu\u0022\n }\n}\n\u0060\u0060\u0060\n\n\u0060status\u0060 will be one of:\n\n- \u0060starting\u0060: the prediction is starting up. If this status lasts longer than a few seconds, then it\u0027s typically because a new worker is being started to run the prediction.\n- \u0060processing\u0060: the \u0060predict()\u0060 method of the model is currently running.\n- \u0060succeeded\u0060: the prediction completed successfully.\n- \u0060failed\u0060: the prediction encountered an error during processing.\n- \u0060canceled\u0060: the prediction was canceled by its creator.\n\nIn the case of success, \u0060output\u0060 will be an object containing the output of the model. Any files will be represented as HTTPS URLs. You\u0027ll need to pass the \u0060Authorization\u0060 header to request them.\n\nIn the case of failure, \u0060error\u0060 will contain the error encountered during the prediction.\n\nTerminated predictions (with a status of \u0060succeeded\u0060, \u0060failed\u0060, or \u0060canceled\u0060) will include a \u0060metrics\u0060 object with a \u0060predict_time\u0060 property showing the amount of CPU or GPU time, in seconds, that the prediction used while running. It won\u0027t include time waiting for the prediction to start.\n\nAll input parameters, output values, and logs are automatically removed after an hour, by default, for predictions created through the API.\n\nYou must save a copy of any data or files in the output if you\u0027d like to continue using them. The \u0060output\u0060 key will still be present, but it\u0027s value will be \u0060null\u0060 after the output has been removed.\n\nOutput files are served by \u0060replicate.delivery\u0060 and its subdomains. If you use an allow list of external domains for your assets, add \u0060replicate.delivery\u0060 and \u0060*.replicate.delivery\u0060 to it.\n", + "operationId": "predictions.get", + "parameters": [ + { + "description": "The ID of the prediction to get.\n", + "in": "path", + "name": "prediction_id", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Success" + } + }, + "summary": "Get a prediction" + } + }, + "/predictions/{prediction_id}/cancel": { + "post": { + "operationId": "predictions.cancel", + "parameters": [ + { + "description": "The ID of the prediction to cancel.\n", + "in": "path", + "name": "prediction_id", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Success" + } + }, + "summary": "Cancel a prediction" + } + }, + "/trainings": { + "get": { + "description": "Get a paginated list of trainings that you\u0027ve created. This will include trainings created from the API and the website. It will return 100 records per page.\n\nExample cURL request:\n\n\u0060\u0060\u0060console\ncurl -s \\\n -H \u0022Authorization: Bearer $REPLICATE_API_TOKEN\u0022 \\\n https://api.replicate.com/v1/trainings\n\u0060\u0060\u0060\n\nThe response will be a paginated JSON array of training objects, sorted with the most recent training first:\n\n\u0060\u0060\u0060json\n{\n \u0022next\u0022: null,\n \u0022previous\u0022: null,\n \u0022results\u0022: [\n {\n \u0022completed_at\u0022: \u00222023-09-08T16:41:19.826523Z\u0022,\n \u0022created_at\u0022: \u00222023-09-08T16:32:57.018467Z\u0022,\n \u0022error\u0022: null,\n \u0022id\u0022: \u0022zz4ibbonubfz7carwiefibzgga\u0022,\n \u0022input\u0022: {\n \u0022input_images\u0022: \u0022https://example.com/my-input-images.zip\u0022\n },\n \u0022metrics\u0022: {\n \u0022predict_time\u0022: 502.713876\n },\n \u0022output\u0022: {\n \u0022version\u0022: \u0022...\u0022,\n \u0022weights\u0022: \u0022...\u0022\n },\n \u0022started_at\u0022: \u00222023-09-08T16:32:57.112647Z\u0022,\n \u0022source\u0022: \u0022api\u0022,\n \u0022status\u0022: \u0022succeeded\u0022,\n \u0022urls\u0022: {\n \u0022get\u0022: \u0022https://api.replicate.com/v1/trainings/zz4ibbonubfz7carwiefibzgga\u0022,\n \u0022cancel\u0022: \u0022https://api.replicate.com/v1/trainings/zz4ibbonubfz7carwiefibzgga/cancel\u0022\n },\n \u0022model\u0022: \u0022stability-ai/sdxl\u0022,\n \u0022version\u0022: \u0022da77bc59ee60423279fd632efb4795ab731d9e3ca9705ef3341091fb989b7eaf\u0022,\n }\n ]\n}\n\u0060\u0060\u0060\n\n\u0060id\u0060 will be the unique ID of the training.\n\n\u0060source\u0060 will indicate how the training was created. Possible values are \u0060web\u0060 or \u0060api\u0060.\n\n\u0060status\u0060 will be the status of the training. Refer to [get a single training](#trainings.get) for possible values.\n\n\u0060urls\u0060 will be a convenience object that can be used to construct new API requests for the given training.\n\n\u0060version\u0060 will be the unique ID of model version used to create the training.\n", + "operationId": "trainings.list", + "responses": { + "200": { + "description": "Success" + } + }, + "summary": "List trainings" + } + }, + "/trainings/{training_id}": { + "get": { + "description": "Get the current state of a training.\n\nExample cURL request:\n\n\u0060\u0060\u0060console\ncurl -s \\\n -H \u0022Authorization: Bearer $REPLICATE_API_TOKEN\u0022 \\\n https://api.replicate.com/v1/trainings/zz4ibbonubfz7carwiefibzgga\n\u0060\u0060\u0060\n\nThe response will be the training object:\n\n\u0060\u0060\u0060json\n{\n \u0022completed_at\u0022: \u00222023-09-08T16:41:19.826523Z\u0022,\n \u0022created_at\u0022: \u00222023-09-08T16:32:57.018467Z\u0022,\n \u0022error\u0022: null,\n \u0022id\u0022: \u0022zz4ibbonubfz7carwiefibzgga\u0022,\n \u0022input\u0022: {\n \u0022input_images\u0022: \u0022https://example.com/my-input-images.zip\u0022\n },\n \u0022logs\u0022: \u0022...\u0022,\n \u0022metrics\u0022: {\n \u0022predict_time\u0022: 502.713876\n },\n \u0022output\u0022: {\n \u0022version\u0022: \u0022...\u0022,\n \u0022weights\u0022: \u0022...\u0022\n },\n \u0022started_at\u0022: \u00222023-09-08T16:32:57.112647Z\u0022,\n \u0022status\u0022: \u0022succeeded\u0022,\n \u0022urls\u0022: {\n \u0022get\u0022: \u0022https://api.replicate.com/v1/trainings/zz4ibbonubfz7carwiefibzgga\u0022,\n \u0022cancel\u0022: \u0022https://api.replicate.com/v1/trainings/zz4ibbonubfz7carwiefibzgga/cancel\u0022\n },\n \u0022model\u0022: \u0022stability-ai/sdxl\u0022,\n \u0022version\u0022: \u0022da77bc59ee60423279fd632efb4795ab731d9e3ca9705ef3341091fb989b7eaf\u0022,\n}\n\u0060\u0060\u0060\n\n\u0060status\u0060 will be one of:\n\n- \u0060starting\u0060: the training is starting up. If this status lasts longer than a few seconds, then it\u0027s typically because a new worker is being started to run the training.\n- \u0060processing\u0060: the \u0060train()\u0060 method of the model is currently running.\n- \u0060succeeded\u0060: the training completed successfully.\n- \u0060failed\u0060: the training encountered an error during processing.\n- \u0060canceled\u0060: the training was canceled by its creator.\n\nIn the case of success, \u0060output\u0060 will be an object containing the output of the model. Any files will be represented as HTTPS URLs. You\u0027ll need to pass the \u0060Authorization\u0060 header to request them.\n\nIn the case of failure, \u0060error\u0060 will contain the error encountered during the training.\n\nTerminated trainings (with a status of \u0060succeeded\u0060, \u0060failed\u0060, or \u0060canceled\u0060) will include a \u0060metrics\u0060 object with a \u0060predict_time\u0060 property showing the amount of CPU or GPU time, in seconds, that the training used while running. It won\u0027t include time waiting for the training to start.\n", + "operationId": "trainings.get", + "parameters": [ + { + "description": "The ID of the training to get.\n", + "in": "path", + "name": "training_id", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Success" + } + }, + "summary": "Get a training" + } + }, + "/trainings/{training_id}/cancel": { + "post": { + "operationId": "trainings.cancel", + "parameters": [ + { + "description": "The ID of the training you want to cancel.\n", + "in": "path", + "name": "training_id", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Success" + } + }, + "summary": "Cancel a training" + } + }, + "/webhooks/default/secret": { + "get": { + "description": "Get the signing secret for the default webhook endpoint. This is used to verify that webhook requests are coming from Replicate.\n\nExample cURL request:\n\n\u0060\u0060\u0060console\ncurl -s \\\n -H \u0022Authorization: Bearer $REPLICATE_API_TOKEN\u0022 \\\n https://api.replicate.com/v1/webhooks/default/secret\n\u0060\u0060\u0060\n\nThe response will be a JSON object with a \u0060key\u0060 property:\n\n\u0060\u0060\u0060json\n{\n \u0022key\u0022: \u0022...\u0022\n}\n\u0060\u0060\u0060\n", + "operationId": "webhooks.default.secret.get", + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "properties": { + "key": { + "description": "The signing secret.", + "type": "string" + } + }, + "type": "object" + } + } + }, + "description": "Success" + } + }, + "summary": "Get the signing secret for the default webhook" + } + } + }, + "security": [ + { + "bearerAuth": [] + } + ], + "servers": [ + { + "url": "https://api.replicate.com/v1" + } + ] +} \ No newline at end of file diff --git a/src/tests/AutoSDK.UnitTests/ValidationTests.cs b/src/tests/AutoSDK.UnitTests/ValidationTests.cs index 4c559224aa..11da907be2 100644 --- a/src/tests/AutoSDK.UnitTests/ValidationTests.cs +++ b/src/tests/AutoSDK.UnitTests/ValidationTests.cs @@ -22,7 +22,7 @@ public class ValidationTests : VerifyBase [DataRow("ollama.yaml")] [DataRow("openai.yaml")] [DataRow("petstore.yaml")] - [DataRow("replicate.yaml")] + [DataRow("replicate.json")] [DataRow("special-cases.yaml")] [DataRow("together.yaml")] [DataRow("mystic.yaml")]