POST /v1/generate
This API is marked as "Legacy" and is no longer maintained. Follow the [migration guide](https://docs.cohere.com/docs/migrating-from-cogenerate-to-cochat) to start using the Chat API. Generates realistic text conditioned on a given input.Servers
- https://api.cohere.com
Request headers
Name | Type | Required | Description |
---|---|---|---|
Content-Type |
String | Yes |
The media type of the request body.
Default value: "application/json" |
X-Client-Name |
String | No |
The name of the project that is making the request. |
Request body fields
Name | Type | Required | Description |
---|---|---|---|
prompt |
String | Yes |
The input text that serves as the starting point for generating the response. Note: The prompt will be pre-processed and modified before reaching the model. |
num_generations |
Integer | No |
The maximum number of generations that will be returned. Defaults to |
stream |
Boolean | No |
When The final event will contain the complete response, and will contain an
|
preset |
String | No |
Identifier of a custom preset. A preset is a combination of parameters, such as prompt, temperature etc. You can create presets in the playground.
When a preset is specified, the |
k |
Integer | No |
Ensures only the top |
temperature |
Number | No |
A non-negative float that tunes the degree of randomness in generation. Lower temperatures mean less random generations. See Temperature for more details.
Defaults to |
p |
Number | No |
Ensures that only the most likely tokens, with total probability mass of |
truncate |
String | No |
One of Passing If Possible values:
Default value: "END" |
model |
String | No |
The identifier of the model to generate with. Currently available models are |
frequency_penalty |
Number | No |
Used to reduce repetitiveness of generated tokens. The higher the value, the stronger a penalty is applied to previously present tokens, proportional to how many times they have already appeared in the prompt or prior generation. Using |
seed |
Integer | No |
If specified, the backend will make a best effort to sample tokens deterministically, such that repeated requests with the same seed and parameters should return the same result. However, determinism cannot be totally guaranteed. Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments |
return_likelihoods |
String | No |
One of If WARNING: Possible values:
Default value: "NONE" |
end_sequences[] |
Array | No |
The generated text will be cut at the beginning of the earliest occurrence of an end sequence. The sequence will be excluded from the text. |
presence_penalty |
Number | No |
Defaults to Can be used to reduce repetitiveness of generated tokens. Similar to Using |
max_tokens |
Integer | No |
The maximum number of tokens the model will generate as part of the response. Note: Setting a low value may result in incomplete generations. This parameter is off by default, and if it's not specified, the model will continue generating until it emits an EOS completion token. See BPE Tokens for more details. Can only be set to |
stop_sequences[] |
Array | No |
The generated text will be cut at the end of the earliest occurrence of a stop sequence. The sequence will be included the text. |
raw_prompting |
Boolean | No |
When enabled, the user's prompt will be sent to the model without any pre-processing. |
How to start integrating
- Add HTTP Task to your workflow definition.
- Search for the API you want to integrate with and click on the name.
- This loads the API reference documentation and prepares the Http request settings.
- Click Test request to test run your request to the API and see the API's response.