Short Answer
No.http:// versus https:// decides whether traffic is encrypted. HTTP/1.1 versus HTTP/2 is the protocol version, which decides how requests travel over a connection. Any combination of the two is possible.
Almost every user should simply use this address and change nothing:
Two Separate Dimensions
The protocol version is negotiated between client and server when the connection is set up. It is not determined by how the URL is written. APIYI’s
https:// endpoint supports both HTTP/1.1 and HTTP/2 and uses whichever your client supports.
So the common belief that “http means HTTP/1.1 and https means HTTP/2” is a misunderstanding:
- For
http://addresses, mainstream clients do almost always use HTTP/1.1, but that is a coincidence of outcome - For
https://addresses, some clients use HTTP/1.1 and others use HTTP/2, depending on the client itself
Default Version of Common Clients (over https)
To check which version you actually use, run curl:
Which Address Should I Use?
1
End users: use https and change nothing
Individuals and companies calling the API directly should use
https://api.apiyi.com. Common SDKs for Python, Node, and other languages work well as they are, with no protocol tuning needed.2
Go / Java clients with high-concurrency image uploads: keep https, disable HTTP/2 in the client
HTTP/2 puts many concurrent requests on a single connection. When you upload images of several MB, one hiccup on that connection slows every request on it. If your client defaults to HTTP/2 and you run high-concurrency image generation or editing, switch the client to HTTP/1.1. Keep the https address; you do not need to switch to http.
3
http://api.apiyi.com:16888: fallback only
This is an officially provided plain-text endpoint. Use it only as a temporary workaround when the HTTPS handshake itself fails (for example, Python Raises SSLEOFError but curl Works?), or inside a trusted internal network or private line.
How to Switch a Go Client to HTTP/1.1
The no-code option is to set an environment variable for the process. This suits ready-made gateway programs such as new-api and one-api:Transport.TLSNextProto to a non-nil empty map:
Common Misconceptions
Is http:// faster?
Is http:// faster?
For clients that already use HTTP/1.1, such as Python and Node, switching to http only saves one TLS handshake (a fraction of a second). That is negligible next to image generation times of tens of seconds, and it costs you encryption.
Do I have to switch to http:// to turn off HTTP/2?
Do I have to switch to http:// to turn off HTTP/2?
No. HTTP/2 is turned off in the client; see the Go example above. Other languages have similar switches. After that, keep using
https://api.apiyi.com and you get HTTP/1.1 with encryption.Is HTTP/2 bad?
Is HTTP/2 bad?
No. For browsers and ordinary text chat, where requests are small and numerous, HTTP/2 connection reuse saves resources. A single multiplexed connection only becomes a bottleneck when high concurrency combines with large request or response bodies.