DreamGen API
We offer an API for our Opus V1+ models. The API is available to some of our premium subscription plans. Keep in mind that the DreamGen API is strictly for personal use, and we actively prohibit any form of sharing.
You can interact with the API through HTTP requests from any language. Some APIs are also compatible with OpenAI's client libraries.
Authentication
The DreamGen API uses API keys for authentication. You can create and remove API keys in your account page.
To authenticate the API requests, you submit your API key through the HTTP Authorization
header:
Authorization: Bearer YOUR_DREAMGEN_API_KEY
Keep your API keys secret. Do not share them with other people and do not expose it publicly.
Chat API
This API is currently undocumented.
Text API
POST https://dreamgen.com/api/v1/model/completion
Request
Response
The response is streamed in JSON-lines format, each line containing a JSON object of the type CompletionResponse
as defined below.
OpenAI compatible APIs
We provide several OpenAI compatible APIs, namely:
- Chat API:
POST https://dreamgen.com/api/openai/v1/chat/completions
- Text API:
POST https://dreamgen.com/api/openai/v1/completions
- Models API:
POST https://dreamgen.com/api/openai/v1/models
OpenAI Chat Completion
NOTE: This is a stateless API, message contents are never logged or stored.
POST https://dreamgen.com/api/openai/v1/chat/completions
This is a version of the native Chat API that is compatible with OpenAI's streaming chat completion specification.
See this Python Colab to see how to use it with the official OpenAI Python client library.
Role specification
This section explains how to specfiy the text
role that's required for story-writing and role-playing using the OpenAI Chat API.
We offer a few ways, in order to accomodate different OpenAI clients with various limitations.
So what's the problem? Traditional OpenAI chat request may look like this:
Most OpenAI client libraries will not let you set the role
field to anything other than system
, assistant
or user
, but they will let you set a name
field.
The DreamGen API supports specifying the name
field for messages, for example:
Any turns where name
is not null or undefined will be interpreted as text
(writing) turns with the respective character names. When the name is empty, i.e. "name": ""
, the turn will be interpreted as a narrator text
turn.
You can also specify the role
and name
of the turn that is being generated by the model in response to your requets: assistant
or text
(with or without a name).
To that end, we you can provide a RoleConfig
:
The assistant
and user
config determines how the OpenAI assistant
and user
roles are converted to DreamGen roles, and the assistant
role also determines the role of the model's response.
You can provide RoleConfig
in 2 ways:
Role config inside the model field
The model
field of the request has this shape:
"opus-v1-{size}/{ROLE_CONFIG}"
Where {size}
is either sm
or xl
and where {ROLE_CONFIG}
is a either text
, assistant
or a JSON with the following schema:
You can also use the following shorthands:
opus-v1-{size}/text
: stands for{"assistant": {"role": "text", "open": true}}
opus-v1-{size}/assistant
: stands for{"assistant": {"role": "assistant", "open": false}}
Role config in the request body
You can also provide RoleConfig
in the request body using the role_config
field.
When using OpenAI's Python SDK, you can pass role_config
it using the extra_body
param, see below.
Additional request parameters:
These are additional parameters supported by DreamGen's OpenAI API:
min_p
top_k
repetition_penalty
dry
role_config
(see above)
When using OpenAI's Python SDK, you can pass these using the extra_body
param:
The dry
param represents the setting for the DRY
sampler, and should follow this schema:
Unsupported (ignored) request parameters:
logit_bias
logprobs
top_logprobs
n
response_format
seed
stream
tools
tool_choice
user
function_call
functions
OpenAI Text Completion
NOTE: This is a stateless API, prompt contents are never logged or stored.
POST https://dreamgen.com/api/openai/v1/completions
This is a version of the native Text API that is compatible with OpenAI's streaming text completion specification.
See this Python Colab to see how to use it with the official OpenAI Python client library.
The text prompt
should follow the ChatML+Text prompt format as described in the Opus V1 model guide.
The model
can be either:
opus-v1-{size}
opus-v1-{size}/text
-- model is allowed to only use thetext
roleopus-v1-{size}/assistant
-- models is allowed to only use theassistant
role
Where {size}
is either sm
or xl
.
Additional request parameters:
These are additional parameters supported by DreamGen's OpenAI API:
min_p
top_k
repetition_penalty
When using OpenAI's Python SDK, you can pass these using the extra_body
param:
Unsupported (ignored) request parameters:
best_of
echo
logit_bias
logprobs
n
seed
stream
suffix
user
OpenAI List Models
GET https://dreamgen.com/api/openai/v1/models/list
This API is compatible with OpenAI's List Models specification.